Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LINUX localization? #5569

Closed
pgy866 opened this issue Feb 17, 2020 · 12 comments · Fixed by #5577
Closed

LINUX localization? #5569

pgy866 opened this issue Feb 17, 2020 · 12 comments · Fixed by #5577
Milestone

Comments

@pgy866
Copy link

pgy866 commented Feb 17, 2020

There is no localization in LINUX by default, changing the language has no effect.
Localization in windows adds the current language list by default
截图录屏_选择区域_20200217200201
截图录屏_选择区域_20200217200300

@hishamco
Copy link
Member

Thanks for reporting this, but AFAIK the default locale depends on the OS, but I may have a look to this one

@Skrypt
Copy link
Contributor

Skrypt commented Feb 18, 2020

@pgy866 Can you debug and tell me if the OS returns a culture from the PR.

@pgy866
Copy link
Author

pgy866 commented Feb 18, 2020

@Skrypt Deployed in Linux, Recipe "SaaS", after installation, the display language is the system language zh-CN;

However, in the localization settings, there is no "zh-cn" is added as in Windows deployment. In the settings list, delete or re-add zh-cn.

In Linux, because the default "zh-cn" has been applied, it cannot be deleted and selected in the list. Therefore, after changing the language, it cannot be changed back to "zh-cn"。

Sorry, English is very bad. I use Google Machine Translation, I hope you understand。

@Skrypt Skrypt added this to the 1.0 milestone Feb 18, 2020
@pgy866
Copy link
Author

pgy866 commented Feb 19, 2020

@Skrypt
I deleted "/ App_Data", now LINUX still doesn't work, and another problem also appears in windows;

Use "" 2020-02-19T01: 24: 35Z "to build the latest source code.

Sorry because of language problems, I posted a few pictures, it should be easier to understand.

<<<操作系统uos 20 Linux 4.19.0-6-amd64 (Debian 8.3.0-6) #1 SMP Uos 4.19.67-7deepin (2020-01-11>>>

1 操作系统uos 20 Linux 4 19 0-6-amd64 (Debian 8 3 0-6) #1 SMP Uos 4 19 67-7deepin (2020-01-11)

2 1 操作系统uos 20 Linux 4 19 0-6-amd64 (Debian 8 3 0-6) #1 SMP Uos 4 19 67-7deepin (2020-01-11)

3 1 操作系统uos 20 Linux 4 19 0-6-amd64 (Debian 8 3 0-6) #1 SMP Uos 4 19 67-7deepin (2020-01-11)

4 1 操作系统uos 20 Linux 4 19 0-6-amd64 (Debian 8 3 0-6) #1 SMP Uos 4 19 67-7deepin (2020-01-11)

<<<windows_Server_2019_datacenter>>>

@Skrypt
Copy link
Contributor

Skrypt commented Feb 19, 2020

Here this is what I get from a fresh install in Windows 10. So actually it has nothing to do with TimeZones. It just doesn't find a default system culture. That's really strange.

image

Ok so if you look at the culture list in Windows there is zh, zh-CN and zh-Hans. zh-Hans and zh-CN are both simplified chinese. Here your website is only getting translated in simplified chinese when you set it to "zh" because your browser only has "zh" in it's allowed culture list. For "zh-CN" to work you need to add "zh-CN" to the browser culture settings.

Here the issue is that most people won't have "zh-CN" as a culture in their browser. So, renaming the "zh-CN" folder to "zh" is the appropriate thing to do if you want to support this culture generally. You could also install both culture and keep the "zh" folder and it would take this folder for "zh-CN" translations. Though, since "zh-CN" is a child timezone it doesn't work the other way around.

The other option is to create your own implementation of a AcceptLanguageHeaderRequestCultureProvider to change this behavior and always fallback to "zh-CN" if you always want to be specific about the culture the website should use even if a Browser accepts only "zh".

Also, from one OS to an other the culture list can be different because these cultures are basically taken from the OS on startup of dotnet core and set in it's runtime cache.

@pgy866
Copy link
Author

pgy866 commented Feb 19, 2020

@Skrypt

<<<windows_Server_2019_datacenter>>>
1

@Skrypt
Copy link
Contributor

Skrypt commented Feb 19, 2020

Ok so in Windows, it works like it is expected to as I can see in this last screenshot.
Now for the Linux OS I just need to understand why it doesn't return you any default culture. I suspect that the OS itself doesn't have a zh-CN culture installed or simply returns a NULL value when we look for that default OS culture. I need to find where we do this I don't remember exactly. 😄

@Skrypt
Copy link
Contributor

Skrypt commented Feb 19, 2020

image

Here the value you need to find if it's returning null is CultureInfo.InstalledUICulture.Name from within the Linux OS.

@Skrypt
Copy link
Contributor

Skrypt commented Feb 19, 2020

Now looking at the videos more and the OS is returning you "zh-CN" as the default culture but it's not in the culture list. That's why it sets "zh-CN" as the default culture but doesn't actually add it as a culture in that list of supported culture in the admin UI. The strange part about this is the fact that then it means that your default culture is a culture not listed in your OS cultures.

And also we can clearly see that "zh-CN" is listed as "zh-Hans-CN".

@Skrypt
Copy link
Contributor

Skrypt commented Feb 19, 2020

Here I took a screenshot from a Ubuntu docker image :

image

The same issue exist. After setup it added the "invariant culture" as the default culture of the website since it did not find any default culture from the OS. After that if we look in that culture list. "zh-CN" is listed as "zh-Hans-CN".

I need to look if we can find something like canonical culture names in .NET Core.

@Skrypt Skrypt reopened this Feb 19, 2020
@Skrypt
Copy link
Contributor

Skrypt commented Feb 19, 2020

Here some reading
dotnet/runtime#28893

@Skrypt
Copy link
Contributor

Skrypt commented Feb 19, 2020

Moved to #5595

@sebastienros sebastienros modified the milestones: 1.0, rc2 Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants