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

[TAS-2030] 💄 Add inLanguage field for book #471

Merged
merged 4 commits into from
Sep 3, 2024

Conversation

AuroraHuang22
Copy link
Collaborator

截圖 2024-08-27 下午2 48 49

Copy link

AuroraHuang22 added a commit that referenced this pull request Aug 27, 2024
Comment on lines 869 to 871
get defaultLanguage() {
return this.epubMetadata?.language || 'zh'
}
Copy link
Member

Choose a reason for hiding this comment

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

Should set this.language as defaultLanguage on mounted()

Copy link
Member

Choose a reason for hiding this comment

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

Also would be nice if we can set default as en or zh according to if we have non-ascii charater in title or description

Copy link
Collaborator Author

@AuroraHuang22 AuroraHuang22 Aug 30, 2024

Choose a reason for hiding this comment

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

Use watch to detect name & description language for book.

🚸 Auto detect language for book

AuroraHuang22 added a commit that referenced this pull request Aug 30, 2024
@@ -850,6 +866,17 @@ export default class IscnRegisterForm extends Vue {
return 'CreativeWork'
}

get defaultLanguage() {
const containsChinese = (str: any) => /[\u4E00-\u9FFF\u3400-\u4DBF\uF900-\uFAFF]/.test(str);
Copy link
Member

Choose a reason for hiding this comment

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

Suggest to just simply check for all ascii/alphanumeric for English and avoid unicode logic

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

components/IscnRegisterForm.vue Outdated Show resolved Hide resolved
AuroraHuang22 added a commit that referenced this pull request Sep 2, 2024
get defaultLanguage() {
const containsOnlyASCII = (str: string) => /^[ -~]*$/.test(str);

const isEpubInChinese = this.epubMetadata?.language === 'zh';
Copy link
Member

Choose a reason for hiding this comment

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

Should we respect if epub metadata language is explicitly set to en?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

AuroraHuang22 added a commit that referenced this pull request Sep 3, 2024
@williamchong williamchong merged commit 54d7206 into likecoin:main Sep 3, 2024
1 check passed
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.

3 participants