Unable to find where to translate certain tooltip string
Unable to find where to translate certain tooltip string
Unable to find where to translate certain tooltip string
That’s get_available_languages(): Get all available languages based on the presence of *.mo files in a given directory.
Generate JSON files for language translation from po file without wp-cli i18n make-json
Until there is a fix for it in WordPress Core you can use this ‘dirty’ way: Switch to user locale before admin bar items are processed: add_filter( ‘admin_bar_menu’, ‘ws390690_admin_bar_in_user_locale’, 10, 1 ); function ws390690_admin_bar_in_user_locale($wp_admin_bar){ switch_to_locale( get_user_locale() ); return $wp_admin_bar; } Switch back to site locale after admin bar has been rendered: add_filter( ‘wp_after_admin_bar_render’, ‘ws390690_admin_bar_in_user_locale_back’, 10, … Read more
Translate emails into the language of the user
You need to filter ‘sanitize_title’ and use the second argument, the raw title. See my plugin Germanix for an example.
that’s going to be a bit tricky since WordPress doesn’t relate date and time format to language. so to get the current language from the browser you can use $_SERVER[‘HTTP_ACCEPT_LANGUAGE’] and then based on that you can change the date format: function update_date_format(){ $lang = substr($_SERVER[‘HTTP_ACCEPT_LANGUAGE’], 0, 2); if (strpos($lang, ‘au’) > 0){ $date_format=”d/m/Y”; // … Read more
Try using get_bloginfo() instead of bloginfo(). The former returns the value; the latter echoes the value.
Technically, this is possible. You can load as many language files as you want: load_theme_textdomain( ‘text_domain_1’, get_template_directory() . ‘/languages/td1’ ) ); load_theme_textdomain( ‘text_domain_2’, get_template_directory() . ‘/languages/td2’ ) ); In terms of performance it may be useful if want to separate front-end and back-end translations. But it is the wrong solution if do this to manage … Read more
The default text domain is registered in wp_load.php before plugins are loaded. See the function wp_load_translations_early(). So when you register your action callback, the text domain has been loaded already. For an alternative way to list all registered text domains see this answer: List of Default Translated Phrases.