Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Internationalisation update
thomas:
Seeing that we're not doing a feature freeze, I've cleaned up some code that's been annoying me for a long time. :)
Internationalisation support now:
* only opens 5 wrong locations instead of 20 for every catalog opened (unluckily, wxWidgets is too f...ing braindead so you can't get it on the first attempt, but 5 is better than 20)
* no longer stores an integer, but an ISO language string in the config file
* no longer clutters up the config file with catalogs that don't exist any more
* no longer tries to load catalogs that don't exist any more (looking in 20 locations for each)
* no longer hardcodes languages and no longer requires you to rebuild the application to add support for a language
* actually works
What's different for core developers:
Basically, nothing.
What's different for translation maintainers:
1. Everything that belongs to the core application should go into codeblocks.po/mo and everything that belongs to the core plugins should go into core-plugins.po/mo for the sake of efficiency (only load 2 files).
2. Everything that belongs to contrib plugins goes into pluginname.po/mo (but is not your problem, anyway).
What's different for plugin developers:
If you want to localise your plugin, create a yourplugin.po file and the respective yourplugin.mo files.
Drop the .mo files into $SHARE/codeblocks/locale/lang_CODE and Code::Blocks will use them.
byo:
Is there any way to use https://translations.launchpad.net/codeblocks/? Few languages are ready to go :)
BYO
MortenMacFly:
--- Quote from: byo on June 29, 2007, 08:56:09 pm ---Is there any way to use https://translations.launchpad.net/codeblocks/? Few languages are ready to go :)
--- End quote ---
Well... yes...?! I mean - this page is to create *.po and *.mo files which work after applying Thomas' changes. You can d/l the *.po/*.mo files from launchpad. Or what do you mean?!
With regards, Morten.
thomas:
--- Quote from: byo on June 29, 2007, 08:56:09 pm ---Is there any way to use https://translations.launchpad.net/codeblocks/? Few languages are ready to go :)
BYO
--- End quote ---
Download the codeblocks.mo file there, and copy it to the right place, that's it. Downloading is a bit awkaward, you first need a launchpad account, then you request the download, and you are sent an email containing the download link. Don't ask why it's so complicated :)
For a Polish translation, the file would have to go to $SHARE/codeblocks/locale/pl/codeblocks.mo. Any valid lang or lang_COUNTRY code recognized by wxWidgets will be ok.
What Code::Blocks does is this:
1. At startup, it loads the language code from the config and sets the locale accordingly. If something fails, it uses "system default". Then it gets the canonical name for whatever was chosen and lists the .mo files inside the respective directory, adding each of them to the catalog list.
2. When configuring localisation, Code::Blocks lists all directories inside the locale folder, and then verifies one by one if it is a valid ISO code. If it is, it replaces the code with its corresponding human-readable string, adding that to the menu.
Thus, there is no need to hardcode anything any more, and adding a language (or a localisation for a plugin) is a matter of dropping a file into a folder.
If we are to adhere to the standard pedantically, putting the files into $SHARE/codeblocks/locale/lang_COUNTRY/ is wrong, it should be $SHARE/codeblocks/locale/lang_COUNTRY/LC_MESSAGES/.
However, wxWidgets looks in both places anyway, and leaving out the LC_MESSAGES bit removes one unnecessary level of indirection. There is never anything but this one folder inside the language folders, which is kind of pointless, really. Also, it confuses users who haven't done this before (it took me a while to figure out, too).
Code::Blocks will therefore load all files matching *.mo in the lang_COUNTRY folder, which is easier, more comprehensible, and works fine.
thomas:
Oh, on a different note... the old i18n code left a lot of data (one entry for every plugin that you once used) in the config. You can remove all this payload, if you wish, to slim down your config a bit.
The locale config now looks like this (for German (de) language):
<locale>
<ENABLE bool="1" />
<LANGUAGE>
<str>
<![CDATA[de]]>
</str>
</LANGUAGE>
</locale>
The <I18N> tag under environment, and anything related to catalog number or domains inside <locale> can be safely deleted, saving around 1.5 kB of config file space.
You can leave it in place, too... it won't do any damage, other than take a little space.
Navigation
[0] Message Index
[#] Next page
Go to full version