summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliushuyu <liushuyu@aosc.io>2020-09-02 08:57:46 +0100
committerVincent Sanders <vince@kyllikki.org>2020-09-02 08:57:46 +0100
commitb0b8f2f875a020c0acc58a159549cea8ae047c39 (patch)
tree1b1ee5e56d3786a9779580b4e8c9392287a23fe0
parent1ea47f9caf702abac0d96795b2502e438086aeed (diff)
downloadnetsurf-b0b8f2f875a020c0acc58a159549cea8ae047c39.tar.gz
netsurf-b0b8f2f875a020c0acc58a159549cea8ae047c39.tar.bz2
utils: support xx_YY format language code
Signed-off-by: liushuyu <liushuyu@aosc.io>
-rw-r--r--tools/import-messages.pl6
-rw-r--r--tools/split-messages.pl4
2 files changed, 5 insertions, 5 deletions
diff --git a/tools/import-messages.pl b/tools/import-messages.pl
index 4c13a859e..fe23842aa 100644
--- a/tools/import-messages.pl
+++ b/tools/import-messages.pl
@@ -81,7 +81,7 @@ sub main ()
}
# double check the options are sane (and we weren't asked for the help)
- if( !$opt_ok || $opt{help} || $opt{lang} !~ /^[a-z]{2}$/ )
+ if( !$opt_ok || $opt{help} || $opt{lang} !~ /^[a-z]{2}(?:_[A-Z]{2})?$/ )
{
usage();
}
@@ -97,7 +97,7 @@ sub main ()
my( $lang, $plat, $key );
- if( /^([a-z]{2})\.([^.]+)\.([^:]+):/ )
+ if( /(^[a-z]{2}(?:_[A-Z]{2})?)\.([^.]+)\.([^:]+):/ )
{
( $lang, $plat, $key ) = ( $1, $2, $3 );
}
@@ -246,7 +246,7 @@ sub parser ()
while ( <$stream> )
{
- if( /^([a-z]{2})\.([^.]+)\.([^:]+):(.*)/ )
+ if( /(^[a-z]{2}(?:_[A-Z]{2})?)\.([^.]+)\.([^:]+):(.*)/ )
{
my( $lang, $plat, $key, $val ) = ( $1, $2, $3, $4 );
diff --git a/tools/split-messages.pl b/tools/split-messages.pl
index 0504b24c1..1c78fd271 100644
--- a/tools/split-messages.pl
+++ b/tools/split-messages.pl
@@ -85,7 +85,7 @@ sub main ()
}
# double check the options are sane (and we weren't asked for the help)
- if( !$opt_ok || $opt{help} || $opt{lang} !~ /^[a-z]{2}$/ || $opt{dlang} !~ /^[a-z]{2}$/ )
+ if( !$opt_ok || $opt{help} || $opt{lang} !~ /^[a-z]{2}(?:_[A-Z]{2})?$/ || $opt{dlang} !~ /^[a-z]{2}(?:_[A-Z]{2})?$/ )
{
usage();
}
@@ -109,7 +109,7 @@ sub main ()
/^\s*$/ && next;
# only parsing things that look like message lines:
- if( /^([a-z]{2}).([^.]+).([^:]+):(.*)/ )
+ if( /^([a-z]{2}(?:_[A-Z]{2})?).([^.]+).([^:]+):(.*)/ )
{
my( $lang, $plat, $key, $val ) = ( $1, $2, $3, $4 );