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

Support for Twine strings format #6741

Open
rtsisyk opened this issue Nov 1, 2021 · 8 comments
Open

Support for Twine strings format #6741

rtsisyk opened this issue Nov 1, 2021 · 8 comments
Labels
backlog This is not on the Weblate roadmap for now. Can be prioritized by sponsorship. enhancement Adding or requesting a new feature. help wanted Extra attention is needed. translate-toolkit Issues which need to be fixed in the translate-toolkit

Comments

@rtsisyk
Copy link

rtsisyk commented Nov 1, 2021

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 #6346

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

Screenshots

No response

Additional context

#6346

@nijel
Copy link
Member

nijel commented Nov 1, 2021

  • Weblate currently does not support multi-language translation files, it requires each language to be in a separate file.
  • Before adding a support in Weblate, translate-toolkit support for the format should be implemented, so that Weblate can build on top of that.
  • By using Twine, you apparently lose some features of the native formats, such as plurals, see Support plural forms scelis/twine#46

@nijel nijel added backlog This is not on the Weblate roadmap for now. Can be prioritized by sponsorship. enhancement Adding or requesting a new feature. help wanted Extra attention is needed. translate-toolkit Issues which need to be fixed in the translate-toolkit labels Nov 1, 2021
@github-actions
Copy link

github-actions bot commented Nov 1, 2021

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
Copy link

github-actions bot commented Nov 1, 2021

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
Copy link
Author

rtsisyk commented Nov 1, 2021

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
Copy link
Member

nijel commented Nov 1, 2021

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
Copy link
Author

rtsisyk commented Dec 19, 2022

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

@nijel
Copy link
Member

nijel commented Dec 19, 2022

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
Copy link
Member

nijel commented Feb 19, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog This is not on the Weblate roadmap for now. Can be prioritized by sponsorship. enhancement Adding or requesting a new feature. help wanted Extra attention is needed. translate-toolkit Issues which need to be fixed in the translate-toolkit
Projects
Development

No branches or pull requests

2 participants