Builds a Translation_Entry from original string and translation strings.
Description
See also
Parameters
$original
stringrequired- Original string to translate from MO file. Might contain 0x04 as context separator or 0x00 as singular/plural separator.
$translations
stringrequired- Translation strings from MO file.
Source
private function make_entry( $original, $translations ): Translation_Entry {
$entry = new Translation_Entry();
// Look for context, separated by \4.
$parts = explode( "\4", $original );
if ( isset( $parts[1] ) ) {
$original = $parts[1];
$entry->context = $parts[0];
}
$entry->singular = $original;
$entry->translations = explode( "\0", $translations );
$entry->is_plural = count( $entry->translations ) > 1;
return $entry;
}
Changelog
Version | Description |
---|---|
6.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.