Language dropdown: Don't translate locales #712

This commit is contained in:
Michael Mayer
2020-12-16 13:27:44 +01:00
parent a5b9bc695e
commit 37f79324ce
10 changed files with 452 additions and 114 deletions

Binary file not shown.

View File

@@ -0,0 +1,286 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-10-26 21:44-0400\n"
"PO-Revision-Date: 2020-10-26 21:46-0400\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.1\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: messages.go:72
msgid "Unexpected error, please try again"
msgstr "未知错误, 请重试"
#: messages.go:73
msgid "Invalid request"
msgstr "无效请求"
#: messages.go:74
msgid "Changes could not be saved"
msgstr "无法保存更改"
#: messages.go:75
msgid "Could not be deleted"
msgstr "无法删除"
#: messages.go:76
#, c-format
msgid "%s already exists"
msgstr "%s 已存在"
#: messages.go:77 messages.go:80
msgid "Not found on server, deleted?"
msgstr "服务器上不存在此文件, 或已被删除?"
#: messages.go:78
msgid "File not found"
msgstr "未找到文件"
#: messages.go:79
msgid "Selection not found"
msgstr "未找到所选"
#: messages.go:81
msgid "Account not found"
msgstr "未找到账户"
#: messages.go:82
msgid "User not found"
msgstr "未找到用户"
#: messages.go:83
msgid "Label not found"
msgstr "未找到标签"
#: messages.go:84
msgid "Album not found"
msgstr "未找到相册"
#: messages.go:85
msgid "Not available in public mode"
msgstr "公开模式中不可用"
#: messages.go:86
msgid "not available in read-only mode"
msgstr "只读模式中不可用"
#: messages.go:87
msgid "Please log in and try again"
msgstr "请登陆后重试"
#: messages.go:88
msgid "Upload might be offensive"
msgstr "所上传文件可能会冒犯其他人"
#: messages.go:89
msgid "No items selected"
msgstr "未选择任何项目"
#: messages.go:90
msgid "Failed creating file, please check permissions"
msgstr "无法创建文件, 请检查权限"
#: messages.go:91
msgid "Failed creating folder, please check permissions"
msgstr "无法创建目录, 请检查权限"
#: messages.go:92
msgid "Could not connect, please try again"
msgstr "无法连接, 请重试"
#: messages.go:93
msgid "Invalid password, please try again"
msgstr "无效密码, 请重试"
#: messages.go:94
msgid "Feature disabled"
msgstr "特性已被禁用"
#: messages.go:95
msgid "No labels selected"
msgstr "未选择标签"
#: messages.go:96
msgid "No albums selected"
msgstr "未选择相册"
#: messages.go:97
msgid "No files available for download"
msgstr "没有可供下载的文件"
#: messages.go:98
msgid "Failed to create zip file"
msgstr "创建zip文件失败"
#: messages.go:99
#, fuzzy
#| msgid "Invalid request"
msgid "Invalid credentials"
msgstr "无效请求"
#: messages.go:100
msgid "Invalid link"
msgstr "无效链接"
#: messages.go:103
msgid "Changes successfully saved"
msgstr "更改已保存"
#: messages.go:104
msgid "Album created"
msgstr "相册已创建"
#: messages.go:105
msgid "Album saved"
msgstr "相册已保存"
#: messages.go:106
#, c-format
msgid "Album %s deleted"
msgstr "相册 %s 已被删除"
#: messages.go:107
msgid "Album contents cloned"
msgstr "相册内容已被复制"
#: messages.go:108
msgid "File removed from stack"
msgstr "文件已被移出"
#: messages.go:109
#, fuzzy
#| msgid "Labels deleted"
msgid "File deleted"
msgstr "已删除标签"
#: messages.go:110
#, c-format
msgid "Selection added to %s"
msgstr "所选项目已被加入 %s"
#: messages.go:111
#, c-format
msgid "One entry added to %s"
msgstr "已向 %s 添加一个条目"
#: messages.go:112
#, c-format
msgid "%d entries added to %s"
msgstr "%d个条目已被加入到%s"
#: messages.go:113
#, c-format
msgid "One entry removed from %s"
msgstr "已从 %s 移除一个条目"
#: messages.go:114
#, c-format
msgid "%d entries removed from %s"
msgstr "%d 个条目已被移除于 %s"
#: messages.go:115
msgid "Account created"
msgstr "已创建账户"
#: messages.go:116
msgid "Account saved"
msgstr "已保存账户"
#: messages.go:117
msgid "Account deleted"
msgstr "已删除账户"
#: messages.go:118
msgid "Settings saved"
msgstr "设置已保存"
#: messages.go:119
msgid "Password changed"
msgstr "密码已修改"
#: messages.go:120
#, c-format
msgid "Import completed in %d s"
msgstr "导入成功, 共花费 %d 秒"
#: messages.go:121
msgid "Import canceled"
msgstr "导入已被中止"
#: messages.go:122
#, c-format
msgid "Indexing completed in %d s"
msgstr "索引成功, 共花费 %d 秒"
#: messages.go:123
msgid "Indexing originals..."
msgstr "索引原始文件..."
#: messages.go:124
#, c-format
msgid "Indexing files in %s"
msgstr "为 %s 中的文件创建索引"
#: messages.go:125
msgid "Indexing canceled"
msgstr "索引已被中止"
#: messages.go:126
#, c-format
msgid "Removed %d files and %d photos"
msgstr "删除了 %d 个文件和 %d 张照片"
#: messages.go:127
#, c-format
msgid "Moving files from %s"
msgstr "正在从 %s 中移动文件"
#: messages.go:128
#, c-format
msgid "Copying files from %s"
msgstr "正在从 %s 中复制文件"
#: messages.go:129
msgid "Labels deleted"
msgstr "已删除标签"
#: messages.go:130
msgid "Label saved"
msgstr "已保存标签"
#: messages.go:131
#, c-format
msgid "%d files uploaded in %d s"
msgstr "已上传 %d 个文件, 耗时 %d 秒"
#: messages.go:132
msgid "Selection archived"
msgstr "所选项目已被归档"
#: messages.go:133
msgid "Selection restored"
msgstr "所选项目已被恢复"
#: messages.go:134
msgid "Selection marked as private"
msgstr "所选项目已被设为私有"
#: messages.go:135
msgid "Albums deleted"
msgstr "相册已被删除"
#: messages.go:136
#, c-format
msgid "Zip created in %d s"
msgstr "Zip文件创建成功, 耗时 %d 秒"

View File

@@ -35,15 +35,15 @@ msgstr ""
msgid "%{n} results" msgid "%{n} results"
msgstr "" msgstr ""
#: src/options/options.js:215 #: src/options/options.js:231
msgid "1 hour" msgid "1 hour"
msgstr "" msgstr ""
#: src/options/options.js:217 #: src/options/options.js:233
msgid "12 hours" msgid "12 hours"
msgstr "" msgstr ""
#: src/options/options.js:216 #: src/options/options.js:232
msgid "4 hours" msgid "4 hours"
msgstr "" msgstr ""
@@ -107,23 +107,23 @@ msgstr ""
msgid "Added" msgid "Added"
msgstr "" msgstr ""
#: src/options/options.js:225 #: src/options/options.js:241
msgid "After 1 day" msgid "After 1 day"
msgstr "" msgstr ""
#: src/options/options.js:226 #: src/options/options.js:242
msgid "After 3 days" msgid "After 3 days"
msgstr "" msgstr ""
#: src/options/options.js:227 #: src/options/options.js:243
msgid "After 7 days" msgid "After 7 days"
msgstr "" msgstr ""
#: src/options/options.js:229 #: src/options/options.js:245
msgid "After one month" msgid "After one month"
msgstr "" msgstr ""
#: src/options/options.js:231 #: src/options/options.js:247
msgid "After one year" msgid "After one year"
msgstr "" msgstr ""
@@ -131,11 +131,11 @@ msgstr ""
msgid "After selecting photos or videos from search results, you can add them to existing or new albums using the context menu." msgid "After selecting photos or videos from search results, you can add them to existing or new albums using the context menu."
msgstr "" msgstr ""
#: src/options/options.js:230 #: src/options/options.js:246
msgid "After two months" msgid "After two months"
msgstr "" msgstr ""
#: src/options/options.js:228 #: src/options/options.js:244
msgid "After two weeks" msgid "After two weeks"
msgstr "" msgstr ""
@@ -308,15 +308,19 @@ msgstr ""
msgid "Backup" msgid "Backup"
msgstr "" msgstr ""
#: src/options/options.js:250 #: src/options/options.js:266
msgid "Black" msgid "Black"
msgstr "" msgstr ""
#: src/options/options.js:246 #: src/options/options.js:262
msgid "Blue" msgid "Blue"
msgstr "" msgstr ""
#: src/options/options.js:247 #: src/options/options.js:98
msgid "Brazilian Portuguese"
msgstr ""
#: src/options/options.js:263
msgid "Brown" msgid "Brown"
msgstr "" msgstr ""
@@ -328,7 +332,7 @@ msgstr ""
msgid "Browse indexed files and folders in Library." msgid "Browse indexed files and folders in Library."
msgstr "" msgstr ""
#: src/options/options.js:257 #: src/options/options.js:273
msgid "Bug Report" msgid "Bug Report"
msgstr "" msgstr ""
@@ -417,11 +421,11 @@ msgstr ""
msgid "Checked" msgid "Checked"
msgstr "" msgstr ""
#: src/options/options.js:105 #: src/options/options.js:118
msgid "Chinese Simplified" msgid "Chinese Simplified"
msgstr "" msgstr ""
#: src/options/options.js:109 #: src/options/options.js:123
msgid "Chinese Traditional" msgid "Chinese Traditional"
msgstr "" msgstr ""
@@ -552,19 +556,19 @@ msgstr ""
msgid "Current Password" msgid "Current Password"
msgstr "" msgstr ""
#: src/options/options.js:254 #: src/options/options.js:270
msgid "Customer Support" msgid "Customer Support"
msgstr "" msgstr ""
#: src/options/options.js:245 #: src/options/options.js:261
msgid "Cyan" msgid "Cyan"
msgstr "" msgstr ""
#: src/options/options.js:128 #: src/options/options.js:144
msgid "Cyano" msgid "Cyano"
msgstr "" msgstr ""
#: src/options/options.js:218 #: src/options/options.js:234
msgid "Daily" msgid "Daily"
msgstr "" msgstr ""
@@ -572,7 +576,7 @@ msgstr ""
msgid "Day" msgid "Day"
msgstr "" msgstr ""
#: src/options/options.js:124 #: src/options/options.js:140
msgid "Default" msgid "Default"
msgstr "" msgstr ""
@@ -620,7 +624,7 @@ msgstr ""
msgid "Discover" msgid "Discover"
msgstr "" msgstr ""
#: src/options/options.js:258 #: src/options/options.js:274
msgid "Donations" msgid "Donations"
msgstr "" msgstr ""
@@ -672,7 +676,7 @@ msgstr ""
msgid "Duplicates will be skipped and only appear once." msgid "Duplicates will be skipped and only appear once."
msgstr "" msgstr ""
#: src/options/options.js:93 #: src/options/options.js:103
msgid "Dutch" msgid "Dutch"
msgstr "" msgstr ""
@@ -709,7 +713,7 @@ msgstr ""
msgid "Enabled" msgid "Enabled"
msgstr "" msgstr ""
#: src/options/options.js:77 #: src/options/options.js:78
msgid "English" msgid "English"
msgstr "" msgstr ""
@@ -721,7 +725,7 @@ msgstr ""
msgid "Errors" msgid "Errors"
msgstr "" msgstr ""
#: src/options/options.js:219 #: src/options/options.js:235
msgid "Every two days" msgid "Every two days"
msgstr "" msgstr ""
@@ -763,7 +767,7 @@ msgstr ""
msgid "Failure while importing uploaded files" msgid "Failure while importing uploaded files"
msgstr "" msgstr ""
#: src/options/options.js:158 #: src/options/options.js:174
msgid "Fast" msgid "Fast"
msgstr "" msgstr ""
@@ -777,7 +781,7 @@ msgstr ""
msgid "Favorites" msgid "Favorites"
msgstr "" msgstr ""
#: src/options/options.js:256 #: src/options/options.js:272
msgid "Feature Request" msgid "Feature Request"
msgstr "" msgstr ""
@@ -830,7 +834,7 @@ msgstr ""
msgid "Folders" msgid "Folders"
msgstr "" msgstr ""
#: src/options/options.js:85 #: src/options/options.js:88
msgid "French" msgid "French"
msgstr "" msgstr ""
@@ -842,19 +846,19 @@ msgstr ""
msgid "General" msgid "General"
msgstr "" msgstr ""
#: src/options/options.js:81 #: src/options/options.js:83
msgid "German" msgid "German"
msgstr "" msgstr ""
#: src/options/options.js:240 #: src/options/options.js:256
msgid "Gold" msgid "Gold"
msgstr "" msgstr ""
#: src/options/options.js:243 #: src/options/options.js:259
msgid "Green" msgid "Green"
msgstr "" msgstr ""
#: src/options/options.js:249 #: src/options/options.js:265
msgid "Grey" msgid "Grey"
msgstr "" msgstr ""
@@ -888,7 +892,7 @@ msgstr ""
msgid "Hide Private" msgid "Hide Private"
msgstr "" msgstr ""
#: src/options/options.js:113 #: src/options/options.js:128
msgid "Hindi" msgid "Hindi"
msgstr "" msgstr ""
@@ -896,7 +900,7 @@ msgstr ""
msgid "How can we help?" msgid "How can we help?"
msgstr "" msgstr ""
#: src/options/options.js:181 #: src/options/options.js:197
msgid "Hybrid" msgid "Hybrid"
msgstr "" msgstr ""
@@ -911,7 +915,7 @@ msgstr ""
msgid "image" msgid "image"
msgstr "" msgstr ""
#: src/options/options.js:196 #: src/options/options.js:212
msgid "Image" msgid "Image"
msgstr "" msgstr ""
@@ -1021,7 +1025,7 @@ msgstr ""
msgid "Latitude" msgid "Latitude"
msgstr "" msgstr ""
#: src/options/options.js:132 #: src/options/options.js:148
msgid "Lavender" msgid "Lavender"
msgstr "" msgstr ""
@@ -1055,7 +1059,7 @@ msgstr ""
msgid "Like" msgid "Like"
msgstr "" msgstr ""
#: src/options/options.js:242 #: src/options/options.js:258
msgid "Lime" msgid "Lime"
msgstr "" msgstr ""
@@ -1072,7 +1076,7 @@ msgstr ""
msgid "List" msgid "List"
msgstr "" msgstr ""
#: src/options/options.js:204 #: src/options/options.js:220
msgid "Live" msgid "Live"
msgstr "" msgstr ""
@@ -1114,7 +1118,7 @@ msgstr ""
msgid "Longitude" msgid "Longitude"
msgstr "" msgstr ""
#: src/options/options.js:236 #: src/options/options.js:252
msgid "Magenta" msgid "Magenta"
msgstr "" msgstr ""
@@ -1130,7 +1134,7 @@ msgstr ""
msgid "Manual Upload" msgid "Manual Upload"
msgstr "" msgstr ""
#: src/options/options.js:162 #: src/options/options.js:178
msgid "Medium" msgid "Medium"
msgstr "" msgstr ""
@@ -1159,7 +1163,7 @@ msgstr ""
msgid "Month" msgid "Month"
msgstr "" msgstr ""
#: src/options/options.js:136 #: src/options/options.js:152
msgid "Moonlight" msgid "Moonlight"
msgstr "" msgstr ""
@@ -1221,8 +1225,8 @@ msgstr ""
msgid "Name too long" msgid "Name too long"
msgstr "" msgstr ""
#: src/options/options.js:214 #: src/options/options.js:230
#: src/options/options.js:224 #: src/options/options.js:240
#: src/pages/settings/sync.vue:43 #: src/pages/settings/sync.vue:43
msgid "Never" msgid "Never"
msgstr "" msgstr ""
@@ -1289,7 +1293,7 @@ msgstr ""
msgid "Non-photographic and low-quality images require a review before they appear in search results." msgid "Non-photographic and low-quality images require a review before they appear in search results."
msgstr "" msgstr ""
#: src/options/options.js:154 #: src/options/options.js:170
msgid "None" msgid "None"
msgstr "" msgstr ""
@@ -1327,7 +1331,7 @@ msgstr ""
#: src/component/navigation.vue:400 #: src/component/navigation.vue:400
#: src/component/navigation.vue:1404 #: src/component/navigation.vue:1404
#: src/options/options.js:173 #: src/options/options.js:189
msgid "Offline" msgid "Offline"
msgstr "" msgstr ""
@@ -1337,7 +1341,7 @@ msgstr ""
msgid "Oldest first" msgid "Oldest first"
msgstr "" msgstr ""
#: src/options/options.js:220 #: src/options/options.js:236
msgid "Once a week" msgid "Once a week"
msgstr "" msgstr ""
@@ -1363,11 +1367,11 @@ msgstr ""
msgid "One result" msgid "One result"
msgstr "" msgstr ""
#: src/options/options.js:140 #: src/options/options.js:156
msgid "Onyx" msgid "Onyx"
msgstr "" msgstr ""
#: src/options/options.js:239 #: src/options/options.js:255
msgid "Orange" msgid "Orange"
msgstr "" msgstr ""
@@ -1390,11 +1394,11 @@ msgstr ""
msgid "Originals" msgid "Originals"
msgstr "" msgstr ""
#: src/options/options.js:259 #: src/options/options.js:275
msgid "Other" msgid "Other"
msgstr "" msgstr ""
#: src/options/options.js:189 #: src/options/options.js:205
msgid "Outdoor" msgid "Outdoor"
msgstr "" msgstr ""
@@ -1447,7 +1451,7 @@ msgstr ""
msgid "Photos" msgid "Photos"
msgstr "" msgstr ""
#: src/options/options.js:237 #: src/options/options.js:253
msgid "Pink" msgid "Pink"
msgstr "" msgstr ""
@@ -1483,7 +1487,7 @@ msgstr ""
msgid "Please enter your name and password:" msgid "Please enter your name and password:"
msgstr "" msgstr ""
#: src/options/options.js:97 #: src/options/options.js:108
msgid "Polish" msgid "Polish"
msgstr "" msgstr ""
@@ -1525,7 +1529,7 @@ msgstr ""
msgid "Private" msgid "Private"
msgstr "" msgstr ""
#: src/options/options.js:255 #: src/options/options.js:271
msgid "Product Feedback" msgid "Product Feedback"
msgstr "" msgstr ""
@@ -1533,7 +1537,7 @@ msgstr ""
msgid "Projection" msgid "Projection"
msgstr "" msgstr ""
#: src/options/options.js:235 #: src/options/options.js:251
msgid "Purple" msgid "Purple"
msgstr "" msgstr ""
@@ -1549,11 +1553,11 @@ msgstr ""
msgid "Random" msgid "Random"
msgstr "" msgstr ""
#: src/options/options.js:144 #: src/options/options.js:160
msgid "Raspberry" msgid "Raspberry"
msgstr "" msgstr ""
#: src/options/options.js:200 #: src/options/options.js:216
msgid "Raw" msgid "Raw"
msgstr "" msgstr ""
@@ -1573,7 +1577,7 @@ msgstr ""
msgid "Recently edited" msgid "Recently edited"
msgstr "" msgstr ""
#: src/options/options.js:238 #: src/options/options.js:254
msgid "Red" msgid "Red"
msgstr "" msgstr ""
@@ -1639,7 +1643,7 @@ msgstr ""
msgid "Review" msgid "Review"
msgstr "" msgstr ""
#: src/options/options.js:101 #: src/options/options.js:113
msgid "Russian" msgid "Russian"
msgstr "" msgstr ""
@@ -1686,7 +1690,7 @@ msgstr ""
msgid "Season" msgid "Season"
msgstr "" msgstr ""
#: src/options/options.js:148 #: src/options/options.js:164
msgid "Seaweed" msgid "Seaweed"
msgstr "" msgstr ""
@@ -1800,11 +1804,11 @@ msgstr ""
msgid "Size" msgid "Size"
msgstr "" msgstr ""
#: src/options/options.js:117 #: src/options/options.js:133
msgid "Slovak" msgid "Slovak"
msgstr "" msgstr ""
#: src/options/options.js:166 #: src/options/options.js:182
msgid "Slow" msgid "Slow"
msgstr "" msgstr ""
@@ -1823,7 +1827,7 @@ msgstr ""
msgid "Source" msgid "Source"
msgstr "" msgstr ""
#: src/options/options.js:89 #: src/options/options.js:93
msgid "Spanish" msgid "Spanish"
msgstr "" msgstr ""
@@ -1864,7 +1868,7 @@ msgstr ""
msgid "Storage Folder" msgid "Storage Folder"
msgstr "" msgstr ""
#: src/options/options.js:177 #: src/options/options.js:193
msgid "Streets" msgid "Streets"
msgstr "" msgstr ""
@@ -1894,7 +1898,7 @@ msgstr ""
msgid "Taken" msgid "Taken"
msgstr "" msgstr ""
#: src/options/options.js:244 #: src/options/options.js:260
msgid "Teal" msgid "Teal"
msgstr "" msgstr ""
@@ -1957,7 +1961,7 @@ msgstr ""
msgid "Token" msgid "Token"
msgstr "" msgstr ""
#: src/options/options.js:185 #: src/options/options.js:201
msgid "Topographic" msgid "Topographic"
msgstr "" msgstr ""
@@ -2109,7 +2113,7 @@ msgstr ""
#: src/model/file.js:172 #: src/model/file.js:172
#: src/model/photo.js:493 #: src/model/photo.js:493
#: src/model/photo.js:507 #: src/model/photo.js:507
#: src/options/options.js:208 #: src/options/options.js:224
msgid "Video" msgid "Video"
msgstr "" msgstr ""
@@ -2136,7 +2140,7 @@ msgstr ""
msgid "WebDAV Upload" msgid "WebDAV Upload"
msgstr "" msgstr ""
#: src/options/options.js:248 #: src/options/options.js:264
msgid "White" msgid "White"
msgstr "" msgstr ""
@@ -2145,7 +2149,7 @@ msgstr ""
msgid "Year" msgid "Year"
msgstr "" msgstr ""
#: src/options/options.js:241 #: src/options/options.js:257
msgid "Yellow" msgid "Yellow"
msgstr "" msgstr ""

View File

@@ -74,49 +74,65 @@ export const MonthsShort = () => {
export const Languages = () => [ export const Languages = () => [
{ {
"text": $gettext("English"), "text": "English",
"translated": $gettext("English"),
"value": "en", "value": "en",
}, },
{ {
"text": $gettext("German"), "text": "Deutsch",
"translated": $gettext("German"),
"value": "de", "value": "de",
}, },
{ {
"text": $gettext("French"), "text": "Español",
"value": "fr", "translated": $gettext("Spanish"),
},
{
"text": $gettext("Spanish"),
"value": "es", "value": "es",
}, },
{ {
"text": $gettext("Dutch"), "text": "Français",
"value": "nl", "translated": $gettext("French"),
"value": "fr",
}, },
{ {
"text": $gettext("Polish"), "text": "हिन्दी",
"value": "pl", "translated": $gettext("Hindi"),
},
{
"text": $gettext("Russian"),
"value": "ru",
},
{
"text": $gettext("Chinese Simplified"),
"value": "zh",
},
{
"text": $gettext("Chinese Traditional"),
"value": "zh_tw",
},
{
"text": $gettext("Hindi"),
"value": "hi", "value": "hi",
}, },
{ {
"text": $gettext("Slovak"), "text": "Nederlands",
"translated": $gettext("Dutch"),
"value": "nl",
},
{
"text": "Polski",
"translated": $gettext("Polish"),
"value": "pl",
},
{
"text": "Português do Brasil",
"translated": $gettext("Brazilian Portuguese"),
"value": "pt_BR",
},
{
"text": "Русский",
"translated": $gettext("Russian"),
"value": "ru",
},
{
"text": "Slovenčina",
"translated": $gettext("Slovak"),
"value": "sk", "value": "sk",
}, },
{
"text": "简体中文",
"translated": $gettext("Chinese Simplified"),
"value": "zh",
},
{
"text": "繁体中文",
"translated": $gettext("Chinese Traditional"),
"value": "zh_TW",
},
]; ];
export const Themes = () => [ export const Themes = () => [

View File

@@ -2,9 +2,10 @@ package api
import ( import (
"fmt" "fmt"
"github.com/photoprism/photoprism/internal/entity"
"net/http" "net/http"
"github.com/photoprism/photoprism/internal/entity"
"github.com/photoprism/photoprism/internal/service" "github.com/photoprism/photoprism/internal/service"
"github.com/photoprism/photoprism/internal/photoprism" "github.com/photoprism/photoprism/internal/photoprism"

View File

@@ -29,8 +29,8 @@ func TestMsg(t *testing.T) {
t.Run("already exists german", func(t *testing.T) { t.Run("already exists german", func(t *testing.T) {
SetLocale("de") SetLocale("de")
msgDE := Msg(ErrAlreadyExists, "Eine Katze") msgTrans := Msg(ErrAlreadyExists, "Eine Katze")
assert.Equal(t, "Eine Katze existiert bereits", msgDE) assert.Equal(t, "Eine Katze existiert bereits", msgTrans)
SetLocale("") SetLocale("")
msgDefault := Msg(ErrAlreadyExists, "A cat") msgDefault := Msg(ErrAlreadyExists, "A cat")
assert.Equal(t, "A cat already exists", msgDefault) assert.Equal(t, "A cat already exists", msgDefault)
@@ -38,8 +38,17 @@ func TestMsg(t *testing.T) {
t.Run("already exists polish", func(t *testing.T) { t.Run("already exists polish", func(t *testing.T) {
SetLocale("pl") SetLocale("pl")
msgPL := Msg(ErrAlreadyExists, "Kot") msgTrans := Msg(ErrAlreadyExists, "Kot")
assert.Equal(t, "Kot już istnieje", msgPL) assert.Equal(t, "Kot już istnieje", msgTrans)
SetLocale("")
msgDefault := Msg(ErrAlreadyExists, "A cat")
assert.Equal(t, "A cat already exists", msgDefault)
})
t.Run("Brazilian Portuguese", func(t *testing.T) {
SetLocale("pt_BR")
msgTrans := Msg(ErrAlreadyExists, "Gata")
assert.Equal(t, "Gata já existe", msgTrans)
SetLocale("") SetLocale("")
msgDefault := Msg(ErrAlreadyExists, "A cat") msgDefault := Msg(ErrAlreadyExists, "A cat")
assert.Equal(t, "A cat already exists", msgDefault) assert.Equal(t, "A cat already exists", msgDefault)

View File

@@ -9,16 +9,18 @@ import (
type Locale string type Locale string
const ( const (
German Locale = "de" German Locale = "de"
English Locale = "en" English Locale = "en"
Spanish Locale = "es" Spanish Locale = "es"
French Locale = "fr" French Locale = "fr"
Dutch Locale = "nl" Dutch Locale = "nl"
Polish Locale = "pl" Polish Locale = "pl"
Portuguese Locale = "pt" Portuguese Locale = "pt"
Russian Locale = "ru" BrazilianPortuguese Locale = "pt_BR"
Chinese Locale = "zh" Russian Locale = "ru"
Default = English ChineseSimplified Locale = "zh"
ChineseTraditional Locale = "zh_TW"
Default = English
) )
var localeDir = "../../assets/locales" var localeDir = "../../assets/locales"
@@ -29,11 +31,15 @@ func SetDir(dir string) {
} }
func SetLocale(loc string) { func SetLocale(loc string) {
if len(loc) < 2 { switch len(loc) {
locale = Default case 2:
} else {
loc = strings.ToLower(loc[:2]) loc = strings.ToLower(loc[:2])
locale = Locale(loc) locale = Locale(loc)
case 5:
loc = strings.ToLower(loc[:2]) + "_" + strings.ToUpper(loc[3:5])
locale = Locale(loc)
default:
locale = Default
} }
gotext.Configure(localeDir, string(locale), "default") gotext.Configure(localeDir, string(locale), "default")

View File

@@ -13,7 +13,23 @@ func TestSetLocale(t *testing.T) {
SetLocale("De") SetLocale("De")
assert.Equal(t, German, locale) assert.Equal(t, German, locale)
SetLocale("de_AT") SetLocale("de_AT")
assert.Equal(t, German, locale) assert.Equal(t, Locale("de_AT"), locale)
SetLocale("pt")
assert.Equal(t, Portuguese, locale)
SetLocale("pt_br")
assert.Equal(t, BrazilianPortuguese, locale)
SetLocale("zh")
assert.Equal(t, ChineseSimplified, locale)
SetLocale("zh_TW")
assert.Equal(t, ChineseTraditional, locale)
SetLocale("ru")
assert.Equal(t, Russian, locale)
SetLocale("fr")
assert.Equal(t, French, locale)
SetLocale("nl")
assert.Equal(t, Dutch, locale)
SetLocale("es")
assert.Equal(t, Spanish, locale)
SetLocale("PL") SetLocale("PL")
assert.Equal(t, Polish, locale) assert.Equal(t, Polish, locale)
SetLocale("") SetLocale("")