Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Please add an ability to alter or override the language list in entity_translation_languages().
Multilanguage and multidomain site, requires to have a specified set of the languages per domain.
It is possible by using domain_locale module etc. But currently it is impossible to affect in any way the set of the languages used by entity_translation as well as impossible to affect the generic language_list() function.
I propose a small patch which also can help to implement an integration with other modules like i18n etc in the entity_translation_languages() function.
Comment | File | Size | Author |
---|---|---|---|
#1 | domain_locale_support-1742792.patch | 1.4 KB | sbuts |
Comments
Comment #1
sbuts CreditAttribution: sbuts commentedHere is a tiny function for domain_locale:
Comment #2
noShowP CreditAttribution: noShowP commentedSubscribing. This is something that is very useful and very easy to add in.
Comment #3
stefanos.petrakis@gmail.comTested this and looks nice and clean. But, it's questionable if it is necessary.
Overriding the language_list can actually be done, it's a static variable that you can change from your code.
For a detailed code example of that, look at the
domain_variable_locale.module
of the Domain Variable Locale (sub-module of Domain Variable), it's quite self-explanatory.Here is a shorter version of that code, that you can also use as a first step, it doesn't use Domain Variables:
Comment #4
plachAltering the
language_list()
result by fiddling with its static cache is not ideal, but it should be core's responsibility to allow for a cleaner way to achieve that. So I guess the alter should go in core, @stefanos.petrakis suggested a good workaround as an interim solution.