From 4a56a72bc92cc3d12aa68c9cf0057f343e5857fc Mon Sep 17 00:00:00 2001
From: wilson <wswongat@outlook.com>
Date: Sun, 25 Jul 2021 16:15:04 +0800
Subject: [PATCH 1/4] Add traditional chinese translation

---
 .../zh-hk/translation.json                    | 308 ++++++++++++++++++
 1 file changed, 308 insertions(+)
 create mode 100644 ui/src/extractedTranslations/zh-hk/translation.json

diff --git a/ui/src/extractedTranslations/zh-hk/translation.json b/ui/src/extractedTranslations/zh-hk/translation.json
new file mode 100644
index 0000000..95cbc3a
--- /dev/null
+++ b/ui/src/extractedTranslations/zh-hk/translation.json
@@ -0,0 +1,308 @@
+{
+  "album_filter": {
+    "only_favorites": "只顯示喜愛",
+    "sort": "排序",
+    "sorting_options": {
+      "date_imported": "加入日期",
+      "date_shot": "拍攝日期",
+      "title": "標題",
+      "type": "種類"
+    },
+    "sort_by": "排序方式"
+  },
+  "general": {
+    "action": {
+      "add": "加入",
+      "cancel": "取消",
+      "remove": "刪除",
+      "save": "儲存"
+    },
+    "loading": {
+      "album": "載入相簿中",
+      "default": "載入中...",
+      "page": "載入頁面中",
+      "paginate": {
+        "faces": "載入更多臉孔",
+        "media": "載入更多媒體"
+      },
+      "shares": "載入分享..."
+    }
+  },
+  "header": {
+    "search": {
+      "loading": "載入結果...",
+      "no_results": "找不到結果",
+      "placeholder": "搜尋",
+      "result_type": {
+        "albums": "相簿",
+        "media": "媒體"
+      }
+    }
+  },
+  "login_page": {
+    "field": {
+      "password": "密碼",
+      "submit": "登入",
+      "username": "使用者名稱"
+    },
+    "initial_setup": {
+      "field": {
+        "photo_path": {
+          "label": "相簿路徑",
+          "placeholder": "/path/to/photos"
+        },
+        "submit": "設定 Photoview"
+      },
+      "title": "初始設定"
+    },
+    "welcome": "歡迎使用 Photoview"
+  },
+  "meta": {
+    "description": "簡單及易用的照片庫給個人伺服器"
+  },
+  "people_page": {
+    "face_group": {
+      "label_placeholder": "名稱",
+      "unlabeled": "未命名",
+      "unlabeled_person": "未命名人物"
+    },
+    "modal": {
+      "action": {
+        "merge": "合併"
+      },
+      "detach_image_faces": {
+        "action": {
+          "detach": "分離相片臉孔",
+          "select_images": "選擇分離相片"
+        },
+        "description": "分離已選擇相片中的臉孔群組及移動到新臉孔群組",
+        "title": "分離相片中的臉孔"
+      },
+      "merge_face_groups": {
+        "description": "所有在此的臉孔群組將會合併到已選擇的臉孔群組",
+        "destination_table": {
+          "title": "選擇目標臉孔群組"
+        },
+        "title": "合併臉孔群組"
+      },
+      "move_image_faces": {
+        "description": "移動已選擇的臉孔群組到另一個面孔群組",
+        "destination_face_group_table": {
+          "move_action": "移動相片的面孔",
+          "title": "選擇目標臉孔群組"
+        },
+        "image_select_table": {
+          "next_action": "下一步",
+          "title": "選擇想移動的相片"
+        },
+        "title": "移動相片臉孔"
+      }
+    },
+    "recognize_unlabeled_faces_button": "已識別的未命名臉孔",
+    "tableselect_face_group": {
+      "search_faces_placeholder": "搜尋臉孔..."
+    },
+    "tableselect_image_faces": {
+      "search_images_placeholder": "搜尋相片..."
+    }
+  },
+  "photos_page": {
+    "title": "相片"
+  },
+  "places_page": {
+    "title": "地點"
+  },
+  "routes": {
+    "page_not_found": "找不到網頁"
+  },
+  "settings": {
+    "concurrent_workers": {
+      "description": "最多同時進行的掃描工作數目",
+      "title": "同時掃描工作"
+    },
+    "logout": "登出",
+    "periodic_scanner": {
+      "checkbox_label": "啟用週期性掃描",
+      "field": {
+        "description": "對全部使用者自動掃描的頻率",
+        "label": "掃描頻率"
+      },
+      "interval_unit": {
+        "days": "日",
+        "hour": "小時",
+        "minutes": "分鐘",
+        "months": "月",
+        "seconds": "秒"
+      },
+      "title": "週期性掃描"
+    },
+    "scanner": {
+      "description": "將掃描所有使用者的新媒體或更新媒體",
+      "scan_all_users": "掃描所有使用者",
+      "title": "掃描"
+    },
+    "user_preferences": {
+      "change_language": {
+        "description": "Change website language specific for this user",
+        "label": "Website language"
+      },
+      "language_selector": {
+        "placeholder": "Select language"
+      },
+      "title": "使用者選項"
+    },
+    "users": {
+      "add_user": {
+        "submit": "新增使用者"
+      },
+      "confirm_delete_user": {
+        "action": "刪除 {{user}}",
+        "description": "<0>確定刪除 <1></1>?</0><p>此操作無法取消</p>",
+        "title": "刪除使用者"
+      },
+      "password_reset": {
+        "description": "更改密碼 for <1></1>",
+        "form": {
+          "label": "新密碼",
+          "placeholder": "密碼",
+          "submit": "提交"
+        },
+        "title": "更改密碼"
+      },
+      "table": {
+        "column_names": {
+          "action": "動作",
+          "capabilities": "能力",
+          "photo_path": "相簿路徑",
+          "username": "使用者名稱"
+        },
+        "new_user": "新增使用者",
+        "row": {
+          "action": {
+            "change_password": "更改密碼",
+            "delete": "刪除",
+            "edit": "更改",
+            "scan": "掃描"
+          }
+        }
+      },
+      "title": "使用者"
+    },
+    "version_info": {
+      "build_date_title": "編譯日期",
+      "title": "Photoview 版本",
+      "version_title": "釋出版本"
+    }
+  },
+  "share_page": {
+    "media": {
+      "title": "已分享媒體"
+    },
+    "protected_share": {
+      "description": "此分享受密碼保護",
+      "password_required_error": "需要密碼",
+      "title": "已保護的分享"
+    },
+    "share_not_found": "找不到分享",
+    "share_not_found_description": "可能此分享已過期或已刪除",
+    "wrong_password": "密碼錯誤，請重試"
+  },
+  "sidebar": {
+    "album": {
+      "title_placeholder": "相簿名稱"
+    },
+    "download": {
+      "filesize": {
+        "byte": "",
+        "giga_byte": "",
+        "kilo_byte": "",
+        "mega_byte": "",
+        "tera_byte": "",
+        "byte_0": null,
+        "byte_1": null,
+        "byte_2": null,
+        "giga_byte_0": null,
+        "giga_byte_1": null,
+        "giga_byte_2": null,
+        "kilo_byte_0": null,
+        "kilo_byte_1": null,
+        "kilo_byte_2": null,
+        "mega_byte_0": null,
+        "mega_byte_1": null,
+        "mega_byte_2": null,
+        "tera_byte_0": null,
+        "tera_byte_1": null,
+        "tera_byte_2": null
+      },
+      "table_columns": {
+        "dimensions": "尺寸",
+        "file_size": "大小",
+        "file_type": "類型",
+        "name": "名稱"
+      },
+      "title": "下載"
+    },
+    "media": {
+      "exif": {
+        "exposure_program": {
+          "action_program": "動態模式",
+          "aperture_priority": "光圈優先",
+          "bulb": "曝光模式",
+          "creative_program": "創意模式",
+          "landscape_mode": "風景模式",
+          "manual": "手動模式",
+          "normal_program": "普通模式",
+          "not_defined": "未定義",
+          "portrait_mode": "肖像模式",
+          "shutter_priority": "快門優先"
+        },
+        "flash": {
+          "auto": "自動",
+          "did_not_fire": "Did not fire",
+          "fired": "Fired",
+          "no_flash": "No Flash",
+          "no_flash_function": "No flash function",
+          "off": "關閉",
+          "on": "使用",
+          "red_eye_reduction": "減輕紅眼",
+          "return_detected": "Return detected",
+          "return_not_detected": "Return not detected"
+        },
+        "name": {
+          "aperture": "光圈",
+          "camera": "相機",
+          "date_shot": "拍攝日期",
+          "exposure": "曝光",
+          "exposure_program": "模式",
+          "flash": "閃光燈",
+          "focal_length": "焦距",
+          "iso": "ISO",
+          "lens": "鏡頭",
+          "maker": "製造商"
+        }
+      }
+    },
+    "sharing": {
+      "add_share": "新增分享",
+      "copy_link": "複製連結",
+      "delete": "刪除分享",
+      "more": "更多",
+      "no_shares_found": "沒有分享",
+      "public_link": "公開連結",
+      "title": "分享選項"
+    }
+  },
+  "sidemenu": {
+    "albums": "相簿",
+    "people": "人物",
+    "photos": "相片",
+    "places": "地點",
+    "settings": "設定"
+  },
+  "title": {
+    "loading_album": "載入相簿",
+    "login": "登入",
+    "people": "人物",
+    "settings": "設定"
+  }
+}

From 7d55bb58a4d4d7e95c2f77c55ff128b34b4348f0 Mon Sep 17 00:00:00 2001
From: wilson <wswongat@outlook.com>
Date: Sun, 25 Jul 2021 20:29:44 +0800
Subject: [PATCH 2/4] Add traditionalChinese option in the menu Update
 traditionalChinese translation

---
 api/graphql/generated.go                      |  1 +
 api/graphql/schema.graphql                    |  1 +
 ui/src/Pages/SettingsPage/UserPreferences.tsx |  8 +++++-
 .../{zh-hk => zh-HK}/translation.json         | 26 +++++++++----------
 ui/src/localization.ts                        |  8 ++++++
 5 files changed, 30 insertions(+), 14 deletions(-)
 rename ui/src/extractedTranslations/{zh-hk => zh-HK}/translation.json (94%)

diff --git a/api/graphql/generated.go b/api/graphql/generated.go
index 55259b8..d19e7f5 100644
--- a/api/graphql/generated.go
+++ b/api/graphql/generated.go
@@ -1851,6 +1851,7 @@ enum LanguageTranslation {
   Polish,
   German,
   Russian,
+  TraditionalChinese,
 }
 
 type UserPreferences {
diff --git a/api/graphql/schema.graphql b/api/graphql/schema.graphql
index a22c727..8ab487d 100644
--- a/api/graphql/schema.graphql
+++ b/api/graphql/schema.graphql
@@ -231,6 +231,7 @@ enum LanguageTranslation {
   Polish,
   German,
   Russian,
+  TraditionalChinese,
 }
 
 type UserPreferences {
diff --git a/ui/src/Pages/SettingsPage/UserPreferences.tsx b/ui/src/Pages/SettingsPage/UserPreferences.tsx
index 4e69af5..87de699 100644
--- a/ui/src/Pages/SettingsPage/UserPreferences.tsx
+++ b/ui/src/Pages/SettingsPage/UserPreferences.tsx
@@ -26,7 +26,13 @@ const languagePreferences = [
   { key: 6, label: 'polski', flag: 'pl', value: LanguageTranslation.Polish },
   { key: 7, label: 'Italiano', flag: 'it', value: LanguageTranslation.Italian },
   { key: 8, label: 'Deutsch', flag: 'de', value: LanguageTranslation.German },
-  { key: 8, label: 'Русский', flag: 'ru', value: LanguageTranslation.Russian },
+  { key: 9, label: 'Русский', flag: 'ru', value: LanguageTranslation.Russian },
+  {
+    key: 10,
+    label: '繁體中文',
+    flag: 'zh-HK',
+    value: LanguageTranslation.TraditionalChinese,
+  },
 ]
 
 const CHANGE_USER_PREFERENCES = gql`
diff --git a/ui/src/extractedTranslations/zh-hk/translation.json b/ui/src/extractedTranslations/zh-HK/translation.json
similarity index 94%
rename from ui/src/extractedTranslations/zh-hk/translation.json
rename to ui/src/extractedTranslations/zh-HK/translation.json
index 95cbc3a..327d1e6 100644
--- a/ui/src/extractedTranslations/zh-hk/translation.json
+++ b/ui/src/extractedTranslations/zh-HK/translation.json
@@ -161,7 +161,7 @@
         "title": "刪除使用者"
       },
       "password_reset": {
-        "description": "更改密碼 for <1></1>",
+        "description": "更改 <1>{{username}}</1> 的密碼",
         "form": {
           "label": "新密碼",
           "placeholder": "密碼",
@@ -213,11 +213,11 @@
     },
     "download": {
       "filesize": {
-        "byte": "",
-        "giga_byte": "",
-        "kilo_byte": "",
-        "mega_byte": "",
-        "tera_byte": "",
+        "byte": null,
+        "giga_byte": null,
+        "kilo_byte": null,
+        "mega_byte": null,
+        "tera_byte": null,
         "byte_0": null,
         "byte_1": null,
         "byte_2": null,
@@ -258,15 +258,15 @@
         },
         "flash": {
           "auto": "自動",
-          "did_not_fire": "Did not fire",
-          "fired": "Fired",
-          "no_flash": "No Flash",
-          "no_flash_function": "No flash function",
+          "did_not_fire": null,
+          "fired": null,
+          "no_flash": null,
+          "no_flash_function": null,
           "off": "關閉",
           "on": "使用",
           "red_eye_reduction": "減輕紅眼",
-          "return_detected": "Return detected",
-          "return_not_detected": "Return not detected"
+          "return_detected": null,
+          "return_not_detected": null
         },
         "name": {
           "aperture": "光圈",
@@ -295,7 +295,7 @@
   "sidemenu": {
     "albums": "相簿",
     "people": "人物",
-    "photos": "相片",
+    "photos": "時間線",
     "places": "地點",
     "settings": "設定"
   },
diff --git a/ui/src/localization.ts b/ui/src/localization.ts
index 8a9adcc..9cde4ee 100644
--- a/ui/src/localization.ts
+++ b/ui/src/localization.ts
@@ -112,6 +112,14 @@ export const loadTranslations = () => {
           i18n.changeLanguage('ru')
         })
         return
+      case LanguageTranslation.TraditionalChinese:
+        import('./extractedTranslations/zh-HK/translation.json').then(
+          traditionalChinese => {
+            i18n.addResourceBundle('zh-HK', 'translation', traditionalChinese)
+            i18n.changeLanguage('zh-HK')
+          }
+        )
+        return
     }
 
     exhaustiveCheck(language)

From b54b9f38551ed57f3c3f21634d31af280948980e Mon Sep 17 00:00:00 2001
From: wswongat <27878101+wswongat@users.noreply.github.com>
Date: Sun, 25 Jul 2021 21:10:11 +0800
Subject: [PATCH 3/4] Update README.md

I found that I have to add these two ppas for libheif and libde265
sudo add-apt-repository ppa:strukturag/libheif
sudo add-apt-repository ppa:strukturag/libde265
---
 README.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/README.md b/README.md
index f9c6053..1c5407f 100644
--- a/README.md
+++ b/README.md
@@ -119,6 +119,9 @@ They can be installed as shown below:
 
 ```sh
 # Ubuntu
+sudo add-apt-repository ppa:strukturag/libheif
+sudo add-apt-repository ppa:strukturag/libde265
+sudo apt-get update
 sudo apt-get install libdlib-dev libblas-dev libatlas-base-dev liblapack-dev libjpeg-turbo8-dev libheif-dev
 # Debian
 sudo apt-get install libdlib-dev libblas-dev libatlas-base-dev liblapack-dev libjpeg62-turbo-dev libheif-dev

From 193c57a74061978ffcd3175aa2f4f795dbef09be Mon Sep 17 00:00:00 2001
From: viktorstrate <viktorstrate@gmail.com>
Date: Sun, 25 Jul 2021 15:39:05 +0200
Subject: [PATCH 4/4] Generate typescript types for chinese translation

---
 api/graphql/models/generated.go     | 22 ++++++++++++----------
 ui/src/__generated__/globalTypes.ts |  1 +
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/api/graphql/models/generated.go b/api/graphql/models/generated.go
index 0e04638..36d5add 100644
--- a/api/graphql/models/generated.go
+++ b/api/graphql/models/generated.go
@@ -71,15 +71,16 @@ type TimelineGroup struct {
 type LanguageTranslation string
 
 const (
-	LanguageTranslationEnglish LanguageTranslation = "English"
-	LanguageTranslationFrench  LanguageTranslation = "French"
-	LanguageTranslationItalian LanguageTranslation = "Italian"
-	LanguageTranslationSwedish LanguageTranslation = "Swedish"
-	LanguageTranslationDanish  LanguageTranslation = "Danish"
-	LanguageTranslationSpanish LanguageTranslation = "Spanish"
-	LanguageTranslationPolish  LanguageTranslation = "Polish"
-	LanguageTranslationGerman  LanguageTranslation = "German"
-	LanguageTranslationRussian LanguageTranslation = "Russian"
+	LanguageTranslationEnglish            LanguageTranslation = "English"
+	LanguageTranslationFrench             LanguageTranslation = "French"
+	LanguageTranslationItalian            LanguageTranslation = "Italian"
+	LanguageTranslationSwedish            LanguageTranslation = "Swedish"
+	LanguageTranslationDanish             LanguageTranslation = "Danish"
+	LanguageTranslationSpanish            LanguageTranslation = "Spanish"
+	LanguageTranslationPolish             LanguageTranslation = "Polish"
+	LanguageTranslationGerman             LanguageTranslation = "German"
+	LanguageTranslationRussian            LanguageTranslation = "Russian"
+	LanguageTranslationTraditionalChinese LanguageTranslation = "TraditionalChinese"
 )
 
 var AllLanguageTranslation = []LanguageTranslation{
@@ -92,11 +93,12 @@ var AllLanguageTranslation = []LanguageTranslation{
 	LanguageTranslationPolish,
 	LanguageTranslationGerman,
 	LanguageTranslationRussian,
+	LanguageTranslationTraditionalChinese,
 }
 
 func (e LanguageTranslation) IsValid() bool {
 	switch e {
-	case LanguageTranslationEnglish, LanguageTranslationFrench, LanguageTranslationItalian, LanguageTranslationSwedish, LanguageTranslationDanish, LanguageTranslationSpanish, LanguageTranslationPolish, LanguageTranslationGerman, LanguageTranslationRussian:
+	case LanguageTranslationEnglish, LanguageTranslationFrench, LanguageTranslationItalian, LanguageTranslationSwedish, LanguageTranslationDanish, LanguageTranslationSpanish, LanguageTranslationPolish, LanguageTranslationGerman, LanguageTranslationRussian, LanguageTranslationTraditionalChinese:
 		return true
 	}
 	return false
diff --git a/ui/src/__generated__/globalTypes.ts b/ui/src/__generated__/globalTypes.ts
index e66c8ac..681bbcb 100644
--- a/ui/src/__generated__/globalTypes.ts
+++ b/ui/src/__generated__/globalTypes.ts
@@ -17,6 +17,7 @@ export enum LanguageTranslation {
   Russian = 'Russian',
   Spanish = 'Spanish',
   Swedish = 'Swedish',
+  TraditionalChinese = 'TraditionalChinese',
 }
 
 export enum MediaType {
