summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2018-08-23 15:24:31 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2018-09-10 09:03:36 +0000
commit5ae2cbce2c4d5f319f1ddf1895d0f43f1c6ceafe (patch)
tree7ebf8e62f3418c9379db9368b80fc702729df08a
parent3d2832790a478f915db8b0b75bb752bbe51e4d29 (diff)
Correct and expand documentation of splitLocale()
This amends c1141ed729b84f2c413975d37c1a91fb235fb14a; I failed to update the doc-string after some design changes part-way through developing the function. Change-Id: Ifb83107153d1c3b5a9dbd0536a3d6ee1fe32922d Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
-rwxr-xr-xutil/local_database/cldr2qlocalexml.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/util/local_database/cldr2qlocalexml.py b/util/local_database/cldr2qlocalexml.py
index 6829dbd34b..bc999e1b65 100755
--- a/util/local_database/cldr2qlocalexml.py
+++ b/util/local_database/cldr2qlocalexml.py
@@ -446,8 +446,10 @@ def integrateWeekData(filePath):
def splitLocale(name):
"""Split name into (language, script, territory) triple as generator.
- Ignores any trailing fields, leaves script or territory empty if
- unspecified, returns empty generator if no language found."""
+ Ignores any trailing fields (with a warning), leaves script (a capitalised
+ four-letter token) or territory (either a number or an all-uppercase token)
+ empty if unspecified, returns a single-entry generator if name is a single
+ tag (i.e. contains no underscores). Always yields 1 or 3 values, never 2."""
tags = iter(name.split('_'))
yield tags.next() # Language
tag = tags.next()