Transliterate names to latin for en.strings

This commit is contained in:
Celestora 2022-05-30 11:09:45 +03:00
parent 5d11cdbe46
commit 1667713aa0
3 changed files with 15 additions and 6 deletions

View file

@ -145,14 +145,22 @@ class User extends RowModel
return iterator_to_array($avPhotos)[0] ?? NULL; return iterator_to_array($avPhotos)[0] ?? NULL;
} }
function getFirstName(): string function getFirstName(bool $pristine = false): string
{ {
return $this->getRecord()->deleted ? "DELETED" : mb_convert_case($this->getRecord()->first_name, MB_CASE_TITLE); $name = $this->getRecord()->deleted ? "DELETED" : mb_convert_case($this->getRecord()->first_name, MB_CASE_TITLE);
if((($ts = tr("__transNames")) !== "@__transNames") && !$pristine)
return transliterator_transliterate($ts, $name);
else
return $name;
} }
function getLastName(): string function getLastName(bool $pristine = false): string
{ {
return $this->getRecord()->deleted ? "DELETED" : mb_convert_case($this->getRecord()->last_name, MB_CASE_TITLE); $name = $this->getRecord()->deleted ? "DELETED" : mb_convert_case($this->getRecord()->last_name, MB_CASE_TITLE);
if((($ts = tr("__transNames")) !== "@__transNames") && !$pristine)
return transliterator_transliterate($ts, $name);
else
return $name;
} }
function getPseudo(): ?string function getPseudo(): ?string

View file

@ -43,7 +43,7 @@
<span class="nobold">{_"name"}: </span> <span class="nobold">{_"name"}: </span>
</td> </td>
<td> <td>
<input type="text" name="first_name" value="{$user->getFirstName()}" /> <input type="text" name="first_name" value="{$user->getFirstName(true)}" />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -51,7 +51,7 @@
<span class="nobold">{_"surname"}: </span> <span class="nobold">{_"surname"}: </span>
</td> </td>
<td> <td>
<input type="text" name="last_name" value="{$user->getLastName()}" /> <input type="text" name="last_name" value="{$user->getLastName(true)}" />
</td> </td>
</tr> </tr>
<tr> <tr>

View file

@ -1,4 +1,5 @@
"__locale" = "en_US.UTF-8;Eng"; "__locale" = "en_US.UTF-8;Eng";
"__transNames" = "Latin";
/* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */