question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Brazilian Portuguese lang folder name should be pt_BR (ISO 15897)

See original GitHub issue

Bug report

What I did

Configured the Laravel application locale using ISO 15897 codes in config/app.conf to:

'locale' => 'pt_BR',

Since the Laravel Documentation states:

For languages that differ by territory, you should name the language directories according to the ISO 15897. For example, “en_GB” should be used for British English rather than “en-gb”.

What I expected to happen

Backpack strings such as “entries per page” to be translated to Brazilian Portuguese.

What happened

Text is shown in English, the configured fallback_locale.

What I’ve already tried to fix it

Checked that the folder names for Brazilian Portuguese are pt-BR and pt_br.

Screenshot from 2021-02-17 19-04-37

Of course, setting locale to pt-BR fixes the problem, but then it goes against Laravel recomendation to use the ISO 15897 language codes, and other languages like da_DK have lang folders with the proper name.

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

### PHP VERSION:
PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

### LARAVEL VERSION:
v8.21.0@a61cab167c35f465a923737ee6e6fb99cd5fde88

### BACKPACK VERSION:
4.1.34@d9ec59ab1f9fe03c7106911b5667d912c1cfe1f7

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
pxpmcommented, Feb 19, 2021

Indeed @promatik , I was thinking having both now, but yeah, it’s impossible to have both folders. We can only fix this in 4.2 with a BC.

@matheusb-comp the lang strings don’t change that much. Probably will not change until next version where we could introduce the breaking change, in the meanwhile you would not get “automatic” updates since those files are in user land, and can only be overriden if you specify --force when publishing assets.

Thanks guys for the clarification.

Best, Pedro

2reactions
matheusb-compcommented, Feb 18, 2021

Apparently the text was added to the documentation recently, but it seems that Laravel already opted to use the POSIX locales format internally for some time.

An example of this can be seen in the Authentication UI view stub from version 5.7, where the underline from the locale is changed to a dash to conform with a BCP-47 language tag format.

<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
Read more comments on GitHub >

github_iconTop Results From Across the Web

Portuguese Brazil and Portuguese P… - Apple Developer
Hello, I am using Xcode 8.3. 2 and we made our app to support for Portuguese Portugal (PT-PT) localization and it's working fine...
Read more >
Notice translations of extensions to Portuguese (Brazil) - phpBB
pt_br is the desired directory name in phpBB ... (phpBB 3.0.14) by saying that I should use ISO and directory name the same...
Read more >
RecAPI: Language identifiers
Name enum name Script Continent ISO 639‑3 ISO 639‑2/B ISO 6... English LANG_ENG Latin Europe, Oceania, North America eng eng en German LANG_GER Latin Europe...
Read more >
Brazilian Portuguese (BP) - TypeCraft
Brazilian Portuguese. Português Brasileiro [portuˈɡe(j)s]. Spoken in, Brazil. Region, South America. Total speakers, 190 million (2010 census). Language ...
Read more >
Xcode Project Localized to Portuguese (Brazil), why still show ...
I asked some coders, in Xcode, they just localize to "Portuguese" and skip "Portuguese (Brazil)". No idea why Apple would make such a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found