LazDataDesktop: use GetLanguageIDFromLocaleName function from Translations unit to properly extract language code from language name passed via command-line option

This commit is contained in:
Maxim Ganetsky 2023-06-12 16:41:34 +03:00
parent 9c8663e0f6
commit 065d9a7d64

View File

@ -1867,7 +1867,7 @@ procedure TranslateStrs;
const
ext = '.%s.po';
var
LangID1, LangID2, basedir, olddir: String;
LangID1, basedir, olddir: String;
LangID: TLanguageID;
begin
olddir := GetCurrentDir;
@ -1876,21 +1876,21 @@ begin
basedir := AppendPathDelim('..') + AppendPathDelim('..');
//
LangID1 := Application.GetOptionValue('language');
LangID2 := '';
if Trim(LangId1) = '' then
begin
LangID := GetLanguageID;
LangID1 := LangID.LanguageID;
LangID2 := LangID.LanguageCode;
end;
end
else
LangID := GetLanguageIDFromLocaleName(LangID1);
TranslateUnitResourceStrings('sdb_consts',basedir+
'components/dbexport/languages/sdb_consts'+ext, LangID1,LangID2);
'components/dbexport/languages/sdb_consts'+ext, LangID1,LangID.LanguageCode);
TranslateUnitResourceStrings('ldd_consts',basedir+
'components/datadict/languages/ldd_consts'+ext, LangID1,LangID2);
'components/datadict/languages/ldd_consts'+ext, LangID1,LangID.LanguageCode);
TranslateUnitResourceStrings('lclstrconsts',basedir+
'lcl/languages/lclstrconsts'+ext, LangID1,LangID2);
'lcl/languages/lclstrconsts'+ext, LangID1,LangID.LanguageCode);
TranslateUnitResourceStrings('lazdatadeskstr',basedir+
'tools/lazdatadesktop/languages/lazdatadesktop'+ext, LangID1,LangID2);
'tools/lazdatadesktop/languages/lazdatadesktop'+ext, LangID1,LangID.LanguageCode);
//
SetCurrentDir(olddir);
end;