Skip to content

Commit

Permalink
feat: use configured writing/post language of user from mastodon (#2282)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklaswolf committed Jul 29, 2023
1 parent 0a9f2d9 commit 675f518
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composables/masto/publish.ts
Expand Up @@ -15,7 +15,7 @@ export function usePublish(options: {
const { client } = $(useMasto())
const settings = useUserSettings()

const preferredLanguage = $computed(() => (settings.value?.language || 'en').split('-')[0])
const preferredLanguage = $computed(() => (currentUser.value?.account.source.language || settings.value?.language || 'en').split('-')[0])

let isSending = $ref(false)
const isExpanded = $ref(false)
Expand Down
1 change: 1 addition & 0 deletions locales/de-DE.json
Expand Up @@ -426,6 +426,7 @@
"language": {
"display_language": "Anzeigesprache",
"label": "Sprache",
"post_language": "Beitragssprache",
"status": "Übersetzungsstatus: {0}/{1} ({2}%)",
"translations": {
"add": "Hinzufügen",
Expand Down
1 change: 1 addition & 0 deletions locales/en.json
Expand Up @@ -427,6 +427,7 @@
"language": {
"display_language": "Display Language",
"label": "Language",
"post_language": "Posting Language",
"status": "Translation status: {0}/{1} ({2}%)",
"translations": {
"add": "Add",
Expand Down
26 changes: 20 additions & 6 deletions pages/settings/language/index.vue
Expand Up @@ -22,13 +22,27 @@ const status = computed(() => {
</div>
</template>
<div p6>
<label space-y-2>
<span block font-medium>{{ $t('settings.language.display_language') }}</span>
<span block>
{{ status }}
</span>
<div space-y-2>
<h2 py2 font-bold text-xl flex="~ gap-1" items-center>
{{ $t('settings.language.display_language') }}
</h2>
<div>{{ status }}</div>
<SettingsLanguage select-settings />
</label>
</div>
<div mt4>
<h2 font-bold text-xl flex="~ gap-1" items-center>
{{ $t('settings.language.post_language') }}
</h2>
<SettingsItem
v-if="currentUser"
command large
icon="i-ri:quill-pen-line"
:text="$t('settings.language.post_language')"
:description="$t('settings.account_settings.description')"
:to="`https://${currentUser!.server}/settings/preferences/other`"
external target="_blank"
/>
</div>
<h2 py4 mt2 font-bold text-xl flex="~ gap-1" items-center>
{{ $t('settings.language.translations.heading') }}
</h2>
Expand Down

0 comments on commit 675f518

Please sign in to comment.