Skip to content

Commit

Permalink
Merge branch '227-binary-i18n' into 'main'
Browse files Browse the repository at this point in the history
fix: bring i18n in the Canaille executable

Closes #227

See merge request yaal/canaille!226
  • Loading branch information
azmeuk committed Feb 4, 2025
2 parents 037bffa + 275b270 commit 9c4c4f4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Added
Fixed
^^^^^
- Fix SQL ``install`` command. :issue:`221`
- Canaille executable did not support i18n. :issue:`227`

[0.0.60] - 2025-02-03
---------------------
Expand Down
13 changes: 7 additions & 6 deletions canaille.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import importlib.resources
from canaille.app.i18n import available_language_codes
from canaille import create_app

with create_app({"SECRET_KEY": "foo"}).app_context():
codes = available_language_codes()
with create_app().app_context():
codes = {code.split("_")[0] for code in available_language_codes()}

with importlib.resources.path('wtforms', 'locale') as locale_path:
wtforms_locale = str(locale_path)
Expand All @@ -21,7 +21,7 @@ def filter_wtforms_catalogs(item):
if Path(dest).suffix != ".mo":
return False

code = dest.split("/")[2][:2]
code = dest.split("/")[2].split("_")[0]
return code in codes


Expand All @@ -30,7 +30,7 @@ def filter_babel_catalogs(item):
if not re.match(r"babel/locale-data/\w+\.dat", dest):
return True

code = Path(dest).stem[:2]
code = Path(dest).stem.split("_")[0]
return code in codes


Expand All @@ -39,7 +39,7 @@ def filter_pycountry_catalogs(item):
if not re.match(r"pycountry/locales/\w+/LC_MESSAGES/.+\.mo", dest):
return True

code = dest.split("/")[2][:2]
code = dest.split("/")[2].split("_")[0]
return code in codes


Expand All @@ -53,7 +53,7 @@ def filter_faker_providers(item):
if not re.match(r"faker/providers/\w+/\w+", dest):
return True

code = dest.split("/")[3][:2]
code = dest.split("/")[3].split("_")[0]
return code in codes

a = Analysis(
Expand All @@ -64,6 +64,7 @@ a = Analysis(
('canaille/backends/sql/migrations', 'canaille/backends/sql/migrations'),
('canaille/templates', 'canaille/templates'),
('canaille/static', 'canaille/static'),
('canaille/translations', 'canaille/translations'),
(wtforms_locale, 'wtforms/locale'),
],
hiddenimports=[
Expand Down
1 change: 0 additions & 1 deletion canaille/app/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
HAS_TOMLKIT = True
except ImportError:
HAS_TOMLKIT = False
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

DEFAULT_CONFIG_FILE = "canaille.toml"

Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9c4c4f4

Please sign in to comment.