Editing Existing Languages or Adding a New One
Important Prerequisites for Language Customization:
Modifying the eDirectory codebase, including its language files, necessitates an owned license and a strong understanding of web development technologies. This includes proficiency in PHP, CSS, MySQL, and the Linux operating system. Please be aware that eDirectory Support cannot provide assistance or troubleshooting for code customizations. However, our specialized Custom Development group is available for consulting engagements if you require expert assistance. Crucially, always create a complete backup of your eDirectory installation before making any code changes.
eDirectory includes built-in language support for: English, Brazilian Portuguese, French, Spanish, Italian, Turkish, and German.
1. Editing Translations for an Existing Language:
To modify the text used for an existing language within your eDirectory site, we recommend the following approach:
Each supported language utilizes a set of translation files. These files are primarily located within the edirectory/web/lang
directory.
For example, the Turkish language translations are found in these files:
/lang/tr_tr.php
(Main translation file for the front-end)/lang/tr_tr_sitemgr.php
(Translations specific to the Site Manager administrative area)/lang/tr_tr.js
(Translations used within JavaScript functions on the site)
In addition to these primary files, further translatable strings are located in the edirectory/app/Resources/translations
directory.
Again, using the Turkish language as an example, these files contain additional translations:
account.tr.xliff
administrator.tr.xliff
advertise.tr.xlf
consent.tr.xliff
filters.tr.xliff
gregwar_captcha.tr.xliff
messages.tr.xliff
recurring.tr.xlf
system.tr.xliff
units.tr.xlf
validators.tr.xliff
widgets.tr.xliff
After making the necessary edits to the translations within the .xliff
and .xlf
files, you must clear the eDirectory cache for the changes to take effect. Navigate to the root directory of your eDirectory installation (/edirectory/
) via your server's command line and execute the following command:
Bash
php -d memory_limit=-1 app/console cache:clear --env=prod
By following these steps, you can successfully modify the translations for any of the default languages included with eDirectory (English, Brazilian Portuguese, French, Spanish, Italian, Turkish, and German).
2. Adding Support for a New Language:
The most straightforward method for adding support for a language not included by default is to repurpose the language files of a language you are not currently using. This involves replacing the existing translations within those files with the translations for your new language. It is essential to translate all the files mentioned in the previous section.
For example, if you choose to replace the Turkish language support with your new language, you would translate the content of these files:
PHP and JavaScript Files:
/lang/tr_tr.php
/lang/tr_tr_sitemgr.php
/lang/tr_tr.js
XLIFF and XLF Files:
account.tr.xliff
administrator.tr.xliff
advertise.tr.xlf
consent.tr.xliff
filters.tr.xliff
gregwar_captcha.tr.xliff
messages.tr.xliff
recurring.tr.xlf
system.tr.xliff
units.tr.xlf
validators.tr.xliff
widgets.tr.xliff
To illustrate, if you are not utilizing the Turkish language, you can modify the content of the Turkish language files to contain the translations for your desired language. Once you have translated all the necessary files, navigate to Language & Geography > Language Settings within your eDirectory Site Manager and select Turkish (or whichever language you chose to replace). Your newly added language will then be active on your site.
Important Limitation: File Naming Convention:
Please note that while you can edit the content of the language files, you cannot change their names. Using the Turkish example, you can replace the Turkish translations within the tr_tr.php
, tr_tr_sitemgr.php
, tr_tr.js
, and the .tr.xliff
/.tr.xlf
files with your own language's translations. However, you must retain the original file names (e.g., tr_tr.php
, account.tr.xliff
).
Important Considerations for Language Support:
- Left-to-Right Language Orientation: eDirectory's core design is optimized for left-to-right languages, such as English. Implementing support for right-to-left languages may result in layout inconsistencies and require significant CSS modifications, which falls outside the scope of standard eDirectory support.
- UTF-8 Character Encoding: eDirectory is developed using the UTF-8 character set. Using other character encodings can lead to unexpected system behavior and display issues. Ensure your translations and file encoding are in UTF-8.
(Applicable for eDirectory versions 13.4 and below)