Skip to content

Commit c55dda7

Browse files
committed
Merge branch 'master' into boilerplate-environment-bump
2 parents 3f92f7c + eee27c6 commit c55dda7

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

packages/component-environment/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.0.6] - 2024-05-07
9+
10+
### Fixed
11+
12+
- Fixed an issue where the locale format `xx_XX` was valid but not `xx`
13+
814
## [1.0.5] - 2024-02-14
915

1016
### Fixed
@@ -42,7 +48,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4248

4349
Initial version.
4450

45-
[unreleased]: https://github.com/saasquatch/program-tools/compare/%40saasquatch%2Fcomponent-environment%401.0.5...HEAD
51+
[unreleased]: https://github.com/saasquatch/program-tools/compare/%40saasquatch%2Fcomponent-environment%401.0.6...HEAD
52+
[1.0.6]: https://github.com/saasquatch/program-tools/releases/tag/%40saasquatch%2Fcomponent-environment%401.0.6
4653
[1.0.5]: https://github.com/saasquatch/program-tools/releases/tag/%40saasquatch%2Fcomponent-environment%401.0.5
4754
[1.0.4]: https://github.com/saasquatch/program-tools/releases/tag/%40saasquatch%2Fcomponent-environment%401.0.4
4855
[1.0.3]: https://github.com/saasquatch/program-tools/releases/tag/%40saasquatch%2Fcomponent-environment%401.0.3

packages/component-environment/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/component-environment/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@saasquatch/component-environment",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"description": "Environment and contexts for SaaSquatch components",
55
"main": "dist/index.js",
66
"module": "dist/index.mjs",

packages/component-environment/src/contexts/LocaleContext.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { debug as _debug } from "../debug";
55
const debug = (...args: any[]) => _debug(LOCALE_CONTEXT_NAME, ...args);
66

77
export function validateLocale(locale?: string) {
8-
if (locale && /^[a-z]{2}_(?:[A-Z]{2}|[0-9]{3})$/.test(locale)) {
8+
if (locale && /^[a-z]{2}(_(?:[A-Z]{2}|[0-9]{3}))?$/.test(locale)) {
99
return locale;
1010
}
1111
}
@@ -26,6 +26,8 @@ export function lazilyStartLocaleContext() {
2626
window.widgetIdent?.locale ??
2727
validateLocale(navigator.language.replaceAll("-", "_"));
2828

29+
debug("initializing with locale:", locale);
30+
2931
globalProvider = new ContextProvider<string | undefined>({
3032
element: document.documentElement,
3133
initialState: locale,

0 commit comments

Comments
 (0)