Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: General fixing and clean-up on translate() #1364

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

phorward
Copy link
Member

@phorward phorward commented Jan 9, 2025

This pull request summarizes several problems:

  1. Let all ViUR-core related translations have a viur.core-tr_key-prefix
  2. Make tr_key required
  3. Provide a way for conf.i18n.add_missing_translations to only add or ingore a specific pattern (fnmatch)
  4. Provide translation.dump() function for JSON-based retrieval of both public and private translations.

This pull request summarizes several problems:

1. Let all ViUR-core related translations have a `viur.core`-tr_key-prefix
2. Make `tr_key` required
3. Provide a way for `conf.i18n.add_missing_translations` to only add or ingore a specific pattern (fnmatch)
@phorward phorward added bug(fix) Something isn't working or address a specific issue or vulnerability annoying labels Jan 9, 2025
@phorward phorward added this to the ViUR-core v3.7 milestone Jan 9, 2025
Comment on lines +209 to +210
not self.key.startswith("core.")
and not self.key.startswith("viur.")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wip

Comment on lines 95 to 106
if self.languages:
prefix = self.translation_key_prefix
if callable(prefix):
prefix = prefix(self)

values = {
key: label if isinstance(label, translate) else translate(
f"{prefix}{label}", str(label),
f"value {key} for {self.name}<{type(self).__name__}> in {self.skel_cls.__name__} in {self.skel_cls}"
)
for key, label in values.items()
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wip

@@ -21,25 +21,29 @@ class TranslationSkel(Skeleton):
kindName = KINDNAME

tr_key = StringBone(
required=True,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

important!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
annoying bug(fix) Something isn't working or address a specific issue or vulnerability
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

1 participant