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

feat: translations #662

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

Computerdores
Copy link
Collaborator

@Computerdores Computerdores commented Dec 23, 2024

Implements Translation using the translation files from weblate. Also modifies en.json when necessary.

For testing go to src/qt/translations.py and either:

  1. add Translations.change_language("<language of choice>") at the end of the file,
  2. or uncomment return "???" in __getitem__.

The first option should leave untranslated strings in Englisch while the second should replace every string that is effected by translations to ???.

Notes:

  • preview_panel.py isn't translated completely, mostly due to ongoing refactoring of that file in other places
    • reverting the changes to this file might be a good idea

Close #598.
Close #447.
Close #524.

@CyanVoxel CyanVoxel added Type: Enhancement New feature or request Type: Translation Translates or improves translation capabilities Priority: High An important issue requiring attention labels Dec 23, 2024
@CyanVoxel CyanVoxel added this to the Alpha v9.5 (Post-SQL) milestone Dec 23, 2024
@CyanVoxel
Copy link
Member

Just a note, I would avoid renaming the keys if possible or else I don't think Weblate will know how to propagate those changes automatically. In f4b30c1 I had to update the keys across all translation files simultaneously before updating on the Weblate side.

@Computerdores Computerdores marked this pull request as ready for review December 23, 2024 20:50
@Computerdores Computerdores added the Status: Review Needed A review of this is needed label Dec 23, 2024
@Computerdores
Copy link
Collaborator Author

This PR is now ready for review

tagstudio/resources/translations/en.json Outdated Show resolved Hide resolved
tagstudio/resources/translations/en.json Outdated Show resolved Hide resolved
Comment on lines 132 to 141
"menu.file": "&File",
"menu.help": "&Help",
"menu.macros.autofill": "Autofill",
"menu.macros.folders_to_tags": "Folders to Tags",
"menu.macros": "&Macros",
"menu.select": "Select",
"menu.tools": "Tools",
"menu.view": "View",
"menu.tools.fix_duplicate_files": "Fix Duplicate &Files",
"menu.tools.fix_unlinked_entries": "Fix &Unlinked Entries",
"menu.tools": "&Tools",
"menu.view": "&View",
Copy link
Member

Choose a reason for hiding this comment

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

I don't believe that alt (&) shortcuts for top-level menu items (File, View, etc.) will function, correct me if I'm wrong

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They work for me (for other languages you have to add the & obviously)

"status.library_save_success": "Library Saved and Closed!",
"status.library_search_query": "Searching Library for",
"status.results_found": "{results.total_count} Results Found",
"status.library_search_query": "Searching Library...",
Copy link
Member

Choose a reason for hiding this comment

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

Note: In v9.4 the "Searching Library for" would be followed by the search query in the status bar, though currently I don't see the status bar being updated with this at all, even when trying to artificially slow them down. I'm fine with this change, though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Searching Library... gets shown for me (if only for a very short time).

In v9.4 the "Searching Library for" would be followed by the search query in the status bar

This changed in the Search PR as with the new search that would just mean repeating the query that is already in the search bar

tagstudio/resources/translations/en.json Outdated Show resolved Hide resolved
"ignore_list.mode.exclude": "Exclude",
"ignore_list.mode.include": "Include",
"ignore_list.mode.label": "List Mode",
"ignore_list.mode.label": "List Mode:",
Copy link
Member

Choose a reason for hiding this comment

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

Do you think it would be better to keep the colon out of the base translation then add it after the fact for any labels that benefit from it? To me I feel this would allow us to be more flexible with UI changes without needing to update the translations for things like this, but I'd like to get your thoughts.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

depends on whether colons are universally used in all languages (which I kind of doubt), because if not there would be some value in leaving that to translators. Code wise it is cleaner to leave it to the translation strings, but that's not really important besides maybe being a tie breaker

tagstudio/src/qt/modals/build_tag.py Outdated Show resolved Hide resolved
tagstudio/src/qt/modals/file_extension.py Outdated Show resolved Hide resolved
tagstudio/src/qt/platform_strings.py Outdated Show resolved Hide resolved
tagstudio/src/qt/translations.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High An important issue requiring attention Status: Review Needed A review of this is needed Type: Enhancement New feature or request Type: Translation Translates or improves translation capabilities
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

[Feature Request]: [Translation] Always include variables in strings
2 participants