Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing ISO language names when setting locales in config/translatable.php #2619

Open
armin-salihovic opened this issue Jun 19, 2024 · 0 comments

Comments

@armin-salihovic
Copy link

armin-salihovic commented Jun 19, 2024

Description

When adding certain locales in config/translatable.php, the ISO language names will appear only as the language code in the edit page.

Steps to reproduce

  1. enable translations
  2. add a locale that is missing to config/translatable.php, for example bs:
    'locales' => [ 'en', 'bs', ],
  3. open the edit page in Twill and observe the save bar

Expected result

Correct display of the ISO language name.

Actual result

Missing ISO language name, e.g. in the edit page:
image

Versions

Twill version: 3.0.0
Laravel version: 9.52
PHP version: 8.2

Suggested fix

I extracted the language codes that are missing. I suggest adding the following to the return of the function getCodeToLanguageMappings in src/Helpers/i18n_helpers.php to complete the code to language mappings:

'ak' => 'Akan',
'av' => 'Avaric',
'ae' => 'Avestan',
'bm' => 'Bambara',
'bs' => 'Bosnian',
'ch' => 'Chamorro',
'ce' => 'Chechen',
'ny' => ['Chewa', 'Nyanja'],
'cu' => 'Church Slavonic',
'cv' => 'Chuvash',
'kw' => 'Cornish',
'cr' => 'Cree',
'dv' => ['Maldivian', 'Dhivehi'],
'ee' => 'Ewe',
'ff' => 'Fulah',
'lg' => 'Ganda',
'ki' => 'Gikuyu, Kikuyu',
'hz' => 'Herero',
'ho' => 'Hiri Motu',
'ig' => 'Igbo',
'kr' => 'Kanuri',
'kv' => 'Komi',
'kg' => 'Kongo',
'kj' => ['Kuanyama', 'Kwanyama'],
'lb' => ['Luxembourgish', 'Letzeburgesch'],
'lu' => 'Luba-Katanga',
'mh' => 'Marshallese',
'nv' => ['Navaho', 'Navajo'],
'nd' => 'Northern Ndebele',
'ng' => 'Ndonga',
'se' => 'Northern Sami',
'nb' => 'Norwegian Bokmål',
'nn' => 'Norwegian Nynorsk',
'oj' => 'Ojibwa',
'os' => ['Ossetic', 'Ossetian'],
'pi' => 'Pali',
'sc' => 'Sardinian',
'nr' => 'South Ndebele',
'ty' => 'Tahitian',
've' => 'Venda',
'za' => 'Zhuang',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant