Bug 16814 - Simplify including localization in *.c files
Summary: Simplify including localization in *.c files
Alias: None
Product: R
Classification: Unclassified
Component: Wishlist (show other bugs)
Version: R-devel (trunk)
Hardware: All Windows 64-bit
: P5 enhancement
Assignee: R-core
Depends on:
Reported: 2016-04-08 21:03 UTC by Łukasz
Modified: 2016-04-08 21:03 UTC (History)
0 users

See Also:

Introduced 'localization.h' files across R-devel (97.47 KB, patch)
2016-04-08 21:03 UTC, Łukasz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Łukasz 2016-04-08 21:03:09 UTC
Created attachment 2057 [details]
Introduced 'localization.h' files across R-devel

I would like to propose changes to R-devel on the subject of including localization macros (e.g. '_()' and 'ngettext()').

In the attachment you'll find changes to R's code which results in:
1. Moving 'ifdef NLS ...' from Defn.h file to new one called 'Localization.h'
2. Introducing 'localization.h' files for each R-core package.
3. For core packages, adding "localization.h" header in these *.c files where it is necessary (i.e. messages are translatable).
4. For the rest of the code, adding <Localization.h> in these *.c files where it is necessary.
5. Changing 'translations.R' file since I've introduced 'n_()' as a short name for 'dngettext(domain, S, P)'

By applying this diff file:
1. There will be one definition of '_()' (or 'n_()' aka dngettext) per each package, and one definition for the rest of the code. It'll be easier to change them if needed.
2. You'll get consistent macros: _() for dgettext, and n_() for dngettext.
3. There will be no use for "NO_NLS" or "undef _" since if somebody wants to localize messages he/she only has to include "localization.h" (or <Localization.h>)

I succesfully compiled R-devel with these changes both on Ubuntu and Windows 7 (both x86_64). I ran check-devel tests on both platforms and all was ok. I check with my own eyes that messages that were previously translated are still translated.