Skip to content

Commit

Permalink
修改语言文件
Browse files Browse the repository at this point in the history
  • Loading branch information
nyancatda committed Nov 22, 2021
1 parent 45676b3 commit 3f8982b
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 13 deletions.
14 changes: 11 additions & 3 deletions resources/language/en-US.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#This language file is provided by YYT <https://www.yyt.cool/>
LanguageCode: "en-US"
LanguageName: "English"

#Language has been changed to en-US
LanguageModifiedSuccessfully: "Language has been changed to {%0}"
#en-US does note exist
LanguageModificationFailed: "{%0} does not exist"

#This language file is provided by YYT <https://www.yyt.cool/>
MainErrorTips: "Press any key to exit..."
UnableApplySession: "Unable to apply for a new Session to Mirai, please check the Settings"
ConfigFileException: "Error in configufation"
Expand Down Expand Up @@ -59,10 +62,15 @@ WikiDeleteFailedNothingness: "删除失败,你没有添加Wiki[[{%0}]]"
#"已成功删除Wiki[[mg]]
WikiDeleteSucceeded: "已成功删除Wiki[[{%0}]]"

#用户ID:1012140043
#所属平台:QQ
#用户ID:100000000
#所属平台:Telegram
#使用语言:zh-CN
#自定义Wiki:
#[[mg]] zh.moegirl.org.cn
UserInfo: "用户ID:{%0}\n所属平台:{%1}\n使用语言:{%2}\n自定义Wiki:\n{%3}"
UserInfoNotCustomWiki: "没有添加自定义Wiki"

#不存在ID为 100000000 的 Telegram 用户,请检查输入是否正确
ImportDataNull: "不存在ID为 {%0} 的 {%1} 用户,请检查输入是否正确"
#已成功将 100000000 的数据导入你的账户
ImportDataSucceeded: "已成功将 {%0} 的数据导入你的账户"
13 changes: 11 additions & 2 deletions resources/language/ja-JP.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#语言文件由 java23333 <https://github.com/java23333> 提供
LanguageCode: "ja-JP"
LanguageName: "日本語"

#言語はzh-CNに変更した
LanguageModifiedSuccessfully: "言語は{%0}に変更した"
#zh-CN言語はない
Expand Down Expand Up @@ -58,10 +62,15 @@ WikiDeleteFailedNothingness: "删除失败,你没有添加Wiki[[{%0}]]"
#"已成功删除Wiki[[mg]]
WikiDeleteSucceeded: "已成功删除Wiki[[{%0}]]"

#用户ID:1012140043
#所属平台:QQ
#用户ID:100000000
#所属平台:Telegram
#使用语言:zh-CN
#自定义Wiki:
#[[mg]] zh.moegirl.org.cn
UserInfo: "用户ID:{%0}\n所属平台:{%1}\n使用语言:{%2}\n自定义Wiki:\n{%3}"
UserInfoNotCustomWiki: "没有添加自定义Wiki"

#不存在ID为 100000000 的 Telegram 用户,请检查输入是否正确
ImportDataNull: "不存在ID为 {%0} 的 {%1} 用户,请检查输入是否正确"
#已成功将 100000000 的数据导入你的账户
ImportDataSucceeded: "已成功将 {%0} 的数据导入你的账户"
13 changes: 11 additions & 2 deletions resources/language/zh-CN.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#语言文件由 NyanCatda <https://github.com/nyancatda> 提供
LanguageCode: "zh-CN"
LanguageName: "中文"

#语言已更改为zh-CN
LanguageModifiedSuccessfully: "语言已更改为{%0}"
#zh-CN语言不存在
Expand Down Expand Up @@ -58,10 +62,15 @@ WikiDeleteFailedNothingness: "删除失败,你没有添加Wiki[[{%0}]]"
#"已成功删除Wiki[[mg]]
WikiDeleteSucceeded: "已成功删除Wiki[[{%0}]]"

#用户ID:1012140043
#所属平台:QQ
#用户ID:100000000
#所属平台:Telegram
#使用语言:zh-CN
#自定义Wiki:
#[[mg]] zh.moegirl.org.cn
UserInfo: "用户ID:{%0}\n所属平台:{%1}\n使用语言:{%2}\n自定义Wiki:\n{%3}"
UserInfoNotCustomWiki: "没有添加自定义Wiki"

#不存在ID为 100000000 的 Telegram 用户,请检查输入是否正确
ImportDataNull: "不存在ID为 {%0} 的 {%1} 用户,请检查输入是否正确"
#已成功将 100000000 的数据导入你的账户
ImportDataSucceeded: "已成功将 {%0} 的数据导入你的账户"
6 changes: 3 additions & 3 deletions src/Plugin/Command/ImportData.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func ImportData(SNSName string, UserID string, CommandText string) (string, bool
db.Where("account = ? and sns_name = ?", ImportUserID, ImportSNS).Find(&ImportSource)
var ImportUserInfos Struct.UserInfo
if ImportSource.Account != ImportUserID {
Message = "不存在ID为 " + ImportUserID + " 的 " + ImportSNS + " 用户,请检查输入是否正确"
Message = utils.StringVariable(Language.Message(SNSName, UserID).ImportDataNull, []string{ImportUserID, ImportSNS})
MessageOK = true
return Message, MessageOK
} else {
Expand All @@ -39,11 +39,11 @@ func ImportData(SNSName string, UserID string, CommandText string) (string, bool
db.Where("account = ? and sns_name = ?", UserID, SNSName).Find(&user)
if user.Account != UserID {
db.Create(&ImportUserInfos)
Message = "已成功将 " + ImportUserID + " 的数据导入你的账户"
Message = utils.StringVariable(Language.Message(SNSName, UserID).ImportDataSucceeded, []string{ImportUserID})
MessageOK = true
} else {
db.Model(&Struct.UserInfo{}).Where("account = ? and sns_name = ?", UserID, SNSName).Updates(ImportUserInfos)
Message = "已成功将 " + ImportUserID + " 的数据导入你的账户"
Message = utils.StringVariable(Language.Message(SNSName, UserID).ImportDataSucceeded, []string{ImportUserID})
MessageOK = true
}
} else {
Expand Down
4 changes: 4 additions & 0 deletions src/utils/Language/LanguageType.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package Language

type LanguageInfo struct {
LanguageCode string `yaml:"LanguageCode"`
LanguageName string `yaml:"LanguageName"`
LanguageModifiedSuccessfully string `yaml:"LanguageModifiedSuccessfully"`
LanguageModificationFailed string `yaml:"LanguageModificationFailed"`
MainErrorTips string `yaml:"MainErrorTips"`
Expand Down Expand Up @@ -28,4 +30,6 @@ type LanguageInfo struct {
WikiDeleteSucceeded string `yaml:"WikiDeleteSucceeded"`
UserInfo string `yaml:"UserInfo"`
UserInfoNotCustomWiki string `yaml:"UserInfoNotCustomWiki"`
ImportDataNull string `yaml:"ImportDataNull"`
ImportDataSucceeded string `yaml:"ImportDataSucceeded"`
}
Loading

0 comments on commit 3f8982b

Please sign in to comment.