-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to translate provider-badges texts at search results display #104
Comments
You can pass them through the {# Translation key is for example 'your.plugin::lang.badges.blog' #}
{{ 'your.plugin::lang.badges.' ~ (result.badge | lower) }} (or extend the locale of the site search plugin itself: Or you can make it even easier and provide the translated values in a page lifecycle method (untested code): url = "/search"
==
function onStart()
{
$currentLocale = \RainLab\Translate\Classes\Translator::instance()->getLocale();
$locales = [
'de' => ['page' => 'Seite'],
'en' => ['page' => 'Page'],
];
$this['locale'] = $locales[$currentLocale] ?? [];
}
==
Badge: {{ locale[(result.badge | lower)] }} |
I would like the second solution as it seems less complicated. But my know how is not advanced enough to make it work or understand the octobertrick - i didnt succeed unfortunately with all kind of attempts :( you use f.e. Im willing to test more if you help me through and then provide a complete manual for the next ones that live in a mutlilanguages country like Switzerland :) |
But, by the way: I found out how to make the input field multilanguage with your code :). My solution is using the Utopigs.Seo-plugin for translating the meta tags. in the page settings
in the php-section:
and in the view:
|
I found the solution to have a multilanguage provider button, but only for my own models that I feed the search with. In plugin.php of my Plugin f.e.
and then add lines in your lang/locale/lang.php like
But how you can achieve that with the plugins that are already available through the settings is still unknow to me. |
Thank you for this amazing plugin. Im very greatful!
How can I translate the provider-badges?
using a twig translation code thus expectedly not work. Any other magic?
The text was updated successfully, but these errors were encountered: