Reading the headline, you will ask "why on Earth would you want to do this?"... But this must be a very common challenge, and I am surprised that there seem to be no good solutions out there.
I am in charge of developing a solution that comes with several GUI languages. My offshore app developers are not native speakers, so the .pot file's English source text needs to be translated into a more refined English version.
So the first file I create is "en-DEV > en-GB". And now comes the first tricky transformation, because obviously I want the translation into other languages based off the "en-GB" version.
For this, I need to create a new .po file which has en-GB as source language and an empty target language. Multi-line entries are a challenge here:
#: src/login/Login.tsx:133
#, fuzzy
#| msgid "Document is locked for $1"
msgid "Account is locked for $1 minute"
msgid_plural "Account is locked for $1 minutes"
msgstr[0] "Document is locked for $1"
msgstr[1] "Document is locked for $1"
Or even more complex:
#: src/workflow/workspace/documents/documentsData/functions/deepl-transation/DeeplTranslateModalWindow.tsx:72
msgid ""
"Warning: This document already contain translated text boxes. If you "
"continue, they will be overwritten."
msgid_plural ""
"Warning: This documents already contain translated text boxes. If you "
"continue, they will be overwritten."
msgstr[0] ""
"Warning: This document already contains translated text boxes. If you "
"continue, they will be overwritten."
msgstr[1] ""
"Warning: These documents already contain translated text boxes. If you "
"continue, they will be overwritten."
Daisy-chaining some GREP statements I somehow manage to swap source and target texts. But this is not a very reliable method.
The new .po files which now have en-GB as source, are translated into de-DE, es-ES and fr-FR.
After this translation comes the really hard part, because obviously the final step is to again swap en-GB with en-DEV, so that the .mo files will actually resolve correctly in the app.
This is all quite brain-wrecking - does anybody know a best-practice way to do this? (I work with PO Edit as an editor.)
A common best practice for managing translations in software development is to use a localization tool or service that supports a workflow for managing source and target languages. You can use Tools like gettext, Crowdin, or Transifex. They can help automate the translation process and handle the complexities you described.