tfonteyn / NeverTooManyBooks

A book collection app for Android
GNU General Public License v3.0
71 stars 3 forks source link

chinese translation #14

Closed evoke322 closed 1 month ago

evoke322 commented 1 year ago

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 commented 1 year ago

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:

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.

evoke322 commented 1 year ago

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

tfonteyn commented 1 year ago

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.

CloneWith commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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

One problem resolved

tfonteyn commented 2 months ago

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:

Future steps:

CloneWith commented 2 months ago

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 commented 2 months ago

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:

CloneWith commented 2 months ago

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

Proper list:

Hope this helps ;)

tfonteyn commented 2 months ago

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

CloneWith commented 2 months ago

Here is the alternative link to the file in my repo

tfonteyn commented 2 months ago

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

tfonteyn commented 2 months ago

Well, this turned out to be:

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 commented 2 months ago

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 commented 1 month ago

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 commented 1 month ago

That's good now, thanks! 😀

tfonteyn commented 1 month ago

Excellent 👍

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