Add support for client-side localisation #1456
Labels
feature ☀️
priority: urgent
Must be in the next release. Delaying could impact users or features
story-points: 5
Moderate effort. Medium-sized features, complex bug fixes, or API changes. Needs thorough review
Pode currently has support for localisation on server-side strings - primarily errors and some informational text displayed on the terminal.
This will include the other side to this, which is to allow localised values - strings, dates, times, numbers - but for the client-side.
The plan is to leverage the AutoImport feature, which will automatically import any locale files found in a
/locales
folder found at the root of your server - similar to/views
. The path can be customised, or the auto-importing disabled. And there will also be anImport-PodeLocaleData
to do this manually, as well as anAdd-PodeLocale
to fully do it programmatically via a hashtable.The structure of the folder will be the same as what
Import-LocalizedData
expects - where sub-directories are the names of the locales/cultures, and they then each contain.psd1
files.During a web request, Pode will automatically calculate which culture the request should use via:
pode.culture
X-PODE-CULTURE
$WebEvent.Session.Data.Culture
)$WebEvent.Auth.User.Culture
)Accept-Language
header$PSUICulture
en
There will also be new scoped variables to help:
$locale:
$datetime:
$date:
$time:
$number:
The latter ones for datetimes and numbers will help localise variables containing datetimes/numbers.
The text was updated successfully, but these errors were encountered: