fix: Fix detect language
It perhaps no variant for a keyboard's layout, set a default value in order to continue detect local language. Log: Fix detect language.
This commit is contained in:
parent
30263f3c70
commit
cc4701a0c2
1 changed files with 22 additions and 23 deletions
|
|
@ -115,11 +115,6 @@ void X11LayoutsParser::convertLayoutToISO639_2(
|
||||||
const std::vector<std::string> &layoutVariantNames, std::vector<std::string> &iso639_2Codes
|
const std::vector<std::string> &layoutVariantNames, std::vector<std::string> &iso639_2Codes
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (layoutNames.size() != layoutVariantNames.size()) {
|
|
||||||
LOG((CLOG_WARN "error in language layout or language layout variants list"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<X11LayoutsParser::Lang> allLang;
|
static std::vector<X11LayoutsParser::Lang> allLang;
|
||||||
if (allLang.empty() || needToReloadEvdev) {
|
if (allLang.empty() || needToReloadEvdev) {
|
||||||
allLang = getAllLanguageData(pathToEvdevFile);
|
allLang = getAllLanguageData(pathToEvdevFile);
|
||||||
|
|
@ -134,6 +129,7 @@ void X11LayoutsParser::convertLayoutToISO639_2(
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::string> *toCopy = nullptr;
|
const std::vector<std::string> *toCopy = nullptr;
|
||||||
|
if (i < layoutVariantNames.size()) {
|
||||||
if (layoutVariantNames[i].empty()) {
|
if (layoutVariantNames[i].empty()) {
|
||||||
toCopy = &langIter->layoutBaseISO639_2;
|
toCopy = &langIter->layoutBaseISO639_2;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -156,6 +152,9 @@ void X11LayoutsParser::convertLayoutToISO639_2(
|
||||||
toCopy = &langVariantIter->layoutBaseISO639_2;
|
toCopy = &langVariantIter->layoutBaseISO639_2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
toCopy = &langIter->layoutBaseISO639_2;
|
||||||
|
}
|
||||||
|
|
||||||
if (toCopy) {
|
if (toCopy) {
|
||||||
appendVectorUniq(*toCopy, iso639_2Codes);
|
appendVectorUniq(*toCopy, iso639_2Codes);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue