Commit 27eafcb2 authored by intrigeri's avatar intrigeri
Browse files

Clarify return value.

lang() can return e.g.:

 - fr: language = French, no territory nor script specified
 - fr_CA: language = French, territory = Canada
 - sr_Latn: language = Serbian, script = Latin
parent ab5f9164
...@@ -98,7 +98,8 @@ class PoFile: ...@@ -98,7 +98,8 @@ class PoFile:
} }
def lang(self) -> str: def lang(self) -> str:
"""@returns: language of filename""" """@returns: language of filename, possibly ending with an underscore
followed by the territory or script"""
name = os.path.basename(self.fname) name = os.path.basename(self.fname)
m = re.match(r"^(?:[^.].*\.)?(?P<lang>[A-Za-z_]+)\.po$", name) m = re.match(r"^(?:[^.].*\.)?(?P<lang>[A-Za-z_]+)\.po$", name)
if not m: if not m:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment