Skip to content

Commit 561da04

Browse files
committed
i18n: Don't fail if compiled translation files (.mo) don't exist
#363
1 parent 2667a7a commit 561da04

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88

9+
## [0.15.1] - 2020-10-21
10+
11+
### Fixed
12+
13+
- Don't fail if compiled translation files (.mo) don't exist
14+
915
## [0.15.0] - 2020-10-19
1016

1117
### Added

flattentool/i18n.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ def _(text):
2828

2929

3030
except ImportError:
31-
# If there's no Django, call gettext.translation without a languages array,
32-
# and it will pick one based on the environment variables.
33-
t = gettext.translation(domain, locale_dir)
34-
_ = t.gettext
31+
try:
32+
# If there's no Django, call gettext.translation without a languages array,
33+
# and it will pick one based on the environment variables.
34+
t = gettext.translation(domain, locale_dir)
35+
_ = t.gettext
36+
except FileNotFoundError:
37+
# If .mo files don't exist, pass a fake gettext function instead
38+
_ = lambda x: x

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def run(self):
3939

4040
setup(
4141
name="flattentool",
42-
version="0.15.0",
42+
version="0.15.1",
4343
author="Open Data Services",
4444
author_email="[email protected]",
4545
packages=["flattentool"],

0 commit comments

Comments
 (0)