Search the FirstSpirit Knowledge Base
Hello All,
Is there a way to change Locale during generation process?
Best Regards,
Ashish Jain
Hello,
you could probably create a new language (German) and use language substitution (see the FirstSpirit Manual for Administrators, chapter 9.4.4).
Best regards,
Tim
Dear Ashish,
do you want to get the content from another language during the generation?
If it is just for the content of a body, maybe this will suit your purpose:
$CMS_SET(actualLanguage,#global.language)$
$CMS_IF(#global.language != #global.project.masterLanguage && !mytext.isEmpty)$$CMS_VALUE(mytext)$$CMS_ELSE$$CMS_SET(#global.language,#global.project.masterLanguage)$$CMS_VALUE(mytext)$$CMS_SET(#global.language,actualLanguage)$$CMS_END_IF$
Explanation:
#global.language contains the language, which is used within the current generation.
ATTENTION:
- If you change this, everything will be generated within the changed language from then on!
So make sure, that you save the current language and make sure, that you switch back to it after the content within the other language is generated. Otherwise all the following pages will be generated within the changed language!
- The switch has no effect on already interpreted content. So you may get confusing output, if parts of the content are already loaded before the language is switched, e.g.functions can be evaluated, before the first line of the template is executed. If you get function results within the wrong language, it could be a solution to use them (function and output of the function) within a format template and to switch the language before the appropriate CMS_RENDER tag.
#global.project.masterLanguage --> the master language of the project. So the example above only switches the language to the master language, if not already the master language is used.
mytext --> an input component, which content should be generated within the master language, if it is empty.
Hint: If you are using database content, you can directly use the database column of another language.
I hope, this will help you solve your proble.
Best regards,
Holger
Dear Mr. Höbbel,
Can we set this somehow in Schedule entry for the deployment?
We have one microsite project with only english language. Same project and same language context (EN) needs to be deployed in 2 separate places. At 1 place it is presented as English version and other place as German version. In German version we need to show numbers and German number format.
2.99 as 2,99
Ideally we can create another language in the project for DE and deploy DE language context but we do not want to maintain same content in 2 different languages. So I am looking for a way to to set language in schedule entry.
Best Regards,
Ashish Jain
Hello,
you could probably create a new language (German) and use language substitution (see the FirstSpirit Manual for Administrators, chapter 9.4.4).
Best regards,
Tim
Thanks Tim,
This is actually best solution for my current problem.
It would be nice if I can also hide/disable the DE language from Site Architect so that editors do not add contents there accidentally. Is it possible?
Best Regards,
Ashish
Hi Ashish,
I'm afraid there isn't. You could use a rule for every input component to hide the language... but don't have the feeling that this solution should be applied.
Regards,
Hannes
Dear Mr. Jain,
if you activate the option "Languages can be hidden" (ServerManager->project properties->Options), an editor can hide a language within the SiteArchitect (Menu View->Visible project languages). But this is a editor specific switch, so every editor has to activiate it and can always deactivate it afterwards.
Best regards,
Holger Höbbel
Thank you Mr. Höbbel,
I think we can manage the situation with this option. So as Tim suggested earlier we can create a dummy DE language, use language substitution and ask editors to hide it from their view. Looks like a nice work around.
Best Regards,
Ashish Jain