File tree Expand file tree Collapse file tree
packages/component-environment Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and 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
4349Initial 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
Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { debug as _debug } from "../debug";
55const debug = ( ...args : any [ ] ) => _debug ( LOCALE_CONTEXT_NAME , ...args ) ;
66
77export 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 ,
You can’t perform that action at this time.
0 commit comments