|
@@ -38,7 +38,7 @@ export abstract class LocaleBasePipe implements OnDestroy, PipeTransform {
|
|
|
* is valid for the Intl API.
|
|
* is valid for the Intl API.
|
|
|
*/
|
|
*/
|
|
|
protected getActiveLocale(localeOverride?: unknown): string {
|
|
protected getActiveLocale(localeOverride?: unknown): string {
|
|
|
- const locale = typeof localeOverride === 'string' ? localeOverride : this.locale ?? 'en';
|
|
|
|
|
|
|
+ const locale = typeof localeOverride === 'string' ? localeOverride : (this.locale ?? 'en');
|
|
|
const hyphenated = locale?.replace(/_/g, '-');
|
|
const hyphenated = locale?.replace(/_/g, '-');
|
|
|
|
|
|
|
|
// Check for a double-region string, containing 2 region codes like
|
|
// Check for a double-region string, containing 2 region codes like
|
|
@@ -46,7 +46,7 @@ export abstract class LocaleBasePipe implements OnDestroy, PipeTransform {
|
|
|
// and the first region discarded. This would only ever be an issue for
|
|
// and the first region discarded. This would only ever be an issue for
|
|
|
// those languages where the translation file itself encodes the region,
|
|
// those languages where the translation file itself encodes the region,
|
|
|
// as in pt_BR & pt_PT.
|
|
// as in pt_BR & pt_PT.
|
|
|
- const matches = hyphenated?.match(/^([a-zA-Z_-]+)(-[A-Z][A-Z])(-[A-Z][A-z])$/);
|
|
|
|
|
|
|
+ const matches = hyphenated?.match(/^([a-zA-Z_-]+)(-[A-Z][A-Z])(-[A-Z][A-Z])$/);
|
|
|
if (matches?.length) {
|
|
if (matches?.length) {
|
|
|
const overriddenLocale = matches[1] + matches[3];
|
|
const overriddenLocale = matches[1] + matches[3];
|
|
|
return overriddenLocale;
|
|
return overriddenLocale;
|