trmnl-i18n 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/README.adoc +5 -7
  4. data/lib/trmnl/i18n/locales/custom_plugins/da.yml +32 -36
  5. data/lib/trmnl/i18n/locales/custom_plugins/de-AT.yml +32 -36
  6. data/lib/trmnl/i18n/locales/custom_plugins/de.yml +32 -36
  7. data/lib/trmnl/i18n/locales/custom_plugins/en.yml +32 -36
  8. data/lib/trmnl/i18n/locales/custom_plugins/es-ES.yml +32 -36
  9. data/lib/trmnl/i18n/locales/custom_plugins/fr.yml +32 -36
  10. data/lib/trmnl/i18n/locales/custom_plugins/he.yml +32 -36
  11. data/lib/trmnl/i18n/locales/custom_plugins/id.yml +32 -36
  12. data/lib/trmnl/i18n/locales/custom_plugins/it.yml +32 -36
  13. data/lib/trmnl/i18n/locales/custom_plugins/ja.yml +31 -35
  14. data/lib/trmnl/i18n/locales/custom_plugins/ko.yml +32 -36
  15. data/lib/trmnl/i18n/locales/custom_plugins/nl.yml +32 -36
  16. data/lib/trmnl/i18n/locales/custom_plugins/pt-BR.yml +32 -36
  17. data/lib/trmnl/i18n/locales/custom_plugins/raw.yml +32 -36
  18. data/lib/trmnl/i18n/locales/custom_plugins/uk.yml +32 -36
  19. data/lib/trmnl/i18n/locales/custom_plugins/zh-CN.yml +1 -5
  20. data/lib/trmnl/i18n/locales/custom_plugins/zh-HK.yml +1 -5
  21. data/lib/trmnl/i18n/locales/plugin_renders/da.yml +29 -5
  22. data/lib/trmnl/i18n/locales/plugin_renders/de-AT.yml +28 -4
  23. data/lib/trmnl/i18n/locales/plugin_renders/de.yml +28 -4
  24. data/lib/trmnl/i18n/locales/plugin_renders/en.yml +28 -4
  25. data/lib/trmnl/i18n/locales/plugin_renders/es-ES.yml +28 -3
  26. data/lib/trmnl/i18n/locales/plugin_renders/fr.yml +28 -4
  27. data/lib/trmnl/i18n/locales/plugin_renders/he.yml +29 -5
  28. data/lib/trmnl/i18n/locales/plugin_renders/id.yml +28 -4
  29. data/lib/trmnl/i18n/locales/plugin_renders/it.yml +28 -4
  30. data/lib/trmnl/i18n/locales/plugin_renders/ja.yml +28 -4
  31. data/lib/trmnl/i18n/locales/plugin_renders/ko.yml +28 -4
  32. data/lib/trmnl/i18n/locales/plugin_renders/nl.yml +28 -4
  33. data/lib/trmnl/i18n/locales/plugin_renders/no.yml +29 -5
  34. data/lib/trmnl/i18n/locales/plugin_renders/pt-BR.yml +28 -4
  35. data/lib/trmnl/i18n/locales/plugin_renders/raw.yml +28 -4
  36. data/lib/trmnl/i18n/locales/plugin_renders/uk.yml +28 -4
  37. data/lib/trmnl/i18n/locales/plugin_renders/zh-CN.yml +28 -4
  38. data/lib/trmnl/i18n/locales/plugin_renders/zh-HK.yml +28 -4
  39. data/lib/trmnl/i18n/locales/web_ui/da.yml +24 -26
  40. data/lib/trmnl/i18n/locales/web_ui/de-AT.yml +40 -43
  41. data/lib/trmnl/i18n/locales/web_ui/de.yml +41 -44
  42. data/lib/trmnl/i18n/locales/web_ui/en.yml +41 -44
  43. data/lib/trmnl/i18n/locales/web_ui/es-ES.yml +41 -44
  44. data/lib/trmnl/i18n/locales/web_ui/fr.yml +37 -40
  45. data/lib/trmnl/i18n/locales/web_ui/he.yml +40 -43
  46. data/lib/trmnl/i18n/locales/web_ui/id.yml +38 -41
  47. data/lib/trmnl/i18n/locales/web_ui/it.yml +40 -43
  48. data/lib/trmnl/i18n/locales/web_ui/ja.yml +42 -45
  49. data/lib/trmnl/i18n/locales/web_ui/ko.yml +39 -42
  50. data/lib/trmnl/i18n/locales/web_ui/nl.yml +38 -41
  51. data/lib/trmnl/i18n/locales/web_ui/no.yml +21 -27
  52. data/lib/trmnl/i18n/locales/web_ui/pt-BR.yml +41 -44
  53. data/lib/trmnl/i18n/locales/web_ui/raw.yml +21 -24
  54. data/lib/trmnl/i18n/locales/web_ui/uk.yml +44 -47
  55. data/lib/trmnl/i18n/locales/web_ui/zh-CN.yml +39 -42
  56. data/lib/trmnl/i18n/locales/web_ui/zh-HK.yml +62 -65
  57. data/lib/trmnl/i18n/synchronization/processor.rb +56 -0
  58. data/lib/trmnl/i18n/synchronization/repo.rb +43 -0
  59. data/lib/trmnl/i18n/synchronization/value_reducer.rb +23 -0
  60. data/trmnl-i18n.gemspec +3 -3
  61. data.tar.gz.sig +0 -0
  62. metadata +21 -19
  63. metadata.gz.sig +0 -0
@@ -1,9 +1,9 @@
1
+ ---
1
2
  zh-HK:
2
- # global, logged out, and auth-related
3
3
  add: 加入
4
4
  add_new: 新增
5
- ago: 前 # example: "Created 5 mins ago"
6
- already_have_account: 我已經有帳戶 # signup form cta
5
+ ago: 前
6
+ already_have_account: 我已經有帳戶
7
7
  back: 返回
8
8
  back_to_all_blog_posts: 返回所有貼文
9
9
  blog: 網誌
@@ -11,15 +11,15 @@ zh-HK:
11
11
  cancel: 取消
12
12
  change_password: 更改密碼
13
13
  charge_level: 充電狀態
14
- charged: 已充電
14
+ charged: 電量
15
15
  close: 關閉
16
16
  confirm_change_password: 更改密碼
17
17
  confirm_password: 確認新密碼
18
18
  copy: 複製
19
19
  copied_to_clipboard: 已複製!
20
20
  copy_to_clipboard: 複製至剪貼簿
21
- created: 新增於 # example: "Created 5 mins ago"
22
- create_an_account: 新增帳戶 # login form cta
21
+ created: 新增於
22
+ create_an_account: 新增帳戶
23
23
  current_device: 現時裝置
24
24
  days: 日
25
25
  delete: 刪除
@@ -28,10 +28,10 @@ zh-HK:
28
28
  edit: 設定
29
29
  email_address: 電郵地址
30
30
  export: 匯出
31
- fetching: 載入中 # for asynchronous content requests; this message may appear as a placeholder text for 0-2 seconds
31
+ fetching: 載入中
32
32
  first_name: 名字
33
- forgot_password: 忘記密碼 # login form link
34
- forgot_password_title: 再次輸入 # heading on /password/new (hint: https://www.google.com/search?q=here+we+go+again+meme)
33
+ forgot_password: 忘記密碼
34
+ forgot_password_title: 再次輸入
35
35
  get_started: 讓我們開始吧!
36
36
  identify: 識別
37
37
  import: 匯入
@@ -43,34 +43,37 @@ zh-HK:
43
43
  loading: 載入中
44
44
  login: 登入
45
45
  log_out: 登出
46
- minimum_characters: 字元(最少) # ex: 8 characters minimum
47
- mins: 分鐘 # 'minutes' abbreviation
48
- my_playlist: 我的播放清單 # default name for a new playlist group
46
+ minimum_characters: 字元(最少)
47
+ mins: 分鐘
48
+ my_playlist: 我的播放清單
49
49
  new_password: 新密碼
50
50
  password: 密碼
51
- please_wait: 請稍候⋯ # similar to "Fetching", but shown after a long process button click vs on page-load
51
+ please_wait: 請稍候⋯
52
52
  plugin_not_found: 找不到外掛
53
- refresh_rates_hint: "__按此__了解重新整理頻率如何運作。"
53
+ refresh_rates_hint: __按此__了解重新整理頻率如何運作。
54
54
  reset_password: 重設密碼
55
55
  save: 儲存
56
56
  section: 章節
57
- sign_in: 登入 # login form cta
58
- sign_up: 註冊 # logged out navigation
57
+ sign_in: 登入
58
+ sign_up: 註冊
59
59
  something_went_wrong: 發生錯誤
60
- support: 支援 # bottom navigation tab, links to help center
60
+ support: 支援
61
61
  update: 更新
62
62
  view: 查看
63
- welcome: 歡迎 # login form heading
64
-
65
- # views by resource (device, plugins, playlists, account, etc)
63
+ welcome: 歡迎
66
64
  account:
67
65
  index:
68
66
  title: 帳戶
69
67
  tagline: 管理帳戶設定
68
+ api_key_confirm: Are you sure you want to regenerate your API Key? The old key will be invalidated.
69
+ api_key_hint: See __the docs__ to learn how to configure your local environment.
70
+ api_key_label: The credential for authenticating local development tools
71
+ api_key_reset: Regenerate
72
+ api_key: API Key
70
73
  email_address: 電郵地址
71
74
  refer_and_earn: 推薦回贈計劃
72
75
  refer_and_earn_hint: 使用專屬優惠券與分享TRMNL。每次使用都可賺取收入,按月支付。
73
- refer_and_earn_redemptions: 兌換次數 # how many times this coupon has been used
76
+ refer_and_earn_redemptions: 兌換次數
74
77
  refer_and_earn_request_code: 索取推薦碼
75
78
  device_invoice: 裝置發票
76
79
  device_invoice_label: 下載商業文件以作會計用途。
@@ -80,7 +83,7 @@ zh-HK:
80
83
  last_name_hint: 可讓TRMNL介面更舒適。
81
84
  password_hint: 用於保護你的TRMNL帳戶。
82
85
  enable_2fa: 啟用雙重驗證(2FA)?
83
- enable_2fa_hint: "__按此__啟用OTP。"
86
+ enable_2fa_hint: __按此__啟用OTP。
84
87
  disable_2fa: 停用雙重驗證(2FA)
85
88
  disable_2fa_hint: 如要停用,請提供有效的單次密碼(OTP),並在上方輸入現時密碼。
86
89
  session: 登入狀態
@@ -89,10 +92,10 @@ zh-HK:
89
92
  time_zone_hint: 用於判斷重新整理頻率及裝置睡眠時間。
90
93
  locale: 地區設定
91
94
  locale_hint: 你希望使用哪一種語言? __按此了解更多__。
92
-
93
- # toast messages
94
95
  update:
95
96
  success: 成功更新個人資料
97
+ reset_api_key:
98
+ success: API key was regenerated successfully
96
99
  dashboard:
97
100
  index:
98
101
  title: 儀表板
@@ -104,38 +107,38 @@ zh-HK:
104
107
  last_90_days: 過去90日
105
108
  today: 今日
106
109
  yesterday: 昨日
107
- health: # partial (widget)
110
+ health:
108
111
  bad: 外掛出現問題
109
112
  good: 外掛運作正常
110
113
  next_steps: 當有變更時,我們會通知你
111
- news: # partial (widget)
114
+ news:
112
115
  title: 新聞
113
116
  cta: 查看所有
114
- playlists: # partial (widget)
117
+ playlists:
115
118
  title: 播放清單
116
119
  cta: 編輯播放清單
117
120
  pieces_of_content_displayed: 顯示畫面數量
118
- plugins: # partial (widget)
121
+ plugins:
119
122
  title: 外掛功能
120
123
  cta: 前往外掛列表
121
124
  connected: 已連接外掛
122
125
  new_and_popular: 最新及熱門項目
123
126
  shop:
124
127
  title: 商店
125
- time_saved: # partial (widget)
128
+ time_saved:
126
129
  title: 已節省時間
127
130
  cta: 詳情
128
131
  devices:
129
132
  edit:
130
- accepts_beta_firmware: 韌體搶先發佈 # true/false toggle to receive new device updates before regular users
133
+ accepts_beta_firmware: 韌體搶先發佈
131
134
  accepts_beta_firmware_hint: 啟用設定後,你會在其他用戶之前取得最新的硬件韌體改進。
132
135
  back_to_devices: 返回裝置
133
136
  battery_consumption: 電池消耗
134
137
  battery_consumption_hint: 啟用「睡眠模式」可節省電量,並延長電池續航時間。
135
- developer_perks: 開發者福利 # heading; below this is a list of options for devices with (paid) Developer edition add-on
138
+ developer_perks: 開發者福利
136
139
  developer_perks_hint: 以下選項需要購買「__開發者版本__」。.
137
140
  device_credentials: 裝置認證
138
- device_credentials_hint: "__按此__了解如何使用裝置認證"
141
+ device_credentials_hint: __按此__了解如何使用裝置認證
139
142
  device_name: 裝置名稱
140
143
  device_name_hint: 此名稱可讓TRMNL介面更舒適
141
144
  edit_device: 編輯裝置
@@ -147,20 +150,20 @@ zh-HK:
147
150
  mirror: 鏡像共享
148
151
  mirror_device: 鏡像共享另一部裝置
149
152
  mirror_device_hint: 輸入可共享(shareable)裝置的ID,以鏡像共享其播放清單。你的播放清單仍然會顯示。
150
- ota_enabled: 已啟用自動更新
153
+ ota_enabled: 啟用自動更新
151
154
  ota_enabled_hint: 自動安裝新的韌體。如要使用自訂韌體,請關閉此設定。
152
155
  sleep_mode: 睡眠模式
153
156
  sleep_mode_hint: 調整重新整理頻率,以提升專注度及電池續航時間。
154
157
  sleep_screen: 睡眠畫面
155
158
  special_function: 特別功能
156
159
  special_function_hint: 按兩下裝置背面的按鈕時,會執行特別功能。
157
- special_function_learn_more: "__按此__了解特別功能。"
160
+ special_function_learn_more: __按此__了解特別功能。
158
161
  unlink: 取消連結
159
162
  unlink_device: 取消連結裝置
160
163
  unlink_device_hint: 如要安全地轉售或轉讓TRMNL裝置,請先取消連結。
161
164
  visibility: 共享狀態
162
165
  visibility_hint: 讓其他TRMNL裝置可鏡像共享此裝置的內容。
163
- your_device: 你的TRMNL裝置
166
+ your_device: 你的TRMNL
164
167
  index:
165
168
  title: 裝置
166
169
  tagline: 你的TRMNL裝置
@@ -170,8 +173,6 @@ zh-HK:
170
173
  title: 新增裝置
171
174
  description: 輸入裝置ID以新增TRMNL裝置到你的帳戶。
172
175
  add_device: 新增裝置
173
-
174
- # toast messages
175
176
  associate:
176
177
  error: 連結裝置時發生錯誤
177
178
  success: 成功連結裝置
@@ -201,7 +202,7 @@ zh-HK:
201
202
  title: 除錯記錄
202
203
  all: 所有
203
204
  device: 裝置
204
- dump: 內容 # content
205
+ dump: 內容
205
206
  id: ID
206
207
  private_plugins: 客製外掛
207
208
  source: 來源
@@ -218,14 +219,17 @@ zh-HK:
218
219
  edit_markup_without_preview: 編輯標記碼(略過預覽)
219
220
  error_rendering_markup: 轉譯標記碼時發生錯誤
220
221
  fix_indentation: 修復縮排
222
+ go_to_preview: Go To Preview
221
223
  live_preview: 即時預覽
222
224
  no_changes_to_save: 沒有變更可儲存
225
+ pop_out_preview: Pop Out Preview
223
226
  quickstart_examples: 快速入門範例
224
227
  quickstart_example_applied: 已套用!
225
228
  quickstart_use_this_example: 套用此範例
226
229
  revert: 還原
227
230
  revert_confirm: 確定要還原嗎?所有未儲存的變更將會消失。
228
231
  save_changes: 儲存變更 (⌘﹢S)
232
+ separate_preview: Preview is open in a separate window
229
233
  merge_variables:
230
234
  your_variables: 變數
231
235
  no_merge_variables:
@@ -252,24 +256,22 @@ zh-HK:
252
256
  index:
253
257
  title: 播放清單
254
258
  tagline: 選擇此裝置上顯示的畫面
255
- add_a_group: 加入群組
259
+ add_a_group: 新增群組
256
260
  add_a_plugin: 加入外掛
257
261
  add_first_device_cta: 請先__新增__TRMNL裝置!
258
262
  add_to_playlist: 加入至播放清單
259
263
  create_first_playlist_cta: 請先__連接__第一個外掛功能,方可新增播放清單!
260
- custom: Custom
261
- device_default: Device default
264
+ custom: 自訂
265
+ device_default: 裝置預設
262
266
  display_period_from: 顯示時間
263
267
  display_period_to: 至
264
- display_period_validation: Start time must be before end time. Create another group to span overnight hours.
265
- every: every
266
- playlist: # partial (single item)
268
+ display_period_validation: 開始時間必須早於結束時間。如要跨越午夜,請新增另一個群組。
269
+ every: 頻率
270
+ playlist:
267
271
  delete: 確定要移除此項目嗎?外掛會保持連接,只是不會在裝置上顯示。
268
272
  displayed_now: 正在顯示
269
273
  not_displayed_yet: 待處理
270
274
  remove_from_playlist: 從播放清單中移除
271
-
272
- # toast messages
273
275
  create:
274
276
  error: 更新播放清單時發生錯誤
275
277
  success: 已更新播放清單
@@ -284,9 +286,9 @@ zh-HK:
284
286
  tagline: 你會在TRMNL上顯示什麼?
285
287
  available: 可使用
286
288
  connected: 已連接
287
- recipes: 模板(Recipe) # recipe doesn't tranlate well in zh-HK, using 'template' instead
289
+ recipes: 模板(Recipe)
288
290
  recipes_hint: 社群用戶開發的客製外掛,一鍵即可安裝。 __了解更多__
289
- search: # partial (search box)
291
+ search:
290
292
  placeholder: 搜尋外掛
291
293
  my:
292
294
  index:
@@ -307,13 +309,13 @@ zh-HK:
307
309
  icon: 圖示
308
310
  icon_hint: 建議使用40×40像素
309
311
  installation_url: 安裝網址
310
- installation_url_hint: "__按此__了解安裝流程。"
312
+ installation_url_hint: __按此__了解安裝流程。
311
313
  installation_success_webhook_url: 安裝成功Webhook網址
312
314
  knowledge_base_url: 知識庫網址
313
315
  management_url: 管理網址
314
- management_url_hint: "__按此__了解管理流程。"
316
+ management_url_hint: __按此__了解管理流程。
315
317
  markup_url: 標記碼(Markup)網址
316
- markup_url_hint: "__按此__了解畫面生成方式。"
318
+ markup_url_hint: __按此__了解畫面生成方式。
317
319
  uninstallation_webhook_url: 解除安裝Webhook網址
318
320
  edit:
319
321
  title: 編輯外掛
@@ -321,7 +323,7 @@ zh-HK:
321
323
  name: 名稱
322
324
  description: 描述
323
325
  plugin_recipes:
324
- connected: Recipe connected
326
+ connected: 已連接模板
325
327
  new:
326
328
  error: 找不到模板
327
329
  plugin_settings:
@@ -330,7 +332,7 @@ zh-HK:
330
332
  delete_are_you_sure: 確定要刪除此設定嗎?
331
333
  delete: 這樣會完全移除此外掛的設定。如要只從你的裝置隱藏此外掛,請從播放清單將其移除。
332
334
  inactive: 停用
333
- no_plugin_settings_found: 找不到外掛設定。 # empty state - should not appear
335
+ no_plugin_settings_found: 找不到外掛設定。
334
336
  refreshing_now_please_wait: 正在重新整理,請在幾秒鐘後重新載入此頁面。
335
337
  reset_credentials: 成功重設「%{plugin_name}」帳戶
336
338
  form:
@@ -361,18 +363,16 @@ zh-HK:
361
363
  remove_plugin: 移除外掛
362
364
  remove_plugin_hint: 移除外掛後,亦會從你的播放清單中移除
363
365
  synced: 已同步
364
- refresh_paused: Refresh Paused
365
- refresh_paused_hint: Auto-refresh is paused. Add to playlist to start again.
366
- refresh_paused_mashup: Refreshing Mashups
367
- refresh_paused_mashup_hint: Auto-refresh paused for fullscreen. Mashups are updating.
366
+ refresh_paused: 已暫停更新
367
+ refresh_paused_hint: 自動更新已暫停,請加入至播放清單以重新開始。
368
+ refresh_paused_mashup: 只更新混搭畫面
369
+ refresh_paused_mashup_hint: 已暫停全螢幕的自動更新,混搭畫面(Mashup)仍會更新。
368
370
  visit_docs: 前往文件
369
371
  import:
370
372
  archive_too_large: ZIP檔案太大(最多%{max_mb} MB)
371
373
  missing_entry: ZIP檔案未包含「%{filename}」
372
- entry_too_large: 「%{filename}」太大
373
- malformed: 「%{filename}」格式不符
374
-
375
- # toast messages
374
+ entry_too_large: "「%{filename}」太大"
375
+ malformed: "「%{filename}」格式不符"
376
376
  create:
377
377
  success: 已新增外掛,並加入至你的
378
378
  playlist: 播放清單
@@ -383,7 +383,6 @@ zh-HK:
383
383
  success: 成功更新外掛設定
384
384
  add_to_playlist:
385
385
  success: 外掛已加入至播放清單
386
-
387
386
  referral_code:
388
387
  create:
389
388
  request_received: 已收到請求,請查看收件箱
@@ -391,9 +390,7 @@ zh-HK:
391
390
  index:
392
391
  title: 升級裝置:
393
392
  tagline: 解鎖自訂外掛及__更多__功能。
394
- pay: 付款 # button text; ex "Pay $20"
393
+ pay: 付款
395
394
  error: 裝置「%{device_name}」已經升級,請切換至另一部裝置
396
-
397
- # toast messages
398
395
  confirm:
399
396
  success: 已啟用開發者版本附加元件
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "cogger"
4
+ require "refinements"
5
+ require "yaml"
6
+
7
+ require_relative "value_reducer"
8
+
9
+ module TRMNL
10
+ module I18n
11
+ module Synchronization
12
+ # Copies new key/value pairs from the source locale (typically 'en') to destination locales.
13
+ class Processor
14
+ using Refinements::Hash
15
+
16
+ def initialize repository, reducer: ValueReducer, logger: Cogger.new(id: "trmnl-i18n")
17
+ @repository = repository
18
+ @reducer = reducer
19
+ @logger = logger
20
+ end
21
+
22
+ def call source_locale = "en"
23
+ repository.locales.each do |destination_locale|
24
+ log_info "Syncing #{repository.name}/#{destination_locale}..."
25
+
26
+ destination_root = repository.load destination_locale
27
+ result = add_missing_contents source_locale, destination_locale, destination_root
28
+
29
+ repository.save destination_locale, result
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ attr_reader :repository, :reducer, :logger
36
+
37
+ def log_info(message) = logger.info { message }
38
+
39
+ # :reek:FeatureEnvy
40
+ def add_missing_contents source_locale, destination_locale, destination_root
41
+ destination_contents = destination_root[destination_locale]
42
+ contents_to_merge = reduce source_locale, destination_locale
43
+ destination_root[destination_locale] = contents_to_merge.deep_merge destination_contents
44
+ destination_root
45
+ end
46
+
47
+ # :reek:ControlParameter
48
+ def reduce source_locale, destination_locale
49
+ repository.load(source_locale)[source_locale].then do |contents|
50
+ destination_locale == "raw" ? reducer.call(contents) : contents
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "refinements"
4
+ require "yaml"
5
+
6
+ module TRMNL
7
+ module I18n
8
+ module Synchronization
9
+ # Represents a directory containing YAML files named "{locale}.yml"
10
+ class Repo
11
+ using Refinements::Pathname
12
+
13
+ def self.all
14
+ Pathname(__dir__).join("../locales")
15
+ .directories
16
+ .map { |directory| new directory }
17
+ end
18
+
19
+ def initialize directory
20
+ @directory = Pathname directory
21
+ end
22
+
23
+ def name = directory.name.to_s
24
+
25
+ def load(locale) = YAML.load_file locale_path(locale)
26
+
27
+ def save locale, data
28
+ locale_path(locale).open "w" do |file|
29
+ Psych.dump data, file, indentation: 2, line_width: -1
30
+ end
31
+ end
32
+
33
+ def locales = directory.files("*.yml").map { |path| path.name.to_s }
34
+
35
+ private
36
+
37
+ attr_reader :directory
38
+
39
+ def locale_path(locale) = directory.join "#{locale}.yml"
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TRMNL
4
+ module I18n
5
+ module Synchronization
6
+ # Reduces a nested structure into key/value pairs with flattened values.
7
+ ValueReducer = lambda do |initial_value, path = ""|
8
+ case initial_value
9
+ when Array
10
+ initial_value.map.with_index do |item, index|
11
+ ValueReducer.call item, "#{path}[#{index}]"
12
+ end
13
+ when Hash
14
+ initial_value.each.with_object({}) do |(key, value), result|
15
+ next_path = path.empty? ? key : "#{path}.#{key}"
16
+ result[key] = ValueReducer.call value, next_path
17
+ end
18
+ else path
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
data/trmnl-i18n.gemspec CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "trmnl-i18n"
5
- spec.version = "0.1.0"
6
- spec.authors = ["Brooke Kuhlmann"]
7
- spec.email = ["brooke@alchemists.io"]
5
+ spec.version = "0.2.0"
6
+ spec.authors = ["TRMNL"]
7
+ spec.email = ["support@usetrmnl.com"]
8
8
  spec.homepage = "https://github.com/usetrmnl/trmnl-i18n"
9
9
  spec.summary = "A collection of TRMNL locales."
10
10
  spec.license = "MIT"
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trmnl-i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Brooke Kuhlmann
7
+ - TRMNL
8
8
  bindir: bin
9
9
  cert_chain:
10
10
  - |
11
11
  -----BEGIN CERTIFICATE-----
12
- MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQ8wDQYDVQQDDAZicm9v
12
+ MIIENjCCAp6gAwIBAgIBAjANBgkqhkiG9w0BAQsFADBBMQ8wDQYDVQQDDAZicm9v
13
13
  a2UxGjAYBgoJkiaJk/IsZAEZFgphbGNoZW1pc3RzMRIwEAYKCZImiZPyLGQBGRYC
14
- aW8wHhcNMjMwMzIyMTYxNDQxWhcNMjUwMzIxMTYxNDQxWjBBMQ8wDQYDVQQDDAZi
14
+ aW8wHhcNMjUwMzIyMTQ1NDE3WhcNMjYwMzIyMTQ1NDE3WjBBMQ8wDQYDVQQDDAZi
15
15
  cm9va2UxGjAYBgoJkiaJk/IsZAEZFgphbGNoZW1pc3RzMRIwEAYKCZImiZPyLGQB
16
16
  GRYCaW8wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCro8tj5/E1Hg88
17
17
  f4qfiwPVd2zJQHvdYt4GHVvuHRRgx4HGhJuNp+4BId08RBn7V6V1MW6MY3kezRBs
@@ -21,20 +21,19 @@ cert_chain:
21
21
  QzzPxZBiRB1sgtbt1gUbVI262ZDq1gR+HxPFmp+Cgt7ZLIJZAtesQvtcMzseXpfn
22
22
  hpmm0Sw22KGhRAy/mqHBRhDl5HqS1SJp2Ko3lcnpXeFResp0HNlt8NSu13vhC08j
23
23
  GUHU9MyIXbFOsnp3K3ADrAVjPWop8EZkmUR3MV/CUm00w2cZHCSGiXl1KMpiVKvk
24
- Ywr1gd2ZME4QLSo+EXUtLxDUa/W3xnBS8dBOuMMz02FPWYr3PN8CAwEAAaN7MHkw
24
+ Ywr1gd2ZME4QLSo+EXUtLxDUa/W3xnBS8dBOuMMz02FPWYr3PN8CAwEAAaM5MDcw
25
25
  CQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFAFgmv0tYMZnItuPycSM
26
- F5wykJEVMB8GA1UdEQQYMBaBFGJyb29rZUBhbGNoZW1pc3RzLmlvMB8GA1UdEgQY
27
- MBaBFGJyb29rZUBhbGNoZW1pc3RzLmlvMA0GCSqGSIb3DQEBCwUAA4IBgQAX+EGY
28
- 9RLYGxF1VLZz+G1ACQc4uyrCB6kXwI06kzUa5dF9tPXqTX9ffnz3/W8ck2IQhKzu
29
- MKO2FVijzbDWTsZeZGglS4E+4Jxpau1lU9HhOIcKolv6LeC6UdALTFudY+GLb8Xw
30
- REXgaJkjzzhkUSILmEnRwEbY08dVSl7ZAaxVI679vfI2yapLlIwpbBgmQTiTvPr3
31
- qyyLUno9flYEOv9fmGHunSrM+gE0/0niGTXa5GgXBXYGS2he4LQGgSBfGp/cTwMU
32
- rDKJRcusZ12lNBeDfgqACz/BBJF8FLodgk6rGMRZz7+ZmjjHEmpG5bQpR6Q2BuWL
33
- XMtYk/QzaWuhiR7pWjiF8jbdd7RO6or0ohq7iFkokz/5xrtQ/vPzU2RQ3Qc6YaKw
34
- 3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
35
- gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
26
+ F5wykJEVMA0GCSqGSIb3DQEBCwUAA4IBgQBlzRfyAYx/fCFjizS0Npxw4+4T3aYL
27
+ hbXoDqQRWjxuhFZcXUymhz3r8/Ltyri9lSof8grzB+8/+mrMVms7Gwt5qolk6zdn
28
+ FkySGy/jmpN12ldOHFbBEnyVBZNBvOBVb8zkkw8PhiHdBdXOUm4Jy39yJvBLfjcC
29
+ iM1aeWPmgPy1GbvZU+leRGZLt6dRIR9oCDXcWLRjha8xLMoz6Yn9fJBYexBA3iEz
30
+ h5S7pn4AX/JhVRiSyl8pAy4jEKydpyQrliH3gHkpNmUS/XDczP+9xX1bAB4BvqL2
31
+ NCxMcQ+hiJNqCKpPgHxaOOHZfIxV33logIuPEQ8NryHAwZ9ZWnwtYDE8kQGGKskI
32
+ Kkm6QT474hZl7MpwiJjWgW313CR7jUEekQahX1QxCxHPI7LSrKpno0plH3uWIOQp
33
+ KUlkb9uyACBgyRO52ZHiDVI8YvtU5O/j9pSes9/3XgvBeC1onx4qWp+uRX7eVsYS
34
+ GiijocTc3enZVrXERetaXj8/9XWs3fB3HWY=
36
35
  -----END CERTIFICATE-----
37
- date: 2025-02-27 00:00:00.000000000 Z
36
+ date: 1980-01-02 00:00:00.000000000 Z
38
37
  dependencies:
39
38
  - !ruby/object:Gem::Dependency
40
39
  name: railties
@@ -51,12 +50,12 @@ dependencies:
51
50
  - !ruby/object:Gem::Version
52
51
  version: '8.0'
53
52
  email:
54
- - brooke@alchemists.io
53
+ - support@usetrmnl.com
55
54
  executables: []
56
55
  extensions: []
57
56
  extra_rdoc_files:
58
- - README.adoc
59
57
  - LICENSE
58
+ - README.adoc
60
59
  files:
61
60
  - LICENSE
62
61
  - README.adoc
@@ -115,6 +114,9 @@ files:
115
114
  - lib/trmnl/i18n/locales/web_ui/zh-CN.yml
116
115
  - lib/trmnl/i18n/locales/web_ui/zh-HK.yml
117
116
  - lib/trmnl/i18n/railtie.rb
117
+ - lib/trmnl/i18n/synchronization/processor.rb
118
+ - lib/trmnl/i18n/synchronization/repo.rb
119
+ - lib/trmnl/i18n/synchronization/value_reducer.rb
118
120
  - trmnl-i18n.gemspec
119
121
  homepage: https://github.com/usetrmnl/trmnl-i18n
120
122
  licenses:
@@ -140,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
142
  - !ruby/object:Gem::Version
141
143
  version: '0'
142
144
  requirements: []
143
- rubygems_version: 3.6.5
145
+ rubygems_version: 3.6.7
144
146
  specification_version: 4
145
147
  summary: A collection of TRMNL locales.
146
148
  test_files: []
metadata.gz.sig CHANGED
Binary file