Repository navigation
Conversation
Dates in the admin UI ignored the backend locale. Relative labels such as "7 days ago" and the Vue listing dates are formatted by Luxon, which was never given a locale and used the browser's. Their tooltips are rendered by the localdate filter, which without a locale falls back to the current content locale. Admin locales that are not content locales, like cs, got English. - locale.js sets Luxon's default locale from <html lang>, converting Bolt codes like pt_BR to BCP 47. An invalid locale would make Luxon throw on every date it formats, so those keep the browser's locale. - <html lang> uses app.request.locale, the locale the backend is translated into, instead of the user's saved locale, and outputs it as a valid language tag (pt-BR). - The relative_datetime macro and value-only date fields (media edit page) pass app.request.locale to localdate. A locale passed by the caller still takes precedence.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Admin dates ignore the backend locale. Relative labels such as "7 days ago" and the listing dates follow the browser's language, and their tooltips are English unless the backend locale is also a content locale.
Part of localizing the admin UI, alongside #3825.
Changes
assets/js/locale.jssets Luxon's default locale from<html lang>, converting codes likept_BRtopt-BR. Invalid locales keep the browser's locale.relative_datetimemacro and value-only date fields passapp.request.localetolocaldate, which otherwise falls back to the content locale.<html lang>usesapp.request.locale(as Translate the html field editor into the backend locale聽#3825 does) and outputs a valid language tag.Testing
time-test.mp4