Conditional French translation context dependent on variable
-
I am building a plugin that creates a custom post type which displays the gear in different players bags. I would like to share the site, but this is a work project so I cannot share a link to it. I’m hoping I am just glazing over some translation option and it can be resolved without needing to look at the front end.
I am currently using
sprintf(__('%1$s\'s %2$s:', $this->plugin_name ), $players_name, $equip_option));
for one of my translation phrases.MY ISSUE: I am translating this into French and the specific phrasing
$players_name's $club_option
has two additional words that vary based on the variable (le/la/les $equip_option de/d'$player_name
). I was attempting to tackle the first word first, with the following context translation:$has_vowel = $this->is_vowel($players_name_metadata); if($has_vowel == true) { $players_name = _x($players_name_metadata, 'starts with vowel', $this->plugin_name); } else { $players_name = _x($players_name_metadata, 'does not start with vowel', $this->plugin_name); }
$this->is_vowel();
checks whether the player’s name starts with a vowel to define the use of de or d’ in the translation.Unfortunately, that conditional translation is not showing up when I run the plugin through POEdit. The
%1$s\'s %2$s:
part is showing up for translation, but there are no other options depending on context.Am I missing something about the context translation options? Is my code just out of order? Am I supposed to make a method to feed the variables and generate the correct translation string?
- The topic ‘Conditional French translation context dependent on variable’ is closed to new replies.