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.36k stars 2.37k forks source link

Available to upload PO file #3024

Open khoshroomahdi opened 5 years ago

khoshroomahdi commented 5 years ago

add an option to upload PO file in admin area. and it's better to change PO file in admin like Nopcommerce. localization in nopcommerce is very useful because use can translate easily every text that he/she wants.

Skrypt commented 5 years ago

PO files are loaded on startup of the Localization module. So, you can, as of now, add/edit translations on runtime by enabling/disabling the Localization module to reload all it's translations. Though, you need to put your localization files under {yourproject}/App_Data/Localization/{some different paths as stated in documentation}.

I like the idea to be able to edit the PO files directly from the admin since it could also restart the localization module or the tenant every time we would save one of the PO file. Else, an other solution would be to keep it as it is right now but to have a button somewhere to reload the localization translations, but that would be equivalent as reloading the Localization module.

khoshroomahdi commented 5 years ago

So add restart button to admin.

sebastienros commented 5 years ago

Everything is doable.

Options 1- Browse crowding for available translations, and download them automatically to /App_data/Localization/[culture] of the tenant, or the full site. 2- Allow for uploading "ANY" file anywhere in "App_data", but would require Site owner permission 3- Allow for editing any file from App_data directly from the admin 4- Be able to provide custom translations from the admin, and store them in the database. Could then be exported/imported with recipes, as PO files?

I prefer the 4th option. For flexibility and security. The other options are easily solved by copy pasting a file during deployment.

pgy866 commented 5 years ago

4

khoshroomahdi commented 5 years ago

4 For more information look at noncommerce

hishamco commented 5 years ago

The forth option we let us create another StringLocalizer to read the localization resources, while the intend is reading them from .po files

It will be better to use sort of Language Pack that contains the .po files - that's we already TRUST in crowding - to be installed

sebastienros commented 5 years ago

Then we agree on the 4th option. It needs some UI to edit the "dynamic" entries, and also some recipe steps to import/export them. And change the po library to accept other sources than the file system.

hishamco commented 5 years ago

I'm still disagree for the above reasons that I mentioned before

sebastienros commented 5 years ago

Then upload the file from crowdin in your app, and restart the tenant.

hishamco commented 5 years ago

If we provide a way to install a language packs either in setup or from admin, why we need to restart the tenant especially if the culture is already available in the supported list?!!

sebastienros commented 5 years ago

I understand why you want to be able to download a set of po files dynamically from crowdin, the same way we can add support for new languages dynamically, but right now we only support the file system, so it needs to be deployed on all machines, not just the one that handled the request, and this is not trivial.

A solution is to store these entries in the db, which is common to all machines by definition, but then we lose some perf on startup. Which is why I suggest to only allow to add custom string in this database, and ways to import or export it, that will provide a solution to patch missing localizations, or work on them dynamically.