Ogaku / Oshi

The Hoshi of Oshi's
GNU General Public License v3.0
11 stars 2 forks source link

Localization #6

Closed KimihikoAkayasaki closed 1 month ago

KimihikoAkayasaki commented 10 months ago

It's the best to localize Oshi on Windows — all changes in JSON files will be automatically pushed to the app, and the interface will be refreshed without the need for additional, manual hot restart triggering.

szaszlyki21 commented 10 months ago

I would be willing to try to localize to polish, but i’m only familiar with localizing through weblate - can you elaborate on „localizing on windows” ? Im new to development so could you explain in easier terms

KimihikoAkayasaki commented 10 months ago

That means you'll need to run the app in Debug mode on Windows and make all changes while attached, a sample localization model is as follows:

image

Flutter will automatically refresh the app as you make changes in the code and add more strings to the json localization file. The string getter will fall back to english strings in case something is undefined, and to the key itself if it can't find the string anywhere.

We haven't moved all strings to the shared (json) resources yet, so it will need be done as a part of localizing the app. Apologies for the inconvenience.

For interpolated strings, e.g. 'Value is ${value}', you'll need to use placeholders (your string would become Value is {}) and add a trailing .format(value) (where value is the expression present previously in the ${} or $ block) to the string getter (after .localized)

For more context and better examples please refer to commits made by @xFaiafokkusu and flutter's format package docs.

xFaiafokkusu commented 10 months ago

Weblate is more of a translation thingy. What we need is to change hard coded text into paths to text in JSON. This requires an actual code change. If you're unfamiliar with Dart and not sure what and where to do in that code (even we sometimes don't know) I wouldn't recommend you trying to localize things, most of the time you'll be frustrated and trying to fix something you accidentally broke without knowing why it's broken. What I would recommend tho is to translate things from EN.JSON into PL.JSON or other JSON files - this is very helpful for us

KimihikoAkayasaki commented 1 month ago

https://github.com/Ogaku/Oshifierhttps://github.com/Ogaku/Oshi/commit/59b0c7510ac17385396fea54c96c12e67490251e