Skip to content

Commit da7a24f

Browse files
committed
sdk: correct langtag check to follow RFC 5646
The langtag check of ITEF BCP 47 format from the aas-core project was not following the RFC 5646 precisely in two minor important points. These deviations are now corrected, so the check strictly follows the syntax described in the standard.
1 parent 76df133 commit da7a24f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

sdk/basyx/aas/model/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def _check_language_tag_constraints(cls, ltag: str):
304304
alphanum = "[a-zA-Z0-9]"
305305
singleton = "[0-9A-WY-Za-wy-z]"
306306
extension = f"{singleton}(-({alphanum}){{2,8}})+"
307-
extlang = "[a-zA-Z]{3}(-[a-zA-Z]{3}){2}"
307+
extlang = "[a-zA-Z]{3}(-[a-zA-Z]{3}){0,2}"
308308
irregular = (
309309
"(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|"
310310
"i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|"
@@ -319,7 +319,7 @@ def _check_language_tag_constraints(cls, ltag: str):
319319
script = "[a-zA-Z]{4}"
320320
region = "([a-zA-Z]{2}|[0-9]{3})"
321321
variant = f"(({alphanum}){{5,8}}|[0-9]({alphanum}){{3}})"
322-
privateuse = f"[xX](-({alphanum}){{1,8}})+"
322+
privateuse = f"[x](-({alphanum}){{1,8}})+"
323323
langtag = (
324324
f"{language}(-{script})?(-{region})?(-{variant})*(-{extension})*(-"
325325
f"{privateuse})?"

0 commit comments

Comments
 (0)