diff --git a/components/IscnRegisterForm.vue b/components/IscnRegisterForm.vue
index 897cb8d8..e602e862 100644
--- a/components/IscnRegisterForm.vue
+++ b/components/IscnRegisterForm.vue
@@ -122,14 +122,25 @@
-
-
-
+
+
+
+
+
+
+
+
+
@@ -691,19 +702,24 @@ export default class IscnRegisterForm extends Vue {
@walletModule.Action('initIfNecessary') initIfNecessary!: () => Promise
typeOptions = [
-'Book',
-'Photo',
-'Image',
-'CreativeWork',
-]
+ 'Book',
+ 'Photo',
+ 'Image',
+ 'CreativeWork',
+ ]
fileTypeOptions = [
-'epub',
-'pdf',
-'audio',
-'jpg',
-'png',
-]
+ 'epub',
+ 'pdf',
+ 'audio',
+ 'jpg',
+ 'png',
+ ]
+
+ languageOptions = [
+ 'zh',
+ 'en',
+ ]
licenseMap: { [key: string]: string | null } = {
'Copyright. All rights reserved.': 'All Rights Reserved',
@@ -850,6 +866,20 @@ export default class IscnRegisterForm extends Vue {
return 'CreativeWork'
}
+ get defaultLanguage() {
+ const containsOnlyASCII = (str: string) => /^[ -~]*$/.test(str)
+ const epubLanguage = this.epubMetadata?.language;
+
+ if (epubLanguage === 'zh' || epubLanguage === 'en') {
+ return epubLanguage;
+ }
+
+ const titleContainsNonASCII = this.name && !containsOnlyASCII(this.name)
+ const descriptionContainsNonASCII =
+ this.description && !containsOnlyASCII(this.description)
+ return titleContainsNonASCII || descriptionContainsNonASCII ? 'zh' : 'en'
+ }
+
get authorDialogTitle() {
return this.currentAuthorDialogType === AuthorDialogType.author
? this.$t('IscnRegisterForm.title.editAuthor')
@@ -1053,6 +1083,10 @@ export default class IscnRegisterForm extends Vue {
return arweaveIdList
}
+ get isBookType() {
+ return this.type === 'Book'
+ }
+
@Watch('payload', { immediate: true, deep: true })
change() {
this.debouncedCalculateISCNFee()
@@ -1063,6 +1097,11 @@ export default class IscnRegisterForm extends Vue {
if (errormsg) this.isOpenWarningSnackbar = true
}
+ @Watch('defaultLanguage', { immediate: true })
+ setLanguageValue(value: any) {
+ this.language = value
+ }
+
async mounted() {
this.uploadStatus = 'loading'
@@ -1071,7 +1110,6 @@ export default class IscnRegisterForm extends Vue {
this.description = this.extractText(this.epubMetadata.description)
this.author.name = this.epubMetadata.author || ''
this.author.authorDescription = 'Author'
- this.language = this.epubMetadata.language || ''
this.tags = this.epubMetadata.tags || []
this.thumbnailUrl = this.formatArweave(
this.epubMetadata.thumbnailArweaveId,
@@ -1237,6 +1275,10 @@ export default class IscnRegisterForm extends Vue {
this.type = value
}
+ setLanguage(value: string) {
+ this.language = value
+ }
+
setLicense(value: string) {
this.license = value
}
diff --git a/locales/en.json b/locales/en.json
index 7a6d497b..275821e5 100644
--- a/locales/en.json
+++ b/locales/en.json
@@ -239,6 +239,7 @@
"IscnRegisterForm.label.registrant": "Registrant",
"IscnRegisterForm.label.tags": "Tags",
"IscnRegisterForm.label.type": "Type",
+ "IscnRegisterForm.label.language": "Language",
"IscnRegisterForm.label.content": "Content Info",
"IscnRegisterForm.label.uploading": "Loading files...",
"IscnRegisterForm.label.url": "URL",