Skip to content

Instantly share code, notes, and snippets.

@timwhitlock
Created February 28, 2018 13:42
Show Gist options
  • Save timwhitlock/9a3f1c9a113f47a09093027d7dc72dab to your computer and use it in GitHub Desktop.
Save timwhitlock/9a3f1c9a113f47a09093027d7dc72dab to your computer and use it in GitHub Desktop.
Forces Loco Translate to display Catalan as Valencian without changing "ca" tag
<?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