2

I have my project localisations in .json files, here’s an english example:

{
  "AreYouSure" : "Are you sure?",
  "DescriptionText" : "This is a very long description text, used to aid the user.",
}

As shown in the example my source strings are merely IDs and not sentences on their own which gives me quite a few issues, for example:

  • I am getting a lot of errors due to source and translation not both ending with a stop / question / exclamation mark
  • Machine translation is not working as it is translating only the id
  • When translating I am seeing only source id which is not helpful when writing for additional languages. I can bypass this by selecting additional languages in user preferences but this will not work in zen mode.

My ideal solution would be to define English as a base language by which English translations would be treated as the source for checklist comparison, machine translations, etc.

My question then, is this possible at all? How should I proceed with this issue?

3 Answers3

3

Yes, it's possible and covered in the Weblate documentation:

... monolingual formats identify the string by ID and each language file contains only mapping of those to given language (typically Android string resources). Some file formats are used in both variants, see detailed description below.

For correct use of monolingual files, Weblate requires access to file containing complete list of strings to translate with their source - this file is called "Monolingual base language file" within Weblate, though the naming might vary in your application.

So just set English file as "Monolingual base language file" and you're done.

Community
  • 1
  • 1
Michal Čihař
  • 9,799
  • 6
  • 49
  • 87
0

For further reference, I achieved this by specifying “--base-file-template” when importing the project:

./manage.py import_project --base-file-template=en-GB/%s.json --file-format=json {project_name} {git_url} {git_branch} *-*/**.json
0

All our keys got changed to the English translation when using the "Monolingual base language file" option.

Example:

STRING001:"Hello World!" became "Hello World!":"Hello World!"

And the "Base file template" does not do anything about those checks.

We still have issues with checks because of the difference between key and source translation (English translation).

Setup:

en/file.csv (source)

STRING001:"Hello world!"

sv/file.csv

STRING001:"Hej världen!"

Warning:

Trailing exclamation
Armali
  • 18,255
  • 14
  • 57
  • 171
Jonathan
  • 48
  • 7
  • It worked better to use the "Monolingual base language file" and uncheck the option "Edit base file" just below. – Jonathan Nov 16 '18 at 14:20