kiwix / kiwix-android

Kiwix for Android
https://android.kiwix.org
GNU General Public License v3.0
861 stars 444 forks source link

Library language list should be retrieved dyanmically from libkiwix #2689

Open kelson42 opened 3 years ago

kelson42 commented 3 years ago

For the moment the list is hardcoded at the Kiwix-Android level. But since a few weeks @veloman-yunkan has implemented in libkiwix10 the primitive to get the list of languages for which we have contents. This is available both at the ABI level and in a form of a REST API end-point.

Therefore the Ladakhi is already (modulo https://github.com/kiwix/libkiwix/issues/611) listed in the list of languages of the library.

So far this is used only by Kiwix-Serve to populate its welcome page filters selecboxes, but the goal is that the Kiwix Andrid relies on it as well.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

rishujam commented 1 year ago

Didn't understand the goal. Do we want that while onBoarding user should select their language? Or is it related to language shown in the LibraryFrgament

kelson42 commented 1 year ago

Didn't understand the goal. Do we want that while onBoarding user should select their language? Or is it related to language shown in the LibraryFrgament

Title is clear IMO: "Library language list"

rishujam commented 1 year ago

What is the endpoint for this @kelson42

kelson42 commented 3 months ago

@MohitMaliFtechiz Please make a proposal how to approach the fix of this issue.

MohitMaliFtechiz commented 2 months ago

For the moment the list is hardcoded at the Kiwix-Android level. But since a few weeks @veloman-yunkan has implemented in libkiwix10 the primitive to get the list of languages for which we have contents. This is available both at the ABI level and in a form of a REST API end-point.

@kelson42 This ticket was created long time ago, probably that time we were using the hardcoded language list. But now we are using the Online library list to show to the user using the objectbox.

https://github.com/kiwix/kiwix-android/blob/8e08acea4ecd8cf8fbdd836ac6dd5fbd346a413c/app/src/main/java/org/kiwix/kiwixmobile/zimManager/ZimManageViewModel.kt#L297-L312

With the libkiwix, we have the Library and Manager objects that provide us the ability to read the books from .xml. The online library content is in .xml format so we can directly use libkiwix to show the languages of the online library. Since Library has the method to get the book's languages.

The hardcoded languages are used to show the Language list on the settings screen.

https://github.com/kiwix/kiwix-android/blob/8e08acea4ecd8cf8fbdd836ac6dd5fbd346a413c/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileUtils.kt#L256-L267