Translate Output Language
FH versions: V7 Category: Strings, User Interface
This allows the Tools > Preferences > International > Default Output Language to be determined and the associated Language Pack used to translate words and phrases into that language.
The Language Pack Miscellaneous Translation Table may need editing to add the required words and phrases.
The translated text can be applied to published documents in a similar way to Reports, and that is most relevant to Report type plugins and plugins that manage web pages.
Requires: Registry Key Read
Code
Code: Select all
g_trans_misc = { Output_Language = ""; } -- Create global Language Pack translation table
if fhGetAppVersion() > 6 then
local strLang = getRegKey("HKCU\\SOFTWARE\\Calico Pie\\Family Historian\\2.0\\Preferences\\Output Language Id")
if #strLang > 2 then -- Load the miscellaneous translations for chosen Language Pack
local strPack = fhGetContextInfo("CI_APP_DATA_FOLDER").."\\Lang\\"..strLang.."\\lang_trans_misc.fh_lua"
dofile(strPack)
g_trans_misc.Output_Language = " for Output Language "..strLang
else
g_trans_misc.Output_Language = " for English"
end
end
function StrTranslate(strText) -- Translate text to current output language
return g_trans_misc["~CASE:"..strText] or g_trans_misc[strText] or strText
end -- function StrTranslate
Note that g_trans_misc.Output_Language can be used in messages to the user.
Text in the plugin is translated by calling StrTranslate("any text") that returns the translation, or the original text when no translation is available. If necessary, a special CASE can be employed to distinguish different translations.
Related Content
1. Registry Key Read