diff --git a/components/publish/PublishWidget.vue b/components/publish/PublishWidget.vue index 05646bc0..63e4d4c9 100644 --- a/components/publish/PublishWidget.vue +++ b/components/publish/PublishWidget.vue @@ -3,6 +3,7 @@ import type { Attachment, CreateStatusParams, Status, StatusVisibility } from 'm import { fileOpen } from 'browser-fs-access' import { useDropZone } from '@vueuse/core' import { EditorContent } from '@tiptap/vue-3' +import ISO6391 from 'iso-639-1' import type { Draft } from '~/types' type FileUploadError = [filename: string, message: string] @@ -135,6 +136,10 @@ function chooseVisibility(visibility: StatusVisibility) { draft.params.visibility = visibility } +function chooseLanguage(language: string | null) { + draft.params.language = language +} + async function publish() { const payload = { ...draft.params, @@ -323,6 +328,41 @@ defineExpose({ + + + + + + + + + + + + + + {{ code ? ISO6391.getNativeName(code) : 'None' }} + + + {{ ISO6391.getName(code) }} + + + + + + + + + diff --git a/locales/en-GB.json b/locales/en-GB.json index a591236e..b7619b80 100644 --- a/locales/en-GB.json +++ b/locales/en-GB.json @@ -347,6 +347,7 @@ "add_content_warning": "Add content warning", "add_media": "Add images, a video or an audio file", "change_content_visibility": "Change content visibility", + "change_language": "Change language", "emoji": "Emoji", "explore_links_intro": "These news stories are being talked about by people on this and other servers of the decentralized network right now.", "explore_posts_intro": "These posts from this and other servers in the decentralized network are gaining traction on this server right now.", diff --git a/locales/en-US.json b/locales/en-US.json index 06a2e47d..6e67b95a 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -350,6 +350,7 @@ "add_content_warning": "Add content warning", "add_media": "Add images, a video or an audio file", "change_content_visibility": "Change content visibility", + "change_language": "Change language", "emoji": "Emoji", "explore_links_intro": "These news stories are being talked about by people on this and other servers of the decentralized network right now.", "explore_posts_intro": "These posts from this and other servers in the decentralized network are gaining traction on this server right now.", diff --git a/locales/zh-CN.json b/locales/zh-CN.json index cd738354..34a1f0b4 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -340,6 +340,7 @@ "add_content_warning": "添加内容警告标识", "add_media": "添加图片、视频或者音频文件", "change_content_visibility": "修改内容是否可见", + "change_language": "更改语言", "emoji": "表情符号", "explore_links_intro": "这些新闻故事正被本站和分布式网络上其他站点的用户谈论。", "explore_posts_intro": "来自本站和分布式网络上其他站点的这些嘟文正在本站引起关注。", diff --git a/locales/zh-TW.json b/locales/zh-TW.json index e32b0a9a..e0839071 100644 --- a/locales/zh-TW.json +++ b/locales/zh-TW.json @@ -340,6 +340,7 @@ "add_content_warning": "添加內容警告標識", "add_media": "添加圖片、視頻或者音頻文件", "change_content_visibility": "修改內容是否可見", + "change_language": "改變語言", "emoji": "表情符號", "explore_links_intro": "這些新聞故事正被本站和分佈式網絡上其他站點的用戶談論。", "explore_posts_intro": "來自本站和分佈式網絡上其他站點的這些嘟文正在本站引起關注。", diff --git a/package.json b/package.json index d56fdf9a..a46c058a 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "form-data": "^4.0.0", "fuse.js": "^6.6.2", "idb-keyval": "^6.2.0", + "iso-639-1": "^2.1.15", "js-yaml": "^4.1.0", "lru-cache": "^7.14.1", "masto": "^4.11.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d742a4b9..871b733c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -51,6 +51,7 @@ specifiers: fs-extra: ^11.1.0 fuse.js: ^6.6.2 idb-keyval: ^6.2.0 + iso-639-1: ^2.1.15 js-yaml: ^4.1.0 jsdom: ^20.0.3 lint-staged: ^13.1.0 @@ -106,6 +107,7 @@ dependencies: form-data: 4.0.0 fuse.js: 6.6.2 idb-keyval: 6.2.0 + iso-639-1: 2.1.15 js-yaml: 4.1.0 lru-cache: 7.14.1 masto: 4.11.1 @@ -163,7 +165,7 @@ devDependencies: typescript: 4.9.4 unplugin-auto-import: 0.12.1_@vueuse+core@9.9.0 vite-plugin-inspect: 0.7.11 - vite-plugin-pwa: 0.13.3 + vite-plugin-pwa: 0.13.3_workbox-window@6.5.4 vitest: 0.26.2_jsdom@20.0.3 vue-tsc: 1.0.16_typescript@4.9.4 workbox-window: 6.5.4 @@ -6613,6 +6615,11 @@ packages: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true + /iso-639-1/2.1.15: + resolution: {integrity: sha512-7c7mBznZu2ktfvyT582E2msM+Udc1EjOyhVRE/0ZsjD9LBtWSm23h3PtiRh2a35XoUsTQQjJXaJzuLjXsOdFDg==} + engines: {node: '>=6.0'} + dev: false + /isomorphic-form-data/2.0.0: resolution: {integrity: sha512-TYgVnXWeESVmQSg4GLVbalmQ+B4NPi/H4eWxqALKj63KsUrcu301YDjBqaOw3h+cbak7Na4Xyps3BiptHtxTfg==} dependencies: @@ -9941,10 +9948,11 @@ packages: - supports-color dev: true - /vite-plugin-pwa/0.13.3: + /vite-plugin-pwa/0.13.3_workbox-window@6.5.4: resolution: {integrity: sha512-cjWXpZ7slAY14OKz7M8XdgTIi9wjf6OD6NkhiMAc+ogxnbUrecUwLdRtfGPCPsN2ftut5gaN1jTghb11p6IQAA==} peerDependencies: vite: ^3.1.0 + workbox-window: ^6.5.4 dependencies: '@rollup/plugin-replace': 4.0.0_rollup@2.79.1 debug: 4.3.4