diff --git a/CHANGELOG.md b/CHANGELOG.md index 1107491e06..91908abe1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Don't filter own posts when they hit your wordfilter +- Language picker now uses native language names ## [2.2.2] - 2020-12-22 diff --git a/src/components/interface_language_switcher/interface_language_switcher.vue b/src/components/interface_language_switcher/interface_language_switcher.vue index 524ec5e955..dc3bd4088c 100644 --- a/src/components/interface_language_switcher/interface_language_switcher.vue +++ b/src/components/interface_language_switcher/interface_language_switcher.vue @@ -12,11 +12,11 @@ v-model="language" > import languagesObject from '../../i18n/messages' +import localeService from '../../services/locale/locale.service.js' import ISO6391 from 'iso-639-1' import _ from 'lodash' import { library } from '@fortawesome/fontawesome-svg-core' @@ -42,12 +43,8 @@ library.add( export default { computed: { - languageCodes () { - return languagesObject.languages - }, - - languageNames () { - return _.map(this.languageCodes, this.getLanguageName) + languages () { + return _.map(languagesObject.languages, (code) => ({ code: code, name: this.getLanguageName(code) })).sort((a, b) => a.name.localeCompare(b.name)) }, language: { @@ -61,12 +58,13 @@ export default { methods: { getLanguageName (code) { const specialLanguageNames = { - 'ja': 'Japanese (日本語)', - 'ja_easy': 'Japanese (やさしいにほんご)', - 'zh': 'Simplified Chinese (简体中文)', - 'zh_Hant': 'Traditional Chinese (繁體中文)' + 'ja_easy': 'やさしいにほんご', + 'zh': '简体中文', + 'zh_Hant': '繁體中文' } - return specialLanguageNames[code] || ISO6391.getName(code) + const languageName = specialLanguageNames[code] || ISO6391.getNativeName(code) + const browserLocale = localeService.internalToBrowserLocale(code) + return languageName.charAt(0).toLocaleUpperCase(browserLocale) + languageName.slice(1) } } } diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index 16dd524954..773f764a0e 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -83,7 +83,7 @@ v-if="!!visibleRole" class="alert user-role" > - {{ visibleRole }} + {{ $t(`user_card.roles.${visibleRole}`) }} { output.follow_request_count = data.pleroma.follow_request_count output.tags = data.pleroma.tags - output.deactivated = data.pleroma.deactivated + + // deactivated was changed to is_active in Pleroma 2.3.0 + // so check if is_active is present + output.deactivated = typeof data.pleroma.is_active !== 'undefined' + ? !data.pleroma.is_active // new backend + : data.pleroma.deactivated // old backend output.notification_settings = data.pleroma.notification_settings output.unread_chat_count = data.pleroma.unread_chat_count diff --git a/src/services/locale/locale.service.js b/src/services/locale/locale.service.js new file mode 100644 index 0000000000..5be99d81f4 --- /dev/null +++ b/src/services/locale/locale.service.js @@ -0,0 +1,12 @@ +const specialLanguageCodes = { + 'ja_easy': 'ja', + 'zh_Hant': 'zh-HANT' +} + +const internalToBrowserLocale = code => specialLanguageCodes[code] || code + +const localeService = { + internalToBrowserLocale +} + +export default localeService