Back to Anki

I18n

.cursor/rules/i18n.md

25.09.2767 B
Original Source
  • We use the fluent system+code generation for translation.
  • New strings should be added to rslib/core/. Ask for the appropriate file if you're not sure.
  • Assuming a string addons-you-have-count has been added to addons.ftl, that string is accessible in our different languages as follows:
    • Python: from aqt.utils import tr; msg = tr.addons_you_have_count(count=3)
    • TypeScript: import * as tr from "@generated/ftl"; tr.addonsYouHaveCount({count: 3})
    • Rust: collection.tr.addons_you_have_count(3)
  • In Qt .ui files, strings that are marked as translatable will automatically use the registered ftl strings. So a QLabel with a title 'addons_you_have_count' that is marked as translatable will automatically use the translation defined in our addons.ftl file.