How to add pluralization to weblate translations files?

792 views Asked by At

I am trying out weblate self hosting package (MaxOs Docker, to test it out) to manage my translations for an iOS and Android app. I see that pluralisation is possible, but I haven't found a way to add these to a project.

When clicking on start new translation I don't see an option to change the translation into a pluralised form. So how do I add a translations and have the option to change this?

When exporting the translations as android xml file I am looking for something like this.

<resources>
    <plurals name="plural_name">
        <item quantity="zero">zero plural</item>
        <item quantity="other">other plural</item>
    </plurals>
</resources>

On a side note I am also looking for a way to have one key set to share between the android and iOS component. It seems like I have to define all keys and translations twice. I thought I read in the docs that is could be merged, but not clear as how to do this.

1

There are 1 answers

4
Michal Čihař On

Right now, it's not possible to add plurals within Weblate, but it can edit any plurals present in the file. The usual workflow is that the initial strins are added by developers when creating the feature to the English file and it is then translated or proofread within Weblate.

Anyway the iOS strings format doesn't support plurals (see https://docs.weblate.org/en/latest/formats.html#translation-types-capabilities) and Weblate doesn't yet support stringsdict (see https://github.com/WeblateOrg/weblate/issues/623).

PS: For upcoming Weblate release it will be possible to add new plural strings, but probably only using API. I've implemented it today in https://github.com/WeblateOrg/weblate/commit/94669ab8a3a3c2f86e01055ea6150407929a2435.