##---------------------------------------------------------------------------- ## Unicode Locale Identifier - ~/lib/Locale/Unicode.pm ## Version v0.3.11 ## Copyright(c) 2025 DEGUEST Pte. Ltd. ## Author: Jacques Deguest ## Created 2024/05/11 ## Modified 2025/01/05 ## All rights reserved ## ## ## This program is free software; you can redistribute it and/or modify it ## under the same terms as Perl itself. ##---------------------------------------------------------------------------- package Locale::Unicode; BEGIN { use v5.10.1; use strict; use warnings; use warnings::register; use vars qw( $ERROR $VERSION $DEBUG $FATAL_EXCEPTIONS $LOCALE_BCP47_RE $LOCALE_BCP47_NAMELESS_RE $LOCALE_RE $LOCALE_UNICODE_SUBTAG_RE $LOCALE_EXTENSIONS_RE $LOCALE_TRANSFORM_PARAMETERS_RE $GRANDFATHERED_IRREGULAR $GRANDFATHERED_REGULAR $TZ_DICT $TZ_NAME2ID $PROP_TO_SUB $EXPLICIT_BOOLEAN ); use overload ( '""' => 'as_string', bool => sub{1}, fallback => 1, ); use Scalar::Util (); use Want; # ""root" is treated as a special unicode_language_subtag" # # NOTE: $LOCALE_BCP47_RE our $LOCALE_BCP47_RE = qr/ (?: (?: # "root" is treated as a special Unicode language subtag in the LDML and required in the valid pattern (?root) | (?[a-z]{2}) | (?[a-z]{3}) ) # "Up to three optional extended language subtags composed of three letters each, separated by hyphens" # "There is currently no extended language subtag registered in the Language Subtag Registry without an equivalent and preferred primary language subtag" (?: \- (? [a-z]{3} (?:\-[a-z]{3}){0,2} ) )? ) # ISO 15924 for scripts (?: - (?: (?