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

chinese translation #14

Closed
evoke322 opened this issue May 18, 2023 · 23 comments
Closed

chinese translation #14

evoke322 opened this issue May 18, 2023 · 23 comments
Assignees
Labels
enhancement New feature or request

Comments

@evoke322
Copy link

Douban.com (Chinese: 豆瓣, wiki )is a Chinese online database and social networking service that allows users to record information and create content related to film, books, music, recent events, and activities in Chinese cities.

New the NTMB can't support Chinese books very well, could you consider supporting it.

@tfonteyn
Copy link
Owner

tfonteyn commented May 18, 2023

I would love to support Chinese books. But as I am not able to read Chinese it is incredibly difficult for me to do so.

There would be two parts to supporting Chinese:

I would need someone to:

This can be done by any Chinese speaker without any android/java development knowledge.

The tricky part would be to create (what I call) a "SearchEngine" class to fetch information of Chinese books.
Here you would need Java knowledge, and the ability to analyse websites (the html document model).

The "SearchEngine" class is a Java interface. I currently use two techniques:

  • if the website has some sort of API, a "SearchEngine" can directly access it. If the API returns JSON results, then it should be fairly easy to copy/adapt from an existing engine.
  • if not, then I have a base implementation which uses JSoup to scrape websites. Here I would be quite lost without actually knowing Chinese I'm afraid.

The interface: SearchEngine.java
In the same package, there are sub-packages for the currently supported sites.

I would certainly be trying to help in any way I can.

@tfonteyn tfonteyn self-assigned this May 18, 2023
@tfonteyn tfonteyn added the enhancement New feature or request label May 18, 2023
@evoke322
Copy link
Author

I would love to help, but I have no knowledge of android/java development. emm I think I can translate this app.

@tfonteyn
Copy link
Owner

even just a translation would certainly be welcome. If you have any questions, please ask.

I can provide custom/interim builds for you to test as well.

@tfonteyn tfonteyn changed the title please support douban.com chinese translation Jun 26, 2023
@tfonteyn tfonteyn assigned evoke322 and unassigned tfonteyn Mar 22, 2024
@tfonteyn tfonteyn added the help wanted Extra attention is needed label Apr 14, 2024
@CloneWith
Copy link
Contributor

CloneWith commented Apr 15, 2024

Hi tfonteyn,

I would like to help translate this application into Chinese too.
Since I don't have much spare time this would be a bit slow to complete, but I will try to do my best.

The native support for Chinese books seems OK. As of the support for Douban, I could help later this year (around July)

@tfonteyn
Copy link
Owner

that would be great 👍

Releases do not contain any Chinese text for now, but please let me know and I can do custom builds at any time if you want to test them.

Douban

Wonderful - I'll provide any help I can of course. Let me know when you start on this, and I'll provide a full intro on what code will be needed.

@CloneWith
Copy link
Contributor

Hi tfonteyn,
The translation for Chinese is almost complete. Would you like to include it in the application (so I can view the changes)? Thanks!

@tfonteyn
Copy link
Owner

wow - that was really fast !

I'll pull it all in, enabled it and do a basic test. I'll create a beta and upload an APK a bit later today.

@tfonteyn
Copy link
Owner

Here you go: 5.5.2 / 5.6.0-beta1

The app will identify itself as 5.2.2. Once we're both happy with it, I'll release it as 5.6.

Can you please take a look at these 4 keys:

ps_sort_author_name_given_first
ps_sort_author_name_family_first
ps_show_author_name_given_first
ps_show_author_name_family_first

They contain the author name "Connie Willis" as an example on how author names can be sorted and displayed.

i.e. "firstname familyname" or "familyname, firstname"

Can you please substitute that name with your own favourite native Chinese author?
It should preferable be an author which is widely known. These names should of course be in the Chinese language itself.

As an example:
Liu Cixin -> "Liu Cixin" and "Cixin, Liu" ... but I have no idea on "刘慈欣" would fit this format?

In the future I might need to enhance the code to explicitly support this as I suppose this might become important if you decide to go ahead with the Douban (or similar) site.

@CloneWith
Copy link
Contributor

CloneWith commented Apr 15, 2024

As an example:
Liu Cixin -> "Liu Cixin" and "Cixin, Liu" ... but I have no idea on "刘慈欣" would fit this format?

Yep this is a famous author, I think users will be quite familiar with it.

But for Chinese names that's a little complicated:

For 刘慈欣: 刘 is family name and 慈欣 is given name.
And if we use given name to sort, it seems like 慈欣 刘 (we prefer to use spaces to split them, but it is odd in Chinese context. We rarely use it.)

For this we prefer using 刘 慈欣.

There is a concept compound surname in Chinese (复姓, use machine translation, did I use it right?). Like 欧阳修, in which 欧阳 the whole is family name, so 修 欧阳 in this case?

I didn't spend too much time looking through the source code and thus didn't know how such names are handled. Given such complex names above, it's impossible to simply split strings. Chances are that users have to manually type the family name and given name separately.

@CloneWith
Copy link
Contributor

CloneWith commented Apr 15, 2024

Another issue I have noticed is that those authors whose names are in Chinese weren't sorted properly. We may need an extra module to do that.

@CloneWith
Copy link
Contributor

CloneWith commented Apr 15, 2024

I have fixed some minor strings, and the application seems nice in Chinese.

One problem resolved

@tfonteyn
Copy link
Owner

tfonteyn commented Apr 15, 2024

Simplified Chinese (简体中文), while there is Traditional Chinese (繁体中文)

I realized this myself after I enabled Chinese and have already fixed this by generating that list from code using the Locale's. See commit

Android uses "Chinese (China)" for "zh_CN" (versus zh_TW). I'll tackle any issues with Singapore and Taiwan when an actual user who wants them shows up :-)

Given such complex names above, it's impossible to simply split strings

I was afraid that this would be the case. I'll use Liu Cixin (western spelling) as the example for now as this is how it's used on Amazon and other supported sites for now anyhow.

names are in Chinese weren't sorted properly.

I think you can solve this by going into the app main settings , select "Style / Edit default settings" and then scroll down to "Author": formatting and sorting switches.
If you already created personal styles (by copying one of the builtin styles) you will need to update those as well.
Please let me know if this solves the sorting as expected.

We may need an extra module to do that.

I agree; I might need to provide a setting for (generally speaking) languages where the Author names are not what is currently expected.

how such names are handled

It's complex... take a look at Author#from

ok - next steps:

  • I'll pull in your latest updates
  • I'll use "Liu Cixin" and "Cixin, Liu" for now.
  • release 5.5.3 for you to check the updates.

Future steps:

  • finally read The Three-Body Problem; I've had it on my shelf for some time.
  • check on how parsing Author names can be improved.

@CloneWith
Copy link
Contributor

I think you can solve this by going into the app main settings , select "Style / Edit default settings" and then scroll down to "Author": formatting and sorting switches.

Uh nope, I also tried manually separate the two parts of names and it didn't work as expected. This should be resolved by the "extra module" 🤔

@tfonteyn
Copy link
Owner

And here is the new build 5.5.3 / 5.6.0-beta2

I also tried manually separate

ok, then I'll need to look into the details. Can you please:

  • create 4 books using Chinese for Author and Title; just add them "Manually" if you want.
  • Make sure to use 3 distinct Authors and 4 distinct titles (no need for any other data obviously)
  • In other words: 2 unique Authors with one book each + 2 books by the same unique 3rd Author.
  • go to the side menu and choose "Backup & Export"
  • In the drop-down, select "Database file" and export it.
  • upload the resulting file.
  • Post here what the order of the books should be when sorted by Author first, Title second.

@CloneWith
Copy link
Contributor

CloneWith commented Apr 16, 2024

Since comments don't support uploading this file, I've uploaded it as ntmb-zh.zip

Proper list:

  • 老舍: 茶馆 (lǎo)
  • 刘 慈欣: 三体 (liú)
  • 鲁 迅: (lǔ)
    • 呐喊 (nà)
    • 朝花夕拾 (zhāo)

Hope this helps ;)

@tfonteyn
Copy link
Owner

The download does not seem to work ? I get a "Not Found".

@CloneWith
Copy link
Contributor

Here is the alternative link to the file in my repo

@tfonteyn
Copy link
Owner

Thanks - I'm a bit busy today, I'll try to look into this though.

@tfonteyn
Copy link
Owner

Well, this turned out to be:

  • easy to find :-)
  • a really dumb bug where I goofed up :-(

I use "COLLATE LOCALIZED" to make sure sorting is according to language/region specific rules.
And I use this correctly when doing the actual sorting (SQL ORDER BY clauses)
But.... I never added this at table creation time - ouch...

For some reason this was never a problem with French or German (with their many accents on characters), but those are of course Latin alphabets.

Fixing it for new installs was easy; but now I need to fix it for upgrades obviously. More later.

@tfonteyn tfonteyn removed the help wanted Extra attention is needed label Apr 16, 2024
@tfonteyn tfonteyn self-assigned this Apr 16, 2024
@tfonteyn
Copy link
Owner

Just to keep you updated:

I've added migration code to enable those collations during upgrades. Simple tests are all running fine.

However, as this involves (internally) copying all existing data into the a new structure, I want to run exhaustive tests to make sure nothing goes wrong during upgrades. I always advice users to make backups but.... I want to play it as safe as possible.

@tfonteyn
Copy link
Owner

tfonteyn commented Apr 21, 2024

And here is the release: 5.6.0

I will install just fine op top of your test installs.

Please let me know if you have any issues of course.

@CloneWith
Copy link
Contributor

That's good now, thanks! 😀

@tfonteyn
Copy link
Owner

Excellent 👍

I'll close this issue to keep it clean. And I'll open a new issue for the Douban.com support.

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

No branches or pull requests

3 participants