summaryrefslogtreecommitdiff
path: root/babel/core.py
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2023-03-01 08:25:31 +0200
committerAarni Koskela <akx@iki.fi>2023-03-01 09:37:27 +0200
commit3f3ae78c167a12c23ec4fa4681dd1d98bb3039e9 (patch)
treeb994f1995000630d65912355af12f7e019531880 /babel/core.py
parent56071c90116e6b9ebbb62ac072bcf032fc6987cb (diff)
downloadbabel-3f3ae78c167a12c23ec4fa4681dd1d98bb3039e9.tar.gz
Note that `Locale.parse()` does not accept `None`locale-parse-none
Refs #977
Diffstat (limited to 'babel/core.py')
-rw-r--r--babel/core.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/babel/core.py b/babel/core.py
index 6df5850..63fba0b 100644
--- a/babel/core.py
+++ b/babel/core.py
@@ -279,6 +279,15 @@ class Locale:
>>> Locale.parse(l)
Locale('de', territory='DE')
+ If the `identifier` parameter is neither of these, such as `None`
+ e.g. because a default locale identifier could not be determined,
+ a `TypeError` is raised:
+
+ >>> Locale.parse(None)
+ Traceback (most recent call last):
+ ...
+ TypeError: ...
+
This also can perform resolving of likely subtags which it does
by default. This is for instance useful to figure out the most
likely locale for a territory you can use ``'und'`` as the