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>
This commit is contained in:
Edward Welbourne 2018-08-23 15:24:31 +02:00
parent 3d2832790a
commit 5ae2cbce2c

View File

@ -446,8 +446,10 @@ def integrateWeekData(filePath):
def splitLocale(name): def splitLocale(name):
"""Split name into (language, script, territory) triple as generator. """Split name into (language, script, territory) triple as generator.
Ignores any trailing fields, leaves script or territory empty if Ignores any trailing fields (with a warning), leaves script (a capitalised
unspecified, returns empty generator if no language found.""" 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('_')) tags = iter(name.split('_'))
yield tags.next() # Language yield tags.next() # Language
tag = tags.next() tag = tags.next()