OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.23k stars 2.34k forks source link

/Localization/[CultureName]/[ModuleId].po PO file location doesn't work #16153

Open hyzx86 opened 1 month ago

hyzx86 commented 1 month ago

Describe the bug

To Reproduce

Hi all, I've found that this rule mentioned in this document https://docs.orchardcore.net/en/latest/reference/modules/Localize/ doesn't seem to work /Localization/[CultureName]/[ModuleId].po This is a module based on OC 1.8.3 image

But when I use Localisation/zh-CN.po it works fine

Since this template Localisation/[CultureName].po will overwrite the translation files of the other modules when compiled and packaged. I would prefer that the template /Localisation/[CultureName]/[ModuleId].po works. When I run it on 1.8x it doesn't work as expected.

hishamco commented 1 month ago

Seems you started a PR for this, if you are interested it's in your plate otherwise I will create another one

hyzx86 commented 1 month ago

Seems you started a PR for this, if you are interested it's in your plate otherwise I will create another one

I am not familiar with this aspect.

Piedone commented 1 month ago

Shouldn't these locations rather work, @hishamco?

hishamco commented 1 month ago

They should, but we need to ensure the case that Tony reported still worked as expected, @hyzx86 I suggest creating a minimal repo, and then we can check.

hyzx86 commented 1 month ago

They should, but we need to ensure the case that Tony reported still worked as expected, @hyzx86 I suggest creating a minimal repo, and then we can check

I think that test item should be included in the repository, along with automated tests to ensure the stability of the functionality

hishamco commented 1 month ago

What I'm asking for is a repo to ensure that there's a bug, but not miss configuration by you :)

sebastienros commented 1 month ago

The code that loads these files is in ModularPoFileLocationProvider. A breakpoint should help understand why the file is not loaded.

github-actions[bot] commented 1 month ago

We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).

This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.

JulioAmestica commented 1 week ago

the problem could be the ZH-CN language is not present in DefaultPluralRuleProvider. question, why are the languages hard coded?? By the way (the iso 639-1 defines languages codes)[https://www.andiamo.co.uk/resources/iso-language-codes/]

hishamco commented 1 week ago

This should handle Chinese cultures

https://github.com/OrchardCMS/OrchardCore/blob/ba5e8c03c8f3aef138651184317e4859dab7adfd/src/OrchardCore/OrchardCore.Localization.Core/DefaultPluralRuleProvider.cs#L61-L73

hishamco commented 1 week ago

@hyzx86 please is this still happening with you

hyzx86 commented 1 week ago

the problem could be the ZH-CN language is not present in DefaultPluralRuleProvider. question, why are the languages hard coded??

Like Hisham mentioned code, because there's also a concept of hierarchy here

@hishamco It may be necessary to add some unit tests to ensure that zh-CN is recognised as zh.

hishamco commented 1 week ago

https://github.com/OrchardCMS/OrchardCore/blob/2772ac6abbddd5af4f6444420bfc6ef031595409/test/OrchardCore.Tests/Localization/DefaultPluralRuleProviderTests.cs#L7-L27