Skip to content

Fix LangStringSet._check_language_tag_constraints after the spec has been clarified #157

@zrgt

Description

@zrgt

After the spec regarding language tags is clarified(admin-shell-io/aas-specs-metamodel#293), we need to adapt the method LangStringSet._check_language_tag_constraints

Currently we demand that language tags:

  • can only have one or zero extensions
  • the only possible extension is region

Relevant codesnippet:
https://github.com/eclipse-basyx/basyx-python-sdk/blob/5eb895e1e64cdcd4ba98464d5fda4176292cf942/basyx/aas/model/base.py#L289C1-L296C56

    @classmethod
    def _check_language_tag_constraints(cls, ltag: str):
        split = ltag.split("-", 1)
        if len(split[0]) != 2 or not split[0].isalpha() or not split[0].islower():
            raise ValueError(f"The language code '{split[0]}' of the language tag '{ltag}' doesn't consist of exactly "
                             "two lower-case letters!")
        if len(split) > 1 and (len(split[1]) != 2 or not split[1].isalpha() or not split[1].isupper()):
            raise ValueError(f"The extension '{split[1]}' of the language tag '{ltag}' doesn't consist of exactly "
                             "two upper-case letters!")

Metadata

Metadata

Assignees

No one assigned

    Labels

    SpecificationAn issue with the specification rather than our implementationsdkSomething to do with the `sdk` package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions