From 5ae2cbce2c4d5f319f1ddf1895d0f43f1c6ceafe Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 23 Aug 2018 15:24:31 +0200 Subject: Correct and expand documentation of splitLocale() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- util/local_database/cldr2qlocalexml.py | 6 ++++-- 1 file 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() -- cgit v1.2.3