Output Language sensitive Plugins
Posted: 05 Nov 2021 16:31
Many plugins produce Result Sets or other displayable text.
The user can set the Tools > Preferences > International > Default Output Language to a Language Pack?
Perhaps the user has chosen German (DEU 1.1) so plugins should honour that and produce German output.
For example, my Improve Website or CD DVD HTML plugin employs English words, which look out of place in a German language website and ought to be translated.
However, there seems to be no standard method for a plugin to determine and use the chosen Language Pack.
There is a Windows Registry entry:
HKEY_CURRENT_USER\SOFTWARE\Calico Pie\Family Historian\2.0\Preferences\Output Language Id
For the example of German (DEU 1.1) that entry holds DEU 1.1
There is a folder with a matching name:
C:\ProgramData\Calico Pie\Family Historian\Lang\DEU 1.1 that holds the Language Pack files.
e.g.
lang_trans_misc.fh_lua defines language translation g_trans_misc Lua table entries such as:
g_trans_misc['Produced by Family Historian'] = 'Erstellt von Family Historian'
g_trans_misc['Sunday'] = 'Sonntag'
g_trans_misc['Monday'] = 'Montag'
g_trans_misc['Tuesday'] = 'Dienstag'
So a plugin could dig out the Windows Registry Output Language Id entry and load the lang_trans_misc.fh_lua file in order to use the g_trans_misc translation table.
However, does anyone know of a better way?
The user can set the Tools > Preferences > International > Default Output Language to a Language Pack?
Perhaps the user has chosen German (DEU 1.1) so plugins should honour that and produce German output.
For example, my Improve Website or CD DVD HTML plugin employs English words, which look out of place in a German language website and ought to be translated.
However, there seems to be no standard method for a plugin to determine and use the chosen Language Pack.
There is a Windows Registry entry:
HKEY_CURRENT_USER\SOFTWARE\Calico Pie\Family Historian\2.0\Preferences\Output Language Id
For the example of German (DEU 1.1) that entry holds DEU 1.1
There is a folder with a matching name:
C:\ProgramData\Calico Pie\Family Historian\Lang\DEU 1.1 that holds the Language Pack files.
e.g.
lang_trans_misc.fh_lua defines language translation g_trans_misc Lua table entries such as:
g_trans_misc['Produced by Family Historian'] = 'Erstellt von Family Historian'
g_trans_misc['Sunday'] = 'Sonntag'
g_trans_misc['Monday'] = 'Montag'
g_trans_misc['Tuesday'] = 'Dienstag'
So a plugin could dig out the Windows Registry Output Language Id entry and load the lang_trans_misc.fh_lua file in order to use the g_trans_misc translation table.
However, does anyone know of a better way?