Force the display of language prefix even when is only one language

Public

Force en prefix language in url even if there is one language

</> CopyGet raw version
php
  1. /**
  2.  * Implements hook_boot().
  3.  * Force en prefix language in url even if there is one language.
  4.  */
  5. function yourmodule_boot() {
  6. global $conf;
  7. if (!isset($conf["language_count"])) {
  8. $conf["language_count"] = 2;
  9. }
  10. else {
  11. if ($conf["language_count"] == 1 && $conf["language_default"]->language == 'en') {
  12. $conf["language_count"] = 2;
  13. }
  14. }
  15. }

Set language_count to 2 to force the display

</> CopyGet raw version
php
  1. /**
  2.  * Implements hook_init().
  3.  *
  4.  * Set language_count to 2 to force the display
  5.  * of the language prefix and language switcher.
  6.  */
  7. function yourmodule_init() {
  8. if (variable_get("language_count", 1) == 1) {
  9. variable_set("language_count", 2);
  10. }
  11. }