Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Yetisearch multilanguage setup

Started by Rene 1 week ago · 2 replies · 42 views
1 week ago

At the moment, several UI strings in yetisearch-pro appear to be hardcoded, such as the placeholder text “Search…”.

Does the plugin support translations or language files, so these strings can be displayed dynamically based on the current site language? For example, showing English texts on /en/ pages and German texts on /de/ pages.

1 week ago

@pamtbaau:
GitHub - getgrav/grav-premium-issues: Official Grav Premium Issues repository to report problems or ask questions regarding the Premium products offered. · GitHub

Yes — this works through Grav's standard translation system, it's not Premium-specific.

Any string rendered via the |t filter (Twig) or $grav['language']->translate() resolves against the language files for the active page language, so /en/ and /de/ pick up their respective values automatically. The placeholder in the template already uses |t, so you only need to define the key.

Add it to user/languages/de.yaml and user/languages/en.yaml (these override anything shipped by the plugin and survive updates):

yaml

YAML
# user/languages/de.yaml
PLUGIN_YETISEARCH_PRO:
  SEARCH: "Suche..."

yaml

YAML
# user/languages/en.yaml
PLUGIN_YETISEARCH_PRO:
  SEARCH: "Search..."

One catch worth flagging: if a key is undefined, |t returns the key string itself rather than null, so a chained |default(...) won't fire — which is why an untranslated field shows the raw PLUGIN_YETISEARCH_PRO.SEARCH. Defining the key in the language files is what fixes it.

This is the same mechanism for free and premium plugins alike, so the multilanguage setup you're describing is fully supported.

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Xavier, 4 weeks ago
2 53 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1179 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 47 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 71 2 months ago
Plugins · by Anna, 3 months ago
5 72 3 months ago