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

Add localizations support #34

Closed
darklinkpower opened this issue May 18, 2022 · 4 comments
Closed

Add localizations support #34

darklinkpower opened this issue May 18, 2022 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@darklinkpower
Copy link

If I'm not wrong the extension has its own system for localization, but as a suggestion I would recommend to use the builtin system for extensions in Playnite:

Documentations: https://playnite.link/docs/master/tutorials/extensions/localizations.html?tabs=csharp

This way you can use something like Crowdin to provide an easy way to edit and update them and also have the string available in the plugin code and in xaml views and resources

An example of a configuration file for Crowdin to automatically pick localization files: https://github.com/darklinkpower/PlayniteExtensionsCollection/blob/master/crowdin.yml

@mtkennerly
Copy link
Owner

mtkennerly commented May 18, 2022

I have some concerns with the builtin system that have kept me from using it:

  • String ID-based translations generally constrain the target language to the source language's grammar. For example, you might have FriendOwnsOneGame and FriendOwnsMultipleGames IDs ("one game" vs "{count} games"), which doesn't make sense for a language without the singular/plural distinction (Japanese) and is insufficient for a language with an additional dual distinction (Arabic).
  • String IDs must be globally unique across extensions.
  • String IDs must be duplicated in each language's file, which is prone to typos and copy/paste errors.

Something like Project Fluent solves the first issue, although it still has the third issue.

@darklinkpower
Copy link
Author

  1. Personally I don't think it should be an issue. Localization should be done by someone who knows the base language, english in this case, and localize it in a way that works in the target language. I've done the localization for Playnite and different Playnite extensions projects into spanish and I've ran into this issue a lot of times but I've made decisions to decide what works best for the localization. But even then, I've little experience in this and this situation may be worse for other languages
  2. Yeah unfortunately it's a limitation but it can be fixed by just adding the extension name as a prefix, for example: https://github.com/darklinkpower/PlayniteExtensionsCollection/blob/b29e507ae26e2266e310c62869a0f5663ca39473/source/Generic/PlayState/Localization/en_US.xaml#L1-L5
  3. This is one of the main reasons why I'm suggesting to use the provided localizations system. Using dictionary files allows you to use something like Crowdin that provided a very easy way for anyone without coding experience to contribute localizations. Crowdin also takes care of making automatic PRs that updates new localizations and add new strings to the different language files. Example: https://github.com/darklinkpower/PlayniteExtensionsCollection/pull/251/files But I'm not familiar with Project Fluent, I'll take a look as it may have a similar system that does this or there may be one out there that does this

@mtkennerly
Copy link
Owner

Oh, it looks like Crowdin actually supports Project Fluent (source), and there are a couple of .NET implementations (Fluent.Net, Linguini). I'll give it a shot, since it addresses two of my three concerns.

@mtkennerly
Copy link
Owner

Both Ludusavi and the plugin are now on Crowdin and using Project Fluent for translation files:

I'll try to get a plugin release out within the next few days with the latest changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants