It seems that Drupal 7 doesn't provide a function to translate a non-English string to its English equivalent. I'd like to do this for a project I'm working on, but the absence of a reverse-translation function suggests that perhaps I shouldn't. Is there any reason for the absence of a function that translates strings back to English? And how should I achieve this functionality with my project?
1 Answer
t()
function
By Drupal architecture English is a system built-in language which is used as a source language in code.
t()
function allows to translate from system language to any other language. It is simple and expected behavior.
UI
There are UI improvements in Drupal 8: http://hojtsy.hu/blog/2013-aug-20/drupal-8-multilingual-tidbits-12-english-can-now-be-translated
Comment about Drupal 7 "Custom English" and problems with default language:
Using Drupal core alone, this was possible to achieve in Drupal 7 by configuring a "Custom English" language on the site with a language code different from "en", which then allowed you to replace text with your choosing. This quickly gets confusing though because then both the old "en" English language and your new "Custom English" will show up in language selectors, etc. If you disable the "en" English, then your old content saved with that langcode will not display properly. Its a whole can of worms. You may also use String overrides, but if you are using interface translation from core anyway, using one more module for the same task for a specific language is overkill.
i18n features
More complex translation features (like Content translation from core or i18n package) less depend on system language but often depend on default language. Usually you can add content piece in any language and then translate it to English without any problems.
Summary
- In code use English only and translate it to other languages in UI.
- Select default language once and do not change it.
- For changing built-in English strings check out “Translating English strings” section in this article: http://www.packtpub.com/article/setting-basics-drupal-multilingual-site-languages-ui-translation (String Overrides / Custom English / settings.php)
- Discover i18n package tools.
ping -R -c 1
:) Check out my answer please. Feel free to ask questions or add details to your question.