0

I have installed a Drupal 8.5 site in French (monolingual). Then, I added content.

Of course, there are many strings in the PHP files of my custom theme/module I pass to t(). There are also many strings in the Twig files I translated with {{ 'a string'|trans }}.

After a while, I added English.

Unfortunately, I discovered that all the strings (interface) I just mentioned are seen by Drupal as English string.

For example, using the Translation template extractor module, I don't have the choice to extract the strings in English. I have only 2 options for the extraction: Language independent template and Template file for French translations.
When I use the Translation Management Tool module, all the locale sources strings have Original language under the English column and Not translated under the French column.

How do I tell Drupal that all my strings (PHP and Twig) are French strings? Alternatively, what is the process to be able to export/translate in English, and import files (PO or XLIFF) into my site?

1
  • You add your string in the t() function like t('Bonjour')? – Adrian Cid Almaguer Apr 5 '18 at 14:53
1

How do I tell Drupal that all my strings (PHP and Twig) are French strings?

You can not. There is no setting for that, the source code must be english.

Drupal does allow to translate the code/system-english to the actual english if you enable the checkbox when editing the english language. I don't know what that does exactly to potx and I don't think TMGMT supports it either.

2
  • Many thanks... but this is a really bad news! What would be the best process to translate my French site into English? You can link me to any resource. – Baud Apr 3 '18 at 21:15
  • As I said, the only thing that comes to mind is that you enable the checkbox on /admin/config/regional/language/edit/en, then you can manually translate it in the UI, but I don't know if/how you can export or use TMGMT. – Berdir Apr 4 '18 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.