Recent

Author Topic: I18N and maintaining PO files  (Read 1720 times)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7627
Re: I18N and maintaining PO files
« Reply #15 on: April 23, 2019, 11:16:57 am »
In my own dxgettext based windows only Delphi app, I have a combobox like Lazarus but with some additional options:

1. System default (whatever the default language detection yields, fall back to builtin if not detected)
2. none(no translation, easy to check what the key text is for a certain control)
3. a list of detected .mo files  (besides files on disk, it also checks a list of internal Windows resources), so the user can override.

The configuration setting is initialized on system default, and also reverts to that if the configuration contains a language for which the mo is no longer available. Changing the combobox is only active after restart. There are also some hacks to fall back from similar locales  (like map all german and french variants to the core french, since we don't really provide dialect translations).

One of the reasons is that the same app is sometimes used in multiple locations, with technical/lab staff preferring english(since they often receive betas and directly communicate with us), and the normal work floor in local language. But it is the same company so they all have the same localized windows.

« Last Edit: April 23, 2019, 11:18:40 am by marcov »

Thaddy

  • Hero Member
  • *****
  • Posts: 9293
Re: I18N and maintaining PO files
« Reply #16 on: April 23, 2019, 12:44:18 pm »
You should adhere to standards.

There is no standard. libgettext intercepts params on unix, but we don't use libgettext, so our parameters work differently. (and e.g. Lazarus allows setting language persistent without messing with environment variables or cmdline parameters)
Using the format alone counts as standard to me.... But it is largely a free world. I expect things to work, preferably in similar manners.
also related to equus asinus.

dbannon

  • Hero Member
  • *****
  • Posts: 788
    • tomboy-ng, a rewrite of the classic Tomboy
Re: I18N and maintaining PO files
« Reply #17 on: April 23, 2019, 12:46:44 pm »
Yep, its no more that a couple of line to fix. Just needs (in LCLTranslator, FindLocalFileName()  )
Code: Pascal  [Select]
  1. if Application.HasOption('l', 'lang') then
  2.   lang := Application.GetOptionValue('l', 'lang')
  3. else begin
  4.      //
  5.      // do existing stuff that detects space separated syntax
  6.      //
  7. end;

Oh, and wp, the '=' syntax is the GNU recommended model, its just they accepts people do it with a space sometimes.

I'll put in a bug report with a patch.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

dbannon

  • Hero Member
  • *****
  • Posts: 788
    • tomboy-ng, a rewrite of the classic Tomboy
Re: I18N and maintaining PO files
« Reply #18 on: April 23, 2019, 02:07:11 pm »
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng