__________________________ Localization of DeSmuME _____________________________ Users and translators: 1) Supported UIs 2) Starting a new translation 3) Editors 4) Contact Us Developpers: 5) Creating translation friendly strings (gtk-glade) 6) Updating the template (gtk-glade) 7) Integrating new translations 1 Supported UIs ________________________________________________________________ Although there are 4 UIs, only 3 currently support localization: windows, gtk-glade, and Cocoa (Mac OS X). To translate DeSmuME, see "Starting a new translation" below. If you have created a new translation, or improved an existing one, please send us your translation by getting in touch with us: see "Contact Us" below. 1.1 gtk-glade UI _____________________________________________________________ Localization is done with gettext. gettext uses po files. The po files are located in the po/ folder. Note that there is one po file per language. To use the available translations, set up your environment properly. e.g. under GNU/Linux you can verify that the value of your LANG variable. 1.2 Windows UI ______________________________________________________________ Localization is located in one single file: src/windows/resources.rc . 1.3 Mac OS X (Cocoa) UI _____________________________________________________ Localization files are located within the application bundle (in Finder right click on DeSmuME and select "Show Package Contents"). Within the Contents/Resources folder there is a folder for each localization. 2 Starting a new translation ___________________________________________________ 2.1 gtk-glade UI _____________________________________________________________ Grab a copy of po/desmume.pot and rename it. You can use the two letter iso code of the language as the filename e.g. fr.po or you can specify the country code as well e.g. fr_CA.po Open the newly created file with an editor: see "Editors" below. Translate the strings. 2.2 Windows UI _______________________________________________________________ Grab a copy of src/windows/resources.rc . Create a section for your language by looking at another language e.g. french. Translate the strings. 2.3 Max OS X (Cocoa) UI ______________________________________________________ Copy and paste one of the localization folders mentioned in 1.3. Rename the part before ".lproj" to the language of the translation. Within your newly created folder edit "Localizable.strings". The MainMenu.nib opaque folder also contains localization of the Application menu, however since this is a standard menu in Mac OS X, for most languages standard strings can be generated by Apple's Interface Builder. The strings file should stay in UTF-16 encoding (UTF-8 or others may work, but UTF-16 is preferred). If your strings file has an error, no translated strings will show in DeSmuME. Debugging the string file: If you have Mac OS X developer tools installed, from the console you can type "plutil FILE", replacing FILE with the name and path of the string file, and it will tell you if there are any errors (and on what line). 3 Editors ______________________________________________________________________ You can use plain text editors but there are many po file editors. Here are some recommanded po editors, in no particular order. 3.1 GNU/Linux ________________________________________________________________ - gtranslator: http://gtranslator.sourceforge.net/ - KBabel: http://kbabel.kde.org/ 3.2 OSX ______________________________________________________________________ - LocFactory Editor: http://www.triplespin.com/en/products/locfactoryeditor.html 3.3 All platforms ____________________________________________________________ - poEdit: http://www.poedit.net/ - OmegaT: http://www.omegat.org/omegat/omegat.html - GNUEmacs/XEmacs/AquaEmacs with po-mode - Vim with PO ftplugin - Eclipse with gted 4 Contact Us ___________________________________________________________________ As there isn't many translations so far, we're still asking you to get in touch via the forum located at http://forums.desmume.org/ . You can upload your translation files to your favorite sharing site and paste the link in a post under General. 5 Creating translation friendly strings (gtk-glade) ____________________________ 5.1 In the code ______________________________________________________________ Make sure libintl.h is included and that _() is defined. e.g. see src/gtk-glade/globals.h Add the filename to po/POTFILES.in if it's not already there. Where you would use "my text", use _("my text"). For long strings, for translators' sanity, please do something like: printf( _(" This is a\n\ very long text\n") ); 5.2 Glade interface __________________________________________________________ You have nothing special to do aside from adding the filename to po/POTFILES.in. 6 Updating the template (gtk-glade) ____________________________________________ To update po/desmume.pot, move to the po/ folder and execute "make update-po". 7 Integrating new translations 7.1 gtk-glade UI _____________________________________________________________ Add the new po file to po/ . Add the new language to ALL_LINGUAS in configure.ac . Regenerated the build files (./autogen.sh) and rebuild (./configure && make). You can also add the language to po/LINGUAS (it's a convention? it has no effect). 7.2 Windows UI _______________________________________________________________ Update the src/windows/resource.rc . Add the new language to to the list in src/windows/resource.h . Rebuild. 7.3 Max OS X (Cocoa) UI ______________________________________________________________ After following the steps in 2.3, your translation is ready to go. You can set the DeSmuME language one of three ways: 1) Set the system language (System Preferences -> International). 2) Right click on DeSmuME in Finder, select Get Info and disable the other translations. 3) From a command line, run the following line after replacing LANG with the language: DeSmuME.app/Contents/MacOS/DeSmuME -AppleLanguages 'LANG' All of these methods require a restart of DeSmuME.