Dennis Ploetner
Forum Replies Created
-
Forum: Plugins
In reply to: [Multisite Language Switcher] Href Lang Tag issueI gave you an example of a rewrite of your function. What you really want to archive is probably something like this:
add_filter( 'msls_head_hreflang', function ( $language ) {
return str_replace( '_', '-', $language );
} );The plugin itself applies the following logic though: If the language code contains the region, but the language is exclusive (like German in your example) then the country code will be removed because it is redundant.
Forum: Plugins
In reply to: [Multisite Language Switcher] Href Lang Tag issueThis function here probably does the same as your example:
add_filter( 'msls_head_hreflang', function ( $language ) {
$map = array(
'en_US' => 'en_us',
'en-gb' => 'en',
'es-es' => 'es',
'fr' => 'x-default',
);
return $map[ $language ] ?? $language;
} );In the same function exists another filter called “mlsl_output_get_alternate_links_arr” which expects the array with the generated links as input:
add_filter( 'mlsl_output_get_alternate_links_arr', function ( $links ) {
// do something with the array of links
return $links;
} );- This reply was modified 1 year, 11 months ago by Dennis Ploetner.
Forum: Plugins
In reply to: [Multisite Language Switcher] Site language β> Available languages emptyGlad I could help! Have fun with the Multisite Language Switcher. π
Forum: Plugins
In reply to: [Multisite Language Switcher] Site language β> Available languages emptyDo you refer to the description that you can set in the settings of the plugin?
Forum: Plugins
In reply to: [Multisite Language Switcher] Site language β> Available languages emptyI guess that this has to have also a language file in
/wp-content/languages/ βat least as far as I remember.Forum: Plugins
In reply to: [Multisite Language Switcher] Site language β> Available languages emptyI just realized that the above is not correct. This one is better:
/**
* @param array $languages
* @return array
*/
function my_msls_options_get_available_languages( $languages ) {
if ( ! isset( $languages['en_IN'] ) ) {
$languages['en_IN'] = 'English (India)';
}
return $languages;
}
add_filter( 'msls_options_get_available_languages', 'my_msls_options_get_available_languages' );Forum: Plugins
In reply to: [Multisite Language Switcher] Site language β> Available languages emptyHello,
please make sure that you return also the array languages that is incoming when you use the hook my_msls_options_get_available_languages to add a language.
Here is an example of your specific use-case:
/**
* @param array $languages
* @return string
*/
function my_msls_options_get_available_languages( languages ) {
if ( ! isset( $languages['en_IN'] ) ) {
$languages['en_IN'] = 'English (India)';
}
return $languages;
}
add_filter( 'msls_options_get_available_languages', 'my_msls_options_get_available_languages' );As you can see, languages is an associative array. The keys are the language and region code and the value is the description.
- This reply was modified 1 year, 11 months ago by Dennis Ploetner.
Did you by any chance use a hook to help WooCommerce with the translated slug? The hook
msls_options_get_permalink is also documented here:/**
* @param string $postlink
* @param string $language
* @return string
*/
function my_msls_options_get_permalink( $url, $language ) {
if ( 'de_DE' == $language ) {
$url = str_replace( '/products/', '/produkte/', $url );
}
return $url;
}
add_filter( 'msls_options_get_permalink', 'my_msls_options_get_permalink', 10, 2 );Forum: Plugins
In reply to: [Multisite Language Switcher] Bug %sI just created a new version (2.8.2) that fixes this problem.
Forum: Plugins
In reply to: [Multisite Language Switcher] Bug %sHello, thanks for reaching out. Is this a current version? I see that it works in other pages like https://viacampesina.org/es/16oct21-no-hay-futuro-sin-soberania-alimentaria-es-tiempo-de-transformar/ but shows the problem in the page you linked.
Forum: Plugins
In reply to: [Multisite Language Switcher] Author BIOHey Ivan,
I guess I can reactivate this one here quickly: https://github.com/lloc/Whoami
This would add a description field in any blog. Is it what you were looking for?
Cheers!
Thanks for pointing that out. I will look up what alternatives are currently out there.
Forum: Plugins
In reply to: [Multisite Language Switcher] Redirect Error and unableVersion 2.8.1 is out and solves this problem.
Forum: Plugins
In reply to: [Multisite Language Switcher] Redirect Error and unableI can confirm the bug. It happens also here: https://msls.co/topics/general/
A patch will be provided very soon.
Forum: Plugins
In reply to: [Multisite Language Switcher] Redirect Error and unableThis is weird because it works normally out of the box for every plugin.