Created
February 28, 2018 13:42
-
-
Save timwhitlock/9a3f1c9a113f47a09093027d7dc72dab to your computer and use it in GitHub Desktop.
Forces Loco Translate to display Catalan as Valencian without changing "ca" tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Valencia variant | |
Description: Makes "ca" locale appear like "ca-valencia" in Loco Translate | |
Author: Tim Whitlock | |
Version: 1.0.0 | |
*/ | |
// Only running for admin screens | |
if( ! is_admin() ){ | |
return; | |
} | |
// This forces Loco Translate to display "ca" as Valencian | |
function on_loco_parse_locale( Loco_Locale $locale, $tag ){ | |
if( 'ca' === $tag ){ | |
$locale->setName('Valencian','Valencià'); | |
$locale->setIcon('lang lang-ca variant variant-valencia'); | |
} | |
} | |
add_action('loco_parse_locale','on_loco_parse_locale',10,2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment