Duplication of file in different locales

I’m building my first instance of Pontoon so I pass through all the troubleshouting so I apologize for the noise.

I created a dummy project in my github that has 2 folders, “en” and “fr” with 1 single .json file in it. (locale.json).
The first file (en/locale.json) embed the key values pairs and the other one nothing (as i want to do the translation in pontoon).

I installed the repository in my pntoon instance as followed:

When I synchronise the project, only one file is updated (en/locale.json) and in both languages.

I was thinking to find a first file: “en/locale.json” in read-only mode in the english locale and “fr/locale.json” to be translated in french locale. Did I misunderstood how pontoon work or is there something wong with my parameters ?

There’s no need to create an empty file in the fr folder, Pontoon will create it as soon as you translate.

With that said, Pontoon at the moment only supports JSON used in WebExtensions, and that’s not the one you’re using. There’s an open pull request to add support for key-value JSON, but not nested.

1 Like

Yes, I forgot to mention that I based my instance on the fork from this PR (because why start simple when you can do complicated ? )

Please clear the “Source repo” checkbox. It actually means that the repository contains source strings directly in the root (instead of in the designated source locale folders).

We should probably make the label more self-explanatory.

1 Like

Please also remove the “English” locale (didn’t see that earlier). Only locales that are being translated into should be enabled.

1 Like

So I assume the absense of the “en” locale is how pontoon guess that “en” is the master locale right ?

@flod As you suggested, I removed the “fr” folder content (which deleted the “fr” folder altogether in the process as git don’t mount empty directories.

Now when I translate 1 key and validate the translation, I cannot synchronize back to the repository:

2022-02-11T16:49:41.998862+00:00 app[worker.1]: [2022-02-11 16:49:41,998: ERROR/ForkPoolWorker-5] Task pontoon.sync.tasks.sync_project[5bd00c7c-6de3-485c-a17d-72747e8003cd] raised unexpected: ValueError(‘Could not find repo matching path /app/media/projects/fake_locale/git@github.com:12rambau/fake_locales.git/templates/fr.’)

what is the templates folder and is it normal that it doesn’t exist ?

That’s explained in a bit more detail here:
https://mozilla-pontoon.readthedocs.io/en/latest/user/localizing-your-projects.html#folder-structure

You actually need that folder probably due to the bug that’s blocking the PR you’re using from being merged:

1 Like

that worked, it’s amazing. Thanks a ton !