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

Implemented Category Translation #1175

Merged
merged 5 commits into from
Aug 30, 2024
Merged

Conversation

ShaopengLin
Copy link
Collaborator

Fix #972

Changes:

  • Displays the translated category names.
  • Keeps the category keys untranslated for filtering and Remote Library querying.
  • Removes unnecessary translations.

src/contentmanagerside.cpp Outdated Show resolved Hide resolved
src/contentmanagerside.cpp Outdated Show resolved Hide resolved
@kelson42
Copy link
Collaborator

@ShaopengLin I have relaunched the CI, but in case id dies again: CI should be green?

@ShaopengLin
Copy link
Collaborator Author

ShaopengLin commented Aug 19, 2024

@kelson42 Yes it should. The failed CI doesn't seem to be up to date with the new i18n.h changes? I will check if its the problem with including paths of my own code.

@kelson42 kelson42 force-pushed the Issue#972-translate-categories branch from 089b555 to c51f4b7 Compare August 19, 2024 05:26
@kelson42
Copy link
Collaborator

@ShaopengLin Strongly suspect that i18n.h is simply not distributed in libkiwix tarball.

@kelson42
Copy link
Collaborator

kelson42 commented Aug 19, 2024

@ShaopengLin I'm a bit puzzled, for the online library, the list of categories is not retrieved from https://kiwix-tools.readthedocs.io/en/latest/kiwix-serve.html#catalog-v2-categories ? Or do we retrieve from library.kiwix.org but we translated locally? How does that work exactly for both local and remote catalogue?

At this stage it seems we have "forgotten" to implement kiwix/libkiwix#844 and we kind of workaround the problem of lack of proper API?!

@ShaopengLin
Copy link
Collaborator Author

ShaopengLin commented Aug 19, 2024

@kelson42 I believe its from library.kiwix.org. The recieved categories doesn't seem to be translated as the API doesn't take translated categories as query parameters.

We are translating the recieved categpries manually.

Copy link
Collaborator

@kelson42 kelson42 left a comment

Choose a reason for hiding this comment

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

@ShaopengLin Root cause of the broken CI is broken PR in kiwix-build. @mgautierfr Please fix ASAP

For the rest the situation is clear now:

  • For local library, we anyway only display the list of categories based on available ZIM in the local library. These ones are now translated via libkiwix (instead of directly in kiwix-desktop)
  • For remote library, we download (said @ShaopengLin) the list of categories and we translate locally via libkiwix. @ShaopengLin Hopefully this piece of code can handle the fact that it can mismatch (not exactly the same list), in that case the concerned category should be displayed in English.

So this PR is really only about deporting the category translation from kiwix-desktop to libkiwix. Once kiwix/libkiwix#844 implemented, we should stop to do that for remote library. I have open an issue requesting this #1181

Otherwise LGTM, ready for code review

@mgautierfr
Copy link
Member

@mgautierfr Please fix ASAP

This is fixed

@kelson42 kelson42 force-pushed the Issue#972-translate-categories branch from c51f4b7 to 9c0ad5a Compare August 19, 2024 11:08
@kelson42
Copy link
Collaborator

@ShaopengLin Can you please rebase and fix conflict?
@veloman-yunkan Can you please do the code review?

@ShaopengLin ShaopengLin force-pushed the Issue#972-translate-categories branch from 9c0ad5a to 674c15d Compare August 21, 2024 19:03
src/settingsmanager.cpp Outdated Show resolved Hide resolved
src/contentmanagerside.cpp Outdated Show resolved Hide resolved
@kelson42
Copy link
Collaborator

@veloman-yunkan Are we finally ready to merge?

@ShaopengLin ShaopengLin force-pushed the Issue#972-translate-categories branch 2 times, most recently from a900048 to 6e95e7e Compare August 24, 2024 09:31
@ShaopengLin
Copy link
Collaborator Author

@veloman-yunkan @kelson42 I added changes that address #1185. From my testing, when the user upgrades, they will see the categories from old session files as simply the untranslated state. Once they de-select those and restart the application, those choices will be gone.

src/contentmanagerside.cpp Outdated Show resolved Hide resolved
src/contentmanagerside.cpp Outdated Show resolved Hide resolved
@ShaopengLin ShaopengLin force-pushed the Issue#972-translate-categories branch from 6e95e7e to 996031d Compare August 29, 2024 13:59
@ShaopengLin
Copy link
Collaborator Author

Different from last time, this will be what the user sees when they upgrade. Not a big deal. Screenshot from 2024-08-29 10-05-13

Copy link
Collaborator

@veloman-yunkan veloman-yunkan left a comment

Choose a reason for hiding this comment

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

LGTM. Note however that I didn't test the changes.

setSelection parses two SelectionList differently
Public interfaces uses this typedef.
Storing filter pairs is redundant.
Translations come from libkiwix
@kelson42 kelson42 force-pushed the Issue#972-translate-categories branch from 996031d to 5f1feeb Compare August 30, 2024 11:32
@kelson42
Copy link
Collaborator

@ShaopengLin Would that be easy to just remove the filter in such situation, so user starts again on a fresh foot?

@ShaopengLin
Copy link
Collaborator Author

@kelson42 we can do that, though it will involve back porting code that ran only once. @veloman-yunkan what do you think?

@kelson42
Copy link
Collaborator

kelson42 commented Aug 30, 2024

@ShaopengLin Let me merge this and I will test it first. This PR is too old already...

@kelson42 kelson42 merged commit 1eb926c into main Aug 30, 2024
5 checks passed
@kelson42 kelson42 deleted the Issue#972-translate-categories branch August 30, 2024 11:47
@veloman-yunkan
Copy link
Collaborator

@kelson42 we can do that, though it will involve back porting code that ran only once. @veloman-yunkan what do you think?

I don't think I correctly understand what you mean. After reading the category filter list from saved settings, we can simply drop entries containing the | symbol.

@ShaopengLin
Copy link
Collaborator Author

ShaopengLin commented Aug 30, 2024

I was asking if we should do this porting as it will only be ran once. I can do a quick PR to do this then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Categories should not be translated in Kiwix-Desktop
4 participants