WeblateOrg / weblate

Web based localization tool with tight version control integration.
https://weblate.org/
GNU General Public License v3.0
4.64k stars 1.02k forks source link

Support for Twine strings format #6741

Open rtsisyk opened 3 years ago

rtsisyk commented 3 years ago

Describe the problem

My project uses a tool called twine. This tool uses ini-style text file as a source for localizations:

[[Strings]]
  [back]                                    <!-- string id
    en = Back                               <!-- source english string
    tags = android                          <!-- tag, this string is for Android only
    comment = Button text (should be short) <!-- a comment to understand context
    af = Back
    ar = رجوع
    be = Back
    bg = Назад
    cs = Zpět
    da = Tilbage
    de = Zurück
    el = Πίσω
    en-GB = Back
    es = Atrás

A tool generates localization for Android and iOS by using translated strings from the file:

twine generate-all-localization-files --format apple data/strings/strings.txt iphone/Maps/LocalizedStrings/
twine generate-all-localization-files --format apple-plural data/strings/strings.txt iphone/Maps/LocalizedStrings/
twine generate-all-localization-files  --format android data/strings/strings.txt android/res/

Generated files don't lose metadata information from the source text file. For example, android/res/values/strings.xml:

Describe the solution you'd like

Implement support for this format.

Describe alternatives you've considered

See discussion in https://github.com/WeblateOrg/weblate/issues/6346

We tried "2. Drop Twine and upload Android and iOS files directly", but found this approach uncomfortable.

Screenshots

No response

Additional context

https://github.com/WeblateOrg/weblate/issues/6346

nijel commented 3 years ago
github-actions[bot] commented 3 years ago

The issue you've reported needs to be addressed in the translate-toolkit. Please file the issue there, and include links to any relevant specifications about the formats (if applicable).

github-actions[bot] commented 3 years ago

This issue has been added to the backlog. It is not scheduled on the Weblate roadmap, but it eventually might be implemented.

In case you need this feature soon, please consider helping or push it by funding the development.

rtsisyk commented 3 years ago

Weblate currently does not support multi-language translation files, it requires each language to be in a separate file.

OK

Before adding a support in Weblate, translate-toolkit support for the format should be implemented, so that Weblate can build on top of that.

OK

By using Twine, you apparently lose some features of the native formats, such as plurals, see Support plural forms scelis/twine#46

Good point.

nijel commented 3 years ago

An alternative approach might be to use Weblate instead of Twine - stick with only one of the native formats and download the other one using an API (or manually, for example at https://hosted.weblate.org/projects/organicmaps/android/cs/#download).

rtsisyk commented 1 year ago

Is where any chance that implementation of this format will be accepted if somebody contribute it (and all other code standards met)?

nijel commented 1 year ago

Yes, but before jumping on that, please consult the approach to take in Weblate – it is currently built around the expectation that every language has the own file (or set of files).

nijel commented 9 months ago

I've created a tracker issue for multi-language files support: