Skip to content

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

@armin-salihovic

Description

@armin-salihovic

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',

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions