Closed IsQiao closed 1 year ago
There are discrepancies between different OS with these culture codes. You simply need to rename the folder/file of your choice to the appropriate culture code for this to work.
rename the directory can resolve it, but There are same problems in macos and windows 10.
so i suguest to add zh
dir to OrchardCore.Translations
repo, or add some codes to enhance it. (^_^)
@agriffard Does Crowdin supports adding the "zh" culture or do we keep only specific culture/regions culture codes?
It looks like it's just a display problem here, because it works fine on setup page, but once you switch to English, you can't change it back to Chinese
The option zh-CN
is not listed here
But I remember that there was no problem with some previous versions, I wonder why zh-CN
was deleted
@agriffard
FYI Crowdin nowdays have both zh-CN
and zh-TW
, so when you choose zh
can't find the root culture, so you can choose one of the supported cultures or rename the culture folder as workaround
@hishamco No, that is not a right way. As a Web application, we should follow the browser Settings, not let the user choose
FYI localization APIs already have 3/4 RequestCultureProvider
s, then it uses a fallback mechanism to the parent culture in case the current cultures is not present
Yes, I remember of a problem, language choice, on the Setup page is good, there use
IOptions<RequestLocalizationOptions> LocOptions
let me have a try..
faild 🤣
model.Cultures = _locOptions.Value.SupportedCultures
.Select(cultureInfo =>
{
return new CultureEntry
{
Supported = settings.SupportedCultures.Contains(cultureInfo.Name, StringComparer.OrdinalIgnoreCase),
CultureInfo = cultureInfo,
IsDefault = String.Equals(settings.DefaultCulture, cultureInfo.Name, StringComparison.OrdinalIgnoreCase)
};
}).ToArray();
Just let me know what will happen if you set your culture to zh-CN
in the admin?
FYI localization APIs already have 3/4
RequestCultureProvider
s, then it uses a fallback mechanism to the parent culture in case the current cultures is not present
Yes, my layer tried to get all cultures first using CultureInfo.GetCultures(CultureTypes.AllCultures)
and then all subcultures through SelectMany(x=>x.getAllChildxxx)
, but I couldn't find the right way .
Just let me know what will happen if you set your culture to zh-CN in the admin?
But, there is no place for switching languages in the OC admin theme.
Try to set zh-CN
as default culture and have a try
BTW I think you did the following fallback
Right?
BTW I think you did the following fallback
Right?
Yes, we can only get parents from children, but not vice versa. I haven't found a way
Of course you can't ;)
Try to set zh-CN as default culture and have a try
I don't need to set zh-CN
as Default, because the program recognizes that the browser's default language is
zh-CN
, so when I add zh-CN
, OC will automatically apply it
To make it clear, what's your browser default language? your OC default language?
I don't need to set zh-CN as Default,
Why? so, what's you preferred language?
in my submission.. All the billions of browsers in China should be zh-CN
🤣
So, what's the problem then? Just set your default culture in OC to zh-CN
then it should work
problem is ..
As I did in PR, zh CN can only be obtained in this way
leave the code for now , the cultures might differ from OS to another, just let me know if you set zh-CN
as default culture in OC what happen? is it displayed correctly or not?
in .net 5.0
rename the directory can resolve it, but There are same problems in macos and windows 10. so i suguest to add
zh
dir toOrchardCore.Translations
repo, or add some codes to enhance it. (^^_)
As mentioned above, it is the same on Mac and Windows
leave the code for now , the cultures might differ from OS to another, just let me know if you set zh-CN as default culture in OC what happen? is it displayed correctly or not?
correctly!
If it's displayed correctly, the zh
is not a problem because OC don't provide a resources for it by default
Ok, so we should change the zh-CN
folder to zh
or map it to zh
in oc
then zh-CN -> zh-Hans -> zh
if we change it to zh
what about zh-TW
?
then zh-CN -> zh-Hans -> zh
For that I told you try to set your default culture to zh-CN
and forgot everything about zh :)
But if I do not explicitly add zh-CN
there, there will be no zh-CN
option on the page
Therefore, 'zh CN' cannot be set as the default
Did you mean there's no option for zh-CN
in the available cultures?
😥My PR just add an option on the UI
@hyzx86 please refer to https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo?view=net-7.0#cultureinfo-and-cultural-data
zh-CN
is an alias to zh-Hans-CN
which is should be available in your OC installation
I realize that we need to rename the Chinese cultures folders to zh
or in case to support simplified & traditional versions we should use zh-Hans-CN
and zh-Hant-TW
or more precisely zh-Hans
and zh-Hant
instead of zh-CN
and zh-TW
@hyzx86 correct me if I'm wrong
/cc @sebastienros @agriffard
Let me try, but I don't think it should recognize the zh-CN passed in by the browser
I think we should ignore both zh-CN
and zh-TW
Yes, it doesn't recognize the language information passed in by the browser
It's been a long time coming, almost a year since 6.0 was released This question is very unfriendly to Chinese users New Chinese developers think there is no Chinese language option at all Sometimes can inexplicably install a Chinese interface out.
Or, just to keep things simple, let's iterate over all the language packages supported by OC and just show the ones that are supported. There are so many languages in the world and OC only supports some of them. Why list them all?
As I mentioned above zh-CN
is not listed that's why I'm suggesting not relaying on such cultures. I just renamed zh-CN
folder to zh-Hans-CN
and everything works as expected
That's because your browser's default language is not zh-CN I think default should refer to the browser language first and the site language second As you can see in my screenshot above, if you add the zh-CN option, it will recognize the installed language based on the browser language even if zh-CN is not set as the default language
Just let me know what will happen if you set your culture to zh-CN in the admin?
chrome_mD27wx9tZM.mp4 But, there is no place for switching languages in the OC admin theme.
here
FYI if your browser has one of the listed culture it will get a priority, coz RequestCultureProvider
check AcceptLanguageHeaders
first
@hyzx86 The reason is that cultures can have different codes based on the OS that you are using. We are using Crowdin to generate these culture folders so that we have at least translations for common culture codes. We can't provide every folder for every culture code.
What I see is that zh-CN is not available after .NET 5.0 and that might be the source of the problem. So adding it manually might "fix" the issue. Can someone look for the recording of the meeting when we decided which zh languages we would support by default (there were concrete arguments).
Also having support for zh
might be a good safety net. However I am not sure which current files should become the zh
ones. Traditional Chineese?
Results in sharplab io whatever the .NET version
zh - Chinese
zh-Hans - Chinese (Simplified)
zh-Hans-CN - Chinese (Simplified, China)
zh-Hans-HK - Chinese (Simplified, Hong Kong SAR China)
zh-Hans-MO - Chinese (Simplified, Macao SAR China)
zh-Hans-SG - Chinese (Simplified, Singapore)
zh-Hant - Chinese (Traditional)
zh-Hant-HK - Chinese (Traditional, Hong Kong SAR China)
zh-Hant-MO - Chinese (Traditional, Macao SAR China)
zh-Hant-TW - Chinese (Traditional, Taiwan)
@hyzx86 Assuming we create a new zh
culture so we have a fallback in all cases (which I think would be safer). Should this zh
culture use zh-Hant - Chinese (Traditional)
or zh-Hans - Chinese (Simplified)
?
Then we would just add the other one as a specific one
Examples:
1- zh
(with Simplified values) + zh-Hant
2- zh
(with Traditional values) + zh-Hans
Assuming we only keep
zh-Hant,zh-Hans
Yes, I think these are enough, because in terms of characters, Chinese is not so much variety, it is more about pronunciation
But t for me personally... zh-Hans This kind of writing is a little strange. I've been using computers for decades and I'm most familiar with zh-CN because that's how almost all websites are written. Just like here:
or here
So basically "simplified" Chinese is more common?
Describe the bug
To Reproduce
Steps to reproduce the behavior:
CurrentUICulture
field value iszh
,zh
localization dir. because it is not existed.en-US
culture.Expected behavior
show Chinese properly
Screenshots