WP_Translations::make_entry
Builds a Translation_Entry from original string and translation strings.
Method of the class: WP_Translations{}
No Hooks.
Returns
Translation_Entry. Entry instance.
Usage
// private - for code of main (parent) class only $result = $this->make_entry( $original, $translations ): Translation_Entry;
- $original(string) (required)
- Original string to translate from MO file. Might contain
0x04 as context separator or 0x00 as singular/plural separator. - $translations(string) (required)
- Translation strings from MO file.
Notes
- See: MO::make_entry()
Changelog
| Since 6.5.0 | Introduced. |
WP_Translations::make_entry() WP Translations::make entry code WP 6.8.3
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;
}