-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
Accessing the current locale code from Twig #1056
Comments
If we do go with adding a dedicated key, I can make the PR myself but I'm not sure to which file. |
That's actually a valid point. The default locale can be found in Adding a key in the translation files is indeed a quick and easy fix. However, I'm working on improvement on the locale system for the next version, I'll add this to my list. |
I actually assumed the value of site.locale.default would NOT be
overwritten by the user's selected locale. If it is, then that's what I
need, though I would argue the name to be confusing. That leaves us with
the opposite problem of how to get the default locale, though.
An example use case would be with a JS plugin such as Uppy, which has its
own localisation system that just needs you to tell it what locale to use.
Il mar 17 dic 2019, 14:17 Louis Charette <[email protected]> ha
scritto:
… That's actually a valid point. The default locale can be found in
site.locale.default, but this can be overwritten by the user own locale...
Adding a key in the translation files is indeed a quick and easy fix.
However, I'm working on improvement on the locale system for the next
version, I'll add this to my list.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1056?email_source=notifications&email_token=AJ7HE33O37RYRRFSHM6PXP3QZDGP5A5CNFSM4J3Y3CT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHCKZ7A#issuecomment-566537468>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJ7HE36LGZ5KLHUDVAWFHH3QZDGP5ANCNFSM4J3Y3CTQ>
.
|
Actually, what I meant was, The current locale can be overwritten by the user locale. So |
Implemented in d3f3138 for UF 4.4. Will be available using the
Result :
|
I can't seem to figure out how to get the current locale code (say "en_US" or "it_IT") from Twig in a simple way.
I may just be missing how to do it, but in case there currently isn't a self-contained way, I propose adding a dedicated key to each locale translation as a simple fix.
The text was updated successfully, but these errors were encountered: