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

4 / 5 letter language codes #41

Open
MarienTimOnline opened this issue Feb 15, 2017 · 4 comments
Open

4 / 5 letter language codes #41

MarienTimOnline opened this issue Feb 15, 2017 · 4 comments

Comments

@MarienTimOnline
Copy link

Hi there.
The docs state:

"It's advisable to stick to two-letter language codes."

That would be fine normally, but a client has customers in different countries where language-difference within the base language actually matters.

So I really need 'de-DE' and 'de-CH' on this one (for example).

How can I achieve this?
I believe the code of the extension itself only wants to check on 2 digits.

@bobdenotter
Copy link
Contributor

Have you tried using de and ch to differentiate between the two?

@MarienTimOnline
Copy link
Author

I did, and that broke the whole translation principle.

In vendor/bolt/labels/src/LabelsExtension.php line 93 you can actually see the extension cutting back to the '2 digit version'

Set the current language, always based on a 2-letter code

$lang = substr($request->getLocale(), 0, 2);

@bobdenotter
Copy link
Contributor

Hmm. Do you have a suggestion on how to fix this?

@MarienTimOnline
Copy link
Author

Well in a functional sense the code should count the digits.
If the label (the label's label) is 2 digits long, then the first part of the 'locale' can be matched. If the label is 2+ digits (nl-NL, but also nl_NL) it should try to match 5 digits of the locale.

In a technical sense, all relevant code seems to be in LabelsExtension.php.

Somehow the extension would need to 'allow' for 2 OR 5 digit languagecodes.
Of course, the admin would need to use one or the other in the labels matrix... or things might break.

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

2 participants