Forum > Translations

Application Translations

<< < (2/2)

Rayvenhaus, I think you asked for instructions. Here are some:
As usual, Wiki has many competing pages for the same thing.

Actually I tried to do the same thing with the new Laz-Model port. I added DefaultTranslator to units and .po files were generated, but I cannot see the translated strings anywhere.

I never added i18n to an application before. I have only done apps with one language in GUIs, or added translations to apps which already had support for it.
Obviously I missed some detail, but which one?

@Juha, Here's a tip: Make an <applicationname>.en.po (a copy of the <applicationname>.po) then use PoEdit to copy all the strings over, (as the English 'translation') else Laz Translator won't use the en.po file.

For an Native-language default app you can use the LCLTranslator unit instead of DefaultTranslator and then call in form.create (example is English)

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---SetDefaultLang('en', 'locale', True); (or whatever your locale folder and native language prefix is) and use 'Language' submenu items to change languages 'on-the'fly' (With SetDefaultLang calls)  You can save the user's choice in a cfg file to autoload at startup.

JSON Editor ( uses this technique to switch English/Spanish on the fly.  It bundles the .po files in the executable as resources and unpacks them to disk on startup.

DefaultTranslator uses system settings to determine the default language, I think.  I don't know what it does if there's no corresponding po file.

Thanks, minesadorada.
The translation started to work with a symlink for the "locale" dir. The exacutable was not in the project dir.
Setting a menu with SetDefaultLang() later may be a good idea.
Please test the new Laz-Model. It is cool!


[0] Message Index

[*] Previous page

Go to full version