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

Categories should not be translated in Kiwix-Desktop #972

Closed
kelson42 opened this issue Aug 3, 2023 · 19 comments · Fixed by #1175
Closed

Categories should not be translated in Kiwix-Desktop #972

kelson42 opened this issue Aug 3, 2023 · 19 comments · Fixed by #1175
Assignees
Milestone

Comments

@kelson42
Copy link
Collaborator

kelson42 commented Aug 3, 2023

We have currently a lot of categories translation in the source code:

$ grep -ri wikivoyage .
grep: ./kiwix-desktop: binary file matches
./resources/i18n/ko.json:	"wikivoyage": "위키여행",
./resources/i18n/sk.json:	"wikivoyage": "Wikicesty",
./resources/i18n/sq.json:	"wikivoyage": "Wikivoyage",
./resources/i18n/ta.json:	"wikivoyage": "விக்கிப்பயணம்",
./resources/i18n/eo.json:	"wikivoyage": "Vikivojaĝo",
./resources/i18n/scn.json:	"wikivoyage": "Wikivoyage",
./resources/i18n/fa.json:	"wikivoyage": "ویکی‌سفر",
./resources/i18n/tr.json:	"wikivoyage": "Vikigezgin",
./resources/i18n/ro.json:	"wikivoyage": "Wikivoyage",
./resources/i18n/sro.json:	"wikivoyage": "Wikivoyage",
./resources/i18n/pt-br.json:	"wikivoyage": "Wikivoyage",
./resources/i18n/lb.json:	"wikivoyage": "Wikivoyage",
./resources/i18n/sr-ec.json:	"wikivoyage": "Википутовања",
./resources/i18n/ca.json:	"wikivoyage": "Viquiviatges",
./resources/i18n/sdc.json:	"wikivoyage": "Vichiviàggiu",
./resources/i18n/fi.json:	"wikivoyage": "Wikimatkat",
./resources/i18n/es.json:	"wikivoyage": "Wikiviajes",
./resources/i18n/sc.json:	"wikivoyage": "Wikivoyage",
./resources/i18n/ja.json:	"wikivoyage": "ウィキボヤージュ",
./resources/i18n/de.json:	"wikivoyage": "Wikivoyage",
./resources/i18n/da.json:	"wikivoyage": "Wikivoyage",
./resources/i18n/mk.json:	"wikivoyage": "Википатување",
./resources/i18n/zgh.json:	"wikivoyage": "ⵡⵉⴽⵉⵎⵓⴷⴷⵓ",
./resources/i18n/qqq.json:	"wikivoyage": "{{Identical|Wikivoyage}}",
./resources/i18n/zh-hans.json:	"wikivoyage": "维基导游",
./resources/i18n/diq.json:	"wikivoyage": "Wikigeyroğ",
./resources/i18n/sl.json:	"wikivoyage": "Wikipotovanje",
./resources/i18n/he.json:	"wikivoyage": "ויקימסע",
./resources/i18n/en.json:    "wikivoyage":"Wikivoyage",
./resources/i18n/hy.json:	"wikivoyage": "Վիքիճամփորդ",
./resources/i18n/my.json:	"wikivoyage": "ဝီကီခရီးသွား",
./resources/i18n/bn.json:	"wikivoyage": "উইকিভ্রমণ",
./resources/i18n/sv.json:	"wikivoyage": "Wikivoyage",
./resources/i18n/sms.json:	"wikivoyage": "Wikimääʹtǩ",
./resources/i18n/ku-latn.json:	"wikivoyage": "Wîkîger",
./resources/i18n/ms.json:	"wikivoyage": "Wikikembara",
./resources/i18n/ru.json:	"wikivoyage": "Викигид",
./resources/i18n/io.json:	"wikivoyage": "Wikivoyajo",
./resources/i18n/uk.json:	"wikivoyage": "Вікімандри",
./resources/i18n/th.json:	"wikivoyage": "วิกิท่องเที่ยว",
./resources/i18n/it.json:	"wikivoyage": "Wikivoyage",
./resources/i18n/ar.json:	"wikivoyage": "ويكي الرحلات",
./resources/i18n/nqo.json:	"wikivoyage": "ߥߞߌߕߊ߯ߡߊߘߐߕߊ߮",
./resources/i18n/skr-arab.json:	"wikivoyage": "وکی سیرسپاٹا",
./resources/i18n/pl.json:	"wikivoyage": "Wikipodróże",
./resources/i18n/zh-hant.json:	"wikivoyage": "維基導遊",
./resources/i18n/br.json:	"wikivoyage": "Wikibeaj",
./resources/i18n/fr.json:	"wikivoyage": "Wikivoyage",
./resources/i18n/cs.json:	"wikivoyage": "Wikicesty",
./resources/i18n/nb.json:	"wikivoyage": "Wikivoyage",

Translations should be done in libkiwix and made available via the kiwix-serve/https://library.kiwix.org.

Depends on kiwix/libkiwix#844

@kelson42
Copy link
Collaborator Author

kelson42 commented Aug 3, 2023

@juuz0 How does it work currently if there is not Internet? There is a default list somewhere hardcoded in the list or does the category list is dynamically built from the local library?

@juuz0
Copy link
Collaborator

juuz0 commented Aug 4, 2023

does the category list is dynamically built from the local library?

This. libkiwix returning the translation should work well

@kelson42
Copy link
Collaborator Author

kelson42 commented Aug 4, 2023

@juuz0 so we could remove them from kiwix-desktop? If I understand right, all the category stuff is not data-driven, and therefore kiwix-desktop retrieves the values directly from the libkiwix without any API call?

@mgautierfr
Copy link
Member

How does it work currently if there is not Internet?

That is a really good question.
We must be sure that translations are coming from libkiwx (we have in local) and not from opds stream.

But yes, now translations should be moved from kiwix-desktop to libkiwix.

@kelson42
Copy link
Collaborator Author

@ShaopengLin You (should) have the primitive alrady in the libkiwix to do that. Please just use them.

@kelson42 kelson42 modified the milestones: 2.5.0, 2.4.0 Jul 19, 2024
@ShaopengLin
Copy link
Collaborator

@kelson42 I am unable to find any primitives. The getBooksCategories already get from libkiwix and they are all still using the i18n key string we have. The only thing I saw in libkiwix is in server/i18n.h (which I don't think is exportable), but the i18n translations of these i18n key strings are also not in libkiwix's static/skin/i18n. Please correct me if I am missing something obvious.

@kelson42
Copy link
Collaborator Author

@ShaopengLin Hmmm, I might be wrong then... because I just remarked that kiwix-serve categories are not translated either! Documentation is not helpful either.

@mgautierfr @veloman-yunkan Could you please guide @ShaopengLin so he can implement this issue properly? It seems that something might have to be done at libkiwix level!

@veloman-yunkan
Copy link
Collaborator

@mgautierfr @veloman-yunkan Could you please guide @ShaopengLin so he can implement this issue properly? It seems that something might have to be done at libkiwix level!

libkiwix has all the required infrastructure (in src/server/i18n.{h,cpp}) however it is not part of its public API so we just need to expose it.

@kelson42
Copy link
Collaborator Author

@veloman-yunkan Thank you, should obviously not be related to the server, so not the proper ultimate code location.

@veloman-yunkan
Copy link
Collaborator

@kelson42 Absolutely. We will move the implementation as part of kiwix/libkiwix#1103.

@kelson42
Copy link
Collaborator Author

@veloman-yunkan Thx!
@ShaopengLin Please adapt libkiwix first, then kiwix desktop

@kelson42
Copy link
Collaborator Author

@ShaopengLin All clear on your side for implementation?

@ShaopengLin
Copy link
Collaborator

ShaopengLin commented Jul 27, 2024

With the slugify PR I think I am comfortable with the libkiwix structure. Can probably have a PR on libkiwix to add the i18n translation for categories and expose the API.

For Desktop If I am not mistaken, just need to replace the gt() calls with the exposed API.

@kelson42
Copy link
Collaborator Author

@ShaopengLin The whole retrieval of categories should come from the libkiwix, not only the translation.

@ShaopengLin
Copy link
Collaborator

ShaopengLin commented Jul 28, 2024

That makes sense, I will adapt the filtering with the translations.

@kelson42 Just to make sure I do not make any more misconceptions: From the previous discussion, I assume all the categories need to be supported by libkiwix and OPDS retrieval of categories should be removed.

@veloman-yunkan Does the filtering adapt with i18n, i.e. if I use the translated categories in the filters, would the local and remote filter adapt? I am not sure if I fully understand the filtering behavior so I think it is best to ask.

@kelson42
Copy link
Collaborator Author

OPDS retrieval should not be removed, but this retrieval works only online. It should also properly work offline.

@ShaopengLin
Copy link
Collaborator

Ok so I believe we actually are implementing two separate things:

  1. retrieve categories from libkiwix.
  2. The translation should use libkiwix translation functions.

Previously I got the idea that we are combining the changes into one, which is we only retrieve the translated categories. This should be a quick change in libkiwix then.

@ShaopengLin
Copy link
Collaborator

ShaopengLin commented Aug 3, 2024

Also in desktop we also don't seem to be doing translations either... I already have the change ready and after libkiwix goes through my change in this one will soon.

@kelson42
Copy link
Collaborator Author

@ShaopengLin Can you please push your code now that kiwix/libkiwix#1112 is merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: DONE
Development

Successfully merging a pull request may close this issue.

5 participants