fix(auth): garder l identite Discord du cote verifie
This commit is contained in:
@@ -202,6 +202,67 @@ class TestCatalogueIntegrity:
|
||||
f'{len(untranslated)} untranslated string(s) in {locale}: {untranslated[:5]}'
|
||||
)
|
||||
|
||||
# Babel keeps its guessed translation when it marks an entry fuzzy,
|
||||
# but gettext deliberately ignores that guess at runtime. Merely
|
||||
# checking m.string therefore let five English fallbacks through after
|
||||
# the branding merge, including a dangerously wrong French label.
|
||||
fuzzy = [m.id for m in catalog if m.id and 'fuzzy' in m.flags]
|
||||
assert not fuzzy, f'{len(fuzzy)} fuzzy string(s) in {locale}: {fuzzy[:5]}'
|
||||
|
||||
def test_the_catalogue_contains_every_message_in_the_source(self, tmp_path):
|
||||
"""A translated PO can still be stale.
|
||||
|
||||
The previous guard only inspected entries already in the catalogue.
|
||||
A new `_()` in Python or Jinja therefore stayed English without any
|
||||
failure until somebody happened to run extraction by hand.
|
||||
"""
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from babel.messages.pofile import read_po
|
||||
|
||||
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
extracted_path = tmp_path / 'messages.pot'
|
||||
subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
'-m',
|
||||
'babel.messages.frontend',
|
||||
'extract',
|
||||
'-F',
|
||||
'babel.cfg',
|
||||
'-k',
|
||||
'_l',
|
||||
'-o',
|
||||
str(extracted_path),
|
||||
'.',
|
||||
],
|
||||
cwd=root,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
with open(extracted_path, encoding='utf-8') as handle:
|
||||
source_ids = {message.id for message in read_po(handle) if message.id}
|
||||
|
||||
for locale in SUPPORTED_LOCALES:
|
||||
path = os.path.join(
|
||||
root,
|
||||
'app',
|
||||
'translations',
|
||||
locale,
|
||||
'LC_MESSAGES',
|
||||
'messages.po',
|
||||
)
|
||||
with open(path, encoding='utf-8') as handle:
|
||||
catalogue_ids = {message.id for message in read_po(handle) if message.id}
|
||||
missing = source_ids - catalogue_ids
|
||||
assert not missing, (
|
||||
f'{len(missing)} source string(s) absent from {locale}: '
|
||||
f'{sorted(missing, key=str)[:5]}'
|
||||
)
|
||||
|
||||
|
||||
class TestSelectorUnit:
|
||||
def test_select_locale_returns_a_supported_code(self, app):
|
||||
|
||||
Reference in New Issue
Block a user