Skip to content

Commit

Permalink
feat(admin/user): new get user language and sort tabs (#1026)
Browse files Browse the repository at this point in the history
  • Loading branch information
Davidmattei authored Sep 30, 2024
1 parent b16765c commit 25f8369
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dev/core-bundle/twig/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ This filter replaces the filter `|data_label`.

Context for the expression:
- rawData: array containing the rawData from document or revision
- userLocale: the preferred locale of the user, fallback environment variable `EMSCO_FALLBACK_LOCALE`
- userLocale: the preferred language of the user, default 'en'

```twig
{# Print the label in the users preferred locale, fallback to label_fr #}
Expand Down
14 changes: 14 additions & 0 deletions upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
* [version 4.x](#version-4x)
* [Tips and tricks](#tips-and-tricks)

## version 5.22.x

* Removed environment variable: `EMSCO_FALLBACK_LOCALE`
* Add new method `getLanguage` on user object

preferred locale 'nl_FR' returns 'nl'
```twig
{% set language = app.user.localePreferred[0:2] %} //before
{% set language = app.user.language %} //now
{# sort based on user language #}
{% set languages = ['fr', 'nl']|sort((a, b) => a == app.user.language ? -1 : b == app.user.language ? 1 : 0) %}
```

## version 5.21.x

* Core twig component Media library: Removed the option `fieldPathOrder`, use new option `sort` (defining all possible sorts)
Expand Down

0 comments on commit 25f8369

Please sign in to comment.