Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

.Net Core MVC Localization cannot work on ubuntu16.0.4 #7307

Closed
atpyk opened this issue Jan 29, 2018 · 4 comments
Closed

.Net Core MVC Localization cannot work on ubuntu16.0.4 #7307

atpyk opened this issue Jan 29, 2018 · 4 comments
Assignees

Comments

@atpyk
Copy link

atpyk commented Jan 29, 2018

"zh-cn" cannot work when .net core mvc is deployed on ubuntu16.0.4.

I create Resource files follow the hierarchy of Views, and name them "en" and "zh-cn".
My local env. (win10) works fine, but it cannot work on ubuntu, it always show the "Keys" on page.

When I use "zh" instead, the issue fixed. So I guess the "-" is the key.

@mkArtakMSFT
Copy link
Member

Thanks for contacting us. One of our team members will look into it and get back to you.

@mkArtakMSFT
Copy link
Member

@ryanbrandenburg , can you please look into this?

@ryanbrandenburg
Copy link
Contributor

Hey @atpyk, this is actually specific to the set of Chinese cultures rather to whether the name has a "-" in it. As I pointed out here cultures can differ depending on which framework you use. It is also true that cultures differ across platforms. For example, on windows when I do System.Globalization.CultureInfo.GetCultures I get the following cultures which start with zh:

zh
zh-CN
zh-Hans
zh-Hans-HK
zh-Hans-MO
zh-Hant
zh-HK
zh-MO
zh-SG
zh-TW

But if I run the same code on Ubuntu I get:

zh
zh-Hans
zh-Hans-CN
zh-Hans-HK
zh-Hans-MO
zh-Hans-SG
zh-Hant
zh-Hant-HK
zh-Hant-MO
zh-Hant-TW

As you can see, the culture zh-CN only exists on windows, but zh exists on both, which is why you saw the behavior you did.

As for solutions to this, I don't know the specifics of the difference between these languages, but are zh-CN and zh-Hans roughly equivalent since they exist on both platforms? If not the only current solution I can see would be to use zh instead of something more specific. Does that help your issue?

@ryanbrandenburg
Copy link
Contributor

Closing this. If you're still having trouble let us know.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants