* * *

Author Topic: Is is possible to translate de -> en -> fr and not de -> fr?  (Read 2689 times)

stem

  • New member
  • *
  • Posts: 18
Hi,

I want to have my application translated in several languages.

The default file app.po is German and there exists an English translation (app.en.po).

Does that mean that every possible translator has to translate my application
from my German version? Or is it possible, for example, to take the English
translation and translate it into French?


Thank you

stem

wp

  • Hero Member
  • *****
  • Posts: 3266
Re: Is is possible to translate de -> en -> fr and not de -> fr?
« Reply #1 on: June 24, 2014, 09:29:24 am »
I'd use English as the main language because it should be known to your translaters. From here you can ask them to create po files in any language.

Besides the official documenation (http://wiki.lazarus.freepascal.org/Translations_/_i18n_/_localizations_for_programs) there is also a tutorial http://wiki.lazarus.freepascal.org/Step-by-step_instructions_for_creating_multi-language_applications which explains the translation process. And there is now a worked-out demo in "examples/translation" which demonstrates even right-left text.
Lazarus trunk / fpc 3.0.0 / Win32

stem

  • New member
  • *
  • Posts: 18
Re: Is is possible to translate de -> en -> fr and not de -> fr?
« Reply #2 on: June 24, 2014, 10:36:24 am »
Thank you!

And there is now a worked-out demo in "examples/translation" which demonstrates even right-left text.

That demo looks very nice.

Is it possible to make this demo work without the directory "languages", i.e.
with compiled po-files so that I have everything in one (exe) file?

The code at the wiki "Compiling po files into the executable" does not work (Lazarus 1.2.0):

Code: [Select]
POFile := TPOFile.Create(False);  //if Full=True then you can get a crash (Issue #0026021)
Code: [Select]
main.pas(91,33) Error: Incompatible type for arg no. 1: Got "Boolean", expected "TStream"
stem

wp

  • Hero Member
  • *****
  • Posts: 3266
Re: Is is possible to translate de -> en -> fr and not de -> fr?
« Reply #3 on: June 24, 2014, 11:08:14 am »
Quote
Is it possible to make this demo work without the directory "languages", i.e.
with compiled po-files so that I have everything in one (exe) file?
I never tried this, but I guess you should add the po files as a resource - maybe this helps: http://wiki.lazarus.freepascal.org/Lazarus_Resources

You should be aware of the main disadvantage of the single-file method: Whenever one of your translators changes his translation you have to recompile the application. With separate files for each translation you just have to replace the modified file. The system even can be that flexible that new translations can be added without you being involved.
Lazarus trunk / fpc 3.0.0 / Win32

stem

  • New member
  • *
  • Posts: 18
Re: Is is possible to translate de -> en -> fr and not de -> fr?
« Reply #4 on: June 24, 2014, 09:05:14 pm »
I'd use English as the main language because it should be known to your translaters. From here you can ask them to create po files in any language.

I've just studied the translation example.

Is it correct that in the case above (English as main language) I have to have two files
with the English texts, app.po and app.en.po? Do I have to simply copy each entry
from app.po to app.en.po?

Another question: Without the po files, the program runs without errors, but
completely with English interface, correct?

So many questions ...   :)


Thanx

stem

wp

  • Hero Member
  • *****
  • Posts: 3266
Re: Is is possible to translate de -> en -> fr and not de -> fr?
« Reply #5 on: June 25, 2014, 01:08:58 am »
Quote
I have to have two files with the English texts, app.po and app.en.po? Do I have to simply copy each entry from app.po to app.en.po?
Yes, I just could not figure out yet why the original .po file alone is not working as a valid English translation.

Quote
Without the po files, the program runs without errors, but completely with English interface, correct?
Yes, that's what it is supposed to do. Except that you have the languages hard-coded in your program which would cause issues when your users select a language with non-existing po file. You just have to add code which reads the names of the language files found, extracts the languages from the file names and uses this information to populate a menu or a combobox for language selection. In this case you can even add new languages without having to change anything in your program.
Lazarus trunk / fpc 3.0.0 / Win32

stem

  • New member
  • *
  • Posts: 18
Re: Is is possible to translate de -> en -> fr and not de -> fr?
« Reply #6 on: June 27, 2014, 02:47:55 pm »
Thank you, the translations work very well and cross-platform (Windows and Linux).

How can I find out what the default language of the system is? I have created
a menu with menuitems of all available languages and I want to have the
default language already have checked.


Thank you!  :)

stem

wp

  • Hero Member
  • *****
  • Posts: 3266
Re: Is is possible to translate de -> en -> fr and not de -> fr?
« Reply #7 on: June 27, 2014, 03:05:28 pm »
If I remember correctly the DefaultTranslator provides a routine SetDefaultLang which expects a language code (such as "en", or "de"). But if you call that with an empty string the DefaultTranslator tries to determine the language automatically:

1 - check environment for "--LANG" etc.
2 - call LCL function LCLGetLanguageIDs to determine language

(see DefaultTranslator. FindLocaleFileName).
Lazarus trunk / fpc 3.0.0 / Win32

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus