-->

TYPO3: indexed_search and language

2019-04-11 13:02发布

问题:

If I make a search with indexed_search the page has contents like

Search for: xxx
Page 1
Page x
Next >
Size
Created

but the language of the page is another one. This is true for the default language (german) and another language (slovenski). The configuration of the plugin has either the Language Default or Slovenski.

I have set the config.language parameter

config {
    linkVars = L
    sys_language_mode = content_fallback
    sys_language_overlay = hideNonTranslated
    sys_language_uid = 0
    language = de
    locale_all = de_DE
}

[globalVar = GP:L=]
config {
  sys_language_uid = 0
  language = de_DE
  local_all = de_DE
  htmlTag_langKey = de
}
[global]

[globalVar = GP:L = 1]
config {
    sys_language_uid = 1
    language = en
    locale_all = en_EN
}
[global]

[globalVar = GP:L=2]
config {
     sys_language_uid = 2
     language = it
     local_all = it_IT
}
[global]

[globalVar = GP:L=3]
config {
     sys_language_uid = 3
     language = sl
     local_all = sl_SL
}
[global]

In translation handling I select my languages and click "Check status against repository". But I only get N/A for all entries.

In typo3conf/l10n/de/indexed_search/pi I see a de.locallang.xml. If it is the right file the file is existing, but always the infos of the search results are displayed in English. What is wrong?

回答1:

Which type of problem do you have?:

  1. Is the wording of the text that comes with the search plugin (field label, explanation text) in the wrong language
  2. or are you getting results from content in languages that do not match the current language?

To solve 1.:
Ctrl-select all needed languages in "Extension Manager" -> "Translation handling". Then click "Update from repository" and wait until all language files for all extensions have been downloaded.

To solve 2.:
Add a language dependent setting for plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang to your TS-Setup.

Your setup has multiple flaws by the way, so I give you a complete example for TS-Setup here:

# German language
config.sys_language_uid = 0
config.language = de
config.htmlTag_langKey = de-DE
# the following can differ depending on server OS, e.g. "de_DE.UTF8" on Linux or "german" on Windows:
config.locale_all = de_DE
plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 0

# English language
[globalVar = GP:L=1]
  config.sys_language_uid = 1
  config.language = en
  config.htmlTag_langKey = en-US
  config.locale_all = en_US
  plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 1
[global]

# Italian language
[globalVar = GP:L=2]
  config.sys_language_uid = 2
  config.language = it
  config.htmlTag_langKey = it-IT
  config.locale_all = it_IT
  plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 2
[global]


回答2:

On TYPO3 7.6 i have to set plugin.tx_indexedsearch.settings.defaultOptions.languageUid = to get results from a specific language



回答3:

In Typo3 8.7.9 I had to use

plugin.tx_indexedsearch_pi2.settings.defaultOptions.languageUid < config.sys_language_uid

Note the "_pi2" !!!



回答4:

For TYPO3 V9 LTS, in TYPOSCRIPT Setup :

# Default Language
plugin.tx_indexedsearch.settings.defaultOptions.languageUid = 0

# English US
[siteLanguage("locale") == "en_US.UTF-8"]
    plugin.tx_indexedsearch.settings.defaultOptions.languageUid = 0

# French
[siteLanguage("locale") == "fr_FR.UTF-8"]
    plugin.tx_indexedsearch.settings.defaultOptions.languageUid = 1

[END]