Feature #20014
closedPage TS option to disable available languages
0%
Description
There is no option to disable a given set of languages to be unavailable in a given subtree. One may already disable languages based on BE groups but not based on a page subtree.
This patch adds an option disableLanguages to pageTS mod.SHARED that allows a set of languages to be removed from the translation page language selector.
Beware: this patch does not work if TemplaVoilĂ is used as TV creates the language selector on its own. Another patch for TV is available with bug report #9465.
I have a site with multiple languages active, let's say French, German, Italian and English. The situation I have is that I want some languages to be deactivated on some subtrees:
root
|-- page1 (no French here)
| |-- page1.1
| `-- page1.2
|-- page2 (no German here)
| |-- page2.1
| `-- page2.2
`-- page3 (no Italian here)
|-- page3.1
`-- page3.2
What I've done with this patch is that I allow disabling (aka removing from the list of possible new translation languages) a comma-separated list of language UID using the standard mod.SHARED pageTS that is already used to set the flag and the name of the default language:
mod.SHARED {
defaultLanguageFlag = en.gif
defaultLanguageLabel = English
disableLanguages = 2
}
This way, I may remove French, German or Italian from the drop-down list of not-yet-available translations in the page list.
This allows me an additional thing as I may now with a bit TS tricking choose another default language for each of these pages 1, 2 and 3. I create four languages in sys_languages, English included, although it is the default language and as such does not need it's own sys_language record. Now I arbitrarily set mod.SHARED.defaultLanguageLabel = Français and set the flag accordingly for this. The editor sees that when he is on page1, the default language is French. Great! But in the drop-down list of translations, I still need to remove the "French" translation as the text was already entered as default language content. And I need the fourth record English in sys_language to allow the default French text to be translated to English.
The rest is just a matter of changing the sys_language_uid in TypoScript and using either sys_language_uid = 0 or 4 (in my case) for the English language if default language is English or another language.
(issue imported from #M10432)
Files