TYPO3 v10: Overwrite locale from site configuration - typo3

I have a german website with locale de_DE configured in the site configuration.
On one specific page I want to have locale en_EN.
Is it possible to overwrite the locale via TypoScript or any other way?
The TypoScript setting config.locale_all has been removed in v10.

This could be possible by reading the code. Since version 10, the locale is set in the middleware \TYPO3\CMS\Frontend\Middleware\SiteResolver with
if ($routeResult->getLanguage() instanceof SiteLanguage) {
Locales::setSystemLocaleFromSiteLanguage($routeResult->getLanguage());
}
If you register a custom middleware which is loaded after that one and before the next critical ones (or you could also xclass that one), you should be possible to check the page and change the locale.

Related

Frontent localization settings in TYPO3: config.yaml vs. TypoScript

In the site configuration ((config|typo3conf)/sites/<sitename>/config.yaml), it is possible to configure the languages and choose a "Fallback type", e.g. "strict" or "fallback". I believe, this corresponds to the TypoScript setting config.sys_language_mode.
Now, how do the TypoScript settings and the settings in the site config.yaml work together?
On the Site handling > Add languages page, there is the following hint:
Used to older TYPO3 versions? The following TypoScript settings will be set based on config.yaml - you don’t need to have them in your TypoScript template:
config.language
config.locale_all
config.htmlTag_dir
config.htmlTag_langKey
config.sys_language_uid
config.sys_language_mode
config.sys_language_isocode
config.sys_language_isocode_default
What does this mean? The TS settings will take on the values of the yaml config, but can still be overridden with TypoScript? Which settings are used where?
What happens if you are using for example the bootstrap_package which sets config.sys_language_mode = content_fallback but you want to disable this setting so it uses what is configured in the config.yaml (for example, "strict")?
What happens if you do
config sys_language_mode >
in TypoScript? Does it use the config.yaml setting?
Why do the TypoScript settings still exist?
What is the recommended approach here, do you still need to tamper with the TS settings at all?
(My background is, I have an updated TYPO3 9 site, mostly, it works nicely, but when it comes to the language settings there are still some minor bugs on the site and I am still working on cleaning up the TypoScript settings. Also, I would like to understand this better and where the configuration is moving towards so I do not have to clean up twice.)
The settings you mentioned are all deprecated in TYPO3 Version 9 and have been removed in Version 10.
The corresponding changelog is here:
https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/10.0/Breaking-87193-DeprecatedFunctionalityRemoved.html
and on the long page is stated:
The following TypoScript options have been dropped:
config.concatenateJsAndCss
config.defaultGetVars
config.htmlTag_langKey
config.htmlTag_dir
config.language
config.language_alt
config.locale_all
config.sys_language_isocode
config.sys_language_isocode_default
config.sys_language_mode
config.sys_language_overlay
config.sys_language_uid
...
Related to version 9 your question might be useful as it has to be expected perhaps that some functionality might correlate. I never verified it, so I can't give an answer on it, but for Version 10 you can safely remove all those settings, for the case of any update.

Is config.sys_language_mode in TYPO3 9 with existing site configuration working any more?

in a site with a site definition for a foreign language
fallbackType: fallback
i need for one page branch a different bahavior. Up to TYPO3 8 i used an extension template with
config.sys_language_mode = strict
which did the job. But in TYPO3 9 with an existing site definition this entry seems not to work anymore. Accordiong to the manual
https://docs.typo3.org/m/typo3/guide-frontendlocalization/master/en-us/LocalizationModes/Index.html
it should work but it does not.
Any ideas?
Thanks!
The only possibility is a custom middleware handler. Look here for more details: Change language parameters in site configuration for some pages in a site

How to determine which TYPO3 Version is used without logging in?

I stumbled upon this website right here, where I can simply enter a URL and get the exact version of the TYPO3 that's beeing used. How do I determine that without having any login data? Does this work for any TYPO3-Version?
There is an FAQ page with details on how the version is detected. Among other mechanisms, the analyzer compares source files unique to each TYPO3 version:
How does t3versions determine the TYPO3 major version?
t3versions checks the TYPO3 frontend output, the TYPO3 backend login (if available) and the existence of files (fingerprinting), which are unique for each TYPO3 major version. In order to determine unique files for each TYPO3 major version, the files of all available TYPO3 versions (8+ GB of data excluding PHP files) have been analyzed of for uniqueness.
Typo3 current version can be find from here Typo3 source file.
typo3/sysext/core/Classes/Information/Typo3Version.php
Like
protected const VERSION = '11.5.16';

Create "multilanguage" site without redundant text in typo3

I'm not a big typo3 expert nor have I access to typoscript options at the typo3 instance I'm working with (It's a very big site and I don't have the authorization to do so). So I hope this question fits on stackoverflow (Please don't hate me if it does not, I'll happily post this on another site)
What I'm trying to achieve is:
My website has two possible translations (German and English). I see
that it's possible to switch languages during surfing through
clicking the "German"/"English"-Button
On the website are also informations about our staff (who may not be speaking german)
If one staff member doesn't speak german, I copy redundantly their english profile on the german translation mode (that it appears, because otherwise it doesn't - might be no good style, but it's better than not having them appear at all)
I'm not happy with these kind of redundancy since it means that I have to do the same action twice on the exactly same content. Does there exist a possibility in the backend of typo3 where I can set that the german translation shall be the exact same as the english content?
I hope my question is clear, thanks a lot for your help.
As you say you don't have access to typoscript templates etc, I guess you are not an integrator/developer in this project, but an editor.
Your only way to achieve an automatic "fallback" behaviour is asking the person who takes care of the site's configuration to set that up for you.
But if that's not possible, you can still use the "insert records" content element (german: "Datensatz einfügen") to avoid duplicate entries.
This content type is not in the wizard when you create a new content element. But you can create a text element and then change the type to "insert records". Now you can select another record which is then mirrored here:
You'll have a similar amount of work when setting it up, but you won't have redundant text, which is way better.
If this content type isn't available either, I would insist on the administrator enabling it for editors - it's very useful to maintain a site's content healthy.
Would be helpful to see your TypoScript configuration. Maybe theres something wrong with the sys_language_mode. Given that the sys_language_uid of english is 0 (which means its default language) and german is 1, the default behaviour should be, that german translations are shown, if available. If a translation is not available the default version of a content element is shown. However, you can change this behaviour with Typoscript:
config.sys_language_mode = content_fallback ; 5,3,1
This will set the content fallback of an content element (which is triggered if no translation exists) to sys_language_uid 5, if its not available in that language sys_language_uid 3 will be displayed etc.
Maybe your installation is set to
config.sys_language_overlay = hideNonTranslated
This will hide non-translated content-elements. Remove this entry to enable content fallback again.
You can always check the current Typoscript in the Template module via the TypoScript Object Browser. However, to really get help you need to share your TypoScript language configuration. The behaviour you describe is not the default behaviour, so its configured somewhere.

Zend Translate - Set Locale per User

I'm developing a multi-lingual site.
I've put a Zend_Translate object in the Zend_Registry and I use it to translate all static texts to the selected locale.
My question is how do I change the locale when the user chooses another language?
If I get the translate object from the registry, call setLocale , and put it again in the registry , will it hold only for that user or for the whole application?
Thanks.
You will need to use a plugin for that.
In short: create your plugin and add the routeStartup() and routeShutdown() methods to it. In the former one, set the locale string in a request param and, if needed, also set the requesr URI to contain the locale string. Correct locale string detection is up to you - you can either use a cookie, URL parametre, browser's accepted language header or any combination of the three. In the latter one, create your Zend_Translate object based on the locale you have set earlier.
Here is how it looks like in my CMS.
Here is a tutorial regarding the use of the language parametre in the URL. You may also check how I do it in my CMS (see the _initRouter method).
I hope this info is helpful.
Use Poedit for this purpose ..go thru this link for more
techie.ayyappadas.com/how-do-use-poeditor