I need to translate the American English Drupal core currently provides out of the box to a variation of English. I know I can use string overrides but there are too many that I need to override. Essentially I need to create my own custom language based off english. Suggestions?
2 Answers
You can do this with the Locale module, which is provided by core. Steps are for Drupal 7. This assumes you want to completely replace the built-in English with your own custom version of English (which will still show the strings for the built-in English unless you have translated/edited them).
- Enable the locale module.
- Go to languages admin (/admin/config/regional/language).
- Click edit for the English (built-in) language. Add en as the Path prefix (this will allow you to add your own language without a path prefix.) Save.
- Click "Add a language"
- Choose "Custom language", set a language code, set both language names to English, leave Path prefix and Language domain blank, and choose Left to right for the Direction.
- Go back to the language list (/admin/config/regional/language) and set your new English as the default language. Then uncheck Enabled for the built-in English.
- Translate all the strings you want to modify on the translation screen (/admin/config/regional/translate/translate).
The Drupal core locale module is all you need to do this. Enable it if required, then navigate to Home » Administration » Configuration » Regional and language
and notice the two tabs "Export" and "Import".
These allow you to export and import .po
files with translations from the default (American English) into your default language. .po
-fils are text files. The format is very simple and consists of pairs like these (the line starting with "#" is a comment):
#: src/colors.inc:36
msgid "color"
msgstr "colour"
So just export all the strings of your site, then translate those that needs translation, and import.
(You may want to create a custom language code for your custom english, just to be able to toggle between American english and custom english, instead of just overrwriting the American english.)