mirror of
https://akkoma.dev/AkkomaGang/akkoma-fe.git
synced 2024-11-09 10:13:42 +00:00
Fix posting for special interface languages
Easy Japanses (ja_easy) and traditional Chinses (zh_Hant) use (custom) non-ISO codes in the interface. Because MastoAPI only accepts ISO 639 codes, the backend will return an error rendering users unable to do anything unless the post’s language was explicitly set.
This commit is contained in:
parent
ed0b403c33
commit
428ed70b0d
1 changed files with 11 additions and 2 deletions
|
@ -62,6 +62,13 @@ const deleteDraft = (draftKey) => {
|
|||
localStorage.setItem('drafts', JSON.stringify(draftData));
|
||||
}
|
||||
|
||||
const interfaceToISOLanguage = (ilang) => {
|
||||
const sep = ilang.indexOf("_");
|
||||
return sep < 0 ?
|
||||
ilang :
|
||||
ilang.substr(0, sep);
|
||||
}
|
||||
|
||||
const PostStatusForm = {
|
||||
props: [
|
||||
'statusId',
|
||||
|
@ -140,6 +147,8 @@ const PostStatusForm = {
|
|||
|
||||
const { postContentType: contentType, sensitiveByDefault, sensitiveIfSubject, interfaceLanguage, alwaysShowSubjectInput } = this.$store.getters.mergedConfig
|
||||
|
||||
const isoLanguage = interfaceToISOLanguage(interfaceLanguage)
|
||||
|
||||
let statusParams = {
|
||||
spoilerText: this.subject || '',
|
||||
status: statusText,
|
||||
|
@ -149,7 +158,7 @@ const PostStatusForm = {
|
|||
poll: {},
|
||||
mediaDescriptions: {},
|
||||
visibility: this.suggestedVisibility(),
|
||||
language: interfaceLanguage,
|
||||
language: isoLanguage,
|
||||
contentType
|
||||
}
|
||||
|
||||
|
@ -164,7 +173,7 @@ const PostStatusForm = {
|
|||
poll: this.statusPoll || {},
|
||||
mediaDescriptions: this.statusMediaDescriptions || {},
|
||||
visibility: this.statusScope || this.suggestedVisibility(),
|
||||
language: this.statusLanguage || interfaceLanguage,
|
||||
language: this.statusLanguage || isoLanguage,
|
||||
contentType: statusContentType
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue