Closed lakejason0 closed 2 years ago
Sadly it's not on my end, this probably comes from lightdm-webkit2-greeter
which isn't maintained anymore, I probably can't do anything about it :(
I have the same issue. This probably come from function getLocale()
in translation.js.
lightdm.languages.forEach(l => {
if (l.name.toLowerCase() === language) {
lang = l.code.split('.')[0].replace('_', '-');
}
});
Because the name
of both zh_CN
and zh_TW
is the same, which is 中文
if using the api lighdm.language.name
due to
const gchar *language_en = nl_langinfo (_NL_IDENTIFICATION_LANGUAGE);
if (language_en && strlen (language_en) > 0)
priv->name = g_strdup (dgettext ("iso_639_3", language_en));
in language.c when the sys language is zh_CN.UTF-8
. The zh_TW
is after the zh_CN
in the list lightdm.languages
which comes from locale.gen
. So after the foreach
, although zh_CN
matched once, but finally zh_TW
is assigned to lang
, which causes the issue.
In conclusion, this issue is due to the language.name
can not distinguish zh_CN
and zh_TW
.
I think maybe using lightdm.language.code
to search the languages
is a good idea. After I modified the function getLocal()
to
function getLocale()
{
let lang = 'en-US';
if (!lightdm.language || !lightdm.languages) {
return lang;
}
let language = lightdm.language;
if (typeof(language) === "string")
language = language.toLowerCase();
else if (language.code != undefined)
language = language.code.split('.')[0];
else if (language.territory != undefined)
language = language.territory.toLowerCase();
else if (language.name != undefined)
language = language.name.toLowerCase();
else
language = lang;
language = lightdm.languages.find(l => {
let code = l.code;
let territory = l.territory.toLowerCase();
let name = l.name.toLowerCase();
return code.split('.')[0] === language || territory === language || name === language;
});
lang = !language ? lang : language.code.split('.')[0].replace('_', '-');
return lang;
}
this issue disappeared, the theme uses zh_CN
as expected. But this may need further testing.
zh_CN.UTF-8: {
name: '中文',
code: 'zh_CN.utf8',
territory: '中国',
},
zh_TW.UTF-8: {
name: '中文',
code: 'zh_TW.utf8',
territory: '台湾',
},
en_US.UTF-8: {
name: 'American English',
code: 'en_US.utf8',
territory: '美国',
},
Just changed back to this theme (webkit2gtk broke at a point), and that PR doesn't fix my issue. Code in this issue doesn't fix my issue either.
Try set the greeter to the debug mode, put console.log(lang)
& console.log(lightdm.language)
at the end of the getLocal()
function before return, and restart the greeter, check the console in the devtools of the greeter page to see whether lang
is zh-CN
& lightdm.language
is zh_CN.utf8
. If lightdm.language
is not zh_CN.utf8
, this may caused by your sys language config, not the greeter or this theme. I use this theme with sea-greeter
, it just works fine, so I don't know why this PR not works for u. My archlinux is not with me now, so I can not check it these days.
Try set the greeter to the debug mode, put
console.log(lang)
&console.log(lightdm.language)
at the end of thegetLocal()
function before return, and restart the greeter, check the console in the devtools of the greeter page to see whetherlang
iszh-CN
&lightdm.language
iszh_CN.utf8
. Iflightdm.language
is notzh_CN.utf8
, this may caused by your sys language config, not the greeter or this theme. I use this theme withsea-greeter
, it just works fine, so I don't know why this PR not works for u. My archlinux is not with me now, so I can not check it these days.
well, lightdm.language is 中文
. A string, not an object nor a string that follows the language code convention. However, the debug menu is still in Simplified Chinese even if the theme is using zh-TW. Adding those two console.log doesn't work, there isn't any input caught by the devtools. sea-greeter for some reason doesn't work for me, it hangs on boot.
That's weird. From the lightdm's source file language.c, we can see that LightDMLanguage
has code
, name
, territory
, and is an element from lightdm_get_languages()
. And web-greeter(lightdm-webkit2-greeter)'s lightdm.language
& lightdm.languages
should call lightdm's lightdm_get_language()
and ligthdm_get_languages()
respectively to get the current language and language list. So the type of lightdm.language
and the element of lightdm.languages
should be the same(From the js api doc. From your case, the name
& territory
should be 中文
and ''
respectively in the PR code, and using only name
can not distinguish the zh_CN
& zh_TW
, so it go to the else
condition block. Did u try other themes? If other themes can distinguish zh_CN
& zh_TW
, then the problem should caused by this theme.
In short, this issue should be caused by lightdm.language
, if it is a string, it will be the name of current language, and if it is an object, it should have code
, name
& territory
, and this issue can not be solved by this PR.
For sea-greeter, you can try this script to setup.
That's weird. From the lightdm's source file language.c, we can see that
LightDMLanguage
hascode
,name
,territory
, and is an element fromlightdm_get_languages()
. And web-greeter(lightdm-webkit2-greeter)'slightdm.language
&lightdm.languages
should call lightdm'slightdm_get_language()
andligthdm_get_languages()
respectively to get the current language and language list. So the type oflightdm.language
and the element oflightdm.languages
should be the same(From the js api doc. From your case, thename
&territory
should be中文
and''
respectively in the PR code, and using onlyname
can not distinguish thezh_CN
&zh_TW
, so it go to theelse
condition block. Did u try other themes? If other themes can distinguishzh_CN
&zh_TW
, then the problem should caused by this theme.In short, this issue should be caused by
lightdm.language
, if it is a string, it will be the name of current language, and if it is an object, it should havecode
,name
&territory
, and this issue can not be solved by this PR.For sea-greeter, you can try this script to setup.
(I'll just use Chinese, I'm running out of time) 很遗憾,您给的脚本跟我当时安装的步骤基本一致。即使添加了您所编写的额外设置,sea-greeter依然无法正确启动,开机即黑屏。我会尝试其他主题的。
更新:我居然找不到任何有繁体翻译的其他主题……唯一能找到有i18n的主题material2似乎直接把LightDM对象给顶掉了……恐怕他们的i18n实现也不能区分简体繁体。
@lakejason0 你能确认一下分支 migrate2vue3 是否解决了这个问题。我在 lightdm.users
里看到 user
有 language: zh_CN.UTF-8
这个属性,所以在 getLocale 时采用 user.language
而不用 lightdm.language
,目前在我的 archlinux 是可以运行,采用的环境是 lightdm 1:1.32.0-4
, lightdm-webkit2-greeter 2.2.5-6
,webkit2gtk 2.40.1-1
, webkit2gtk-4.1 2.40.1-1
。我想确认一下在其他机器环境下是否有效
@lakejason0 你能确认一下分支 migrate2vue3 是否解决了这个问题。我在
lightdm.users
里看到user
有language: zh_CN.UTF-8
这个属性,所以在 getLocale 时采用user.language
而不用lightdm.language
,目前在我的 archlinux 是可以运行,采用的环境是lightdm 1:1.32.0-4
,lightdm-webkit2-greeter 2.2.5-6
,webkit2gtk 2.40.1-1
,webkit2gtk-4.1 2.40.1-1
。我想确认一下在其他机器环境下是否有效
挺好,但是我已经在用替代的greeter了(毕竟lightdm-webkit2-greeter似乎真的没维护)
I was using Arch Linux. I chose zh-CN as the system language but it shows zh-TW instead. I manually set the LANG variable to
zh_CN.UTF-8
for lightdm but it's still the same. By setting it to zh-TW won't show zh-CN instead and by manually commenting out zh-TW it shows English. The content of/etc/locale.conf
won't effect lightdm as it always choose English.Edit: This no longer happens when
zh_TW.UTF-8
is removed fromlocale.gen
. Idk if it's whose fault so I'll keep this issue here. If it's not at your end please tell me and close this issue.