-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
AuroraHuang22
commented
Aug 27, 2024
components/IscnRegisterForm.vue
Outdated
get defaultLanguage() { | ||
return this.epubMetadata?.language || 'zh' | ||
} |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
6af5f50
to
f01d618
Compare
components/IscnRegisterForm.vue
Outdated
@@ -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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
components/IscnRegisterForm.vue
Outdated
get defaultLanguage() { | ||
const containsOnlyASCII = (str: string) => /^[ -~]*$/.test(str); | ||
|
||
const isEpubInChinese = this.epubMetadata?.language === 'zh'; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.