From 437262040a1a635f227ce44796f327b8eb43e20a Mon Sep 17 00:00:00 2001
From: Riccardo Graziosi <31478034+riggraz@users.noreply.github.com>
Date: Fri, 15 Mar 2024 00:14:31 +0100
Subject: [PATCH] =?UTF-8?q?Add=20=F0=9F=87=A8=F0=9F=87=B3=20Chinese=20simp?=
=?UTF-8?q?lified=20(#310)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Thanks to omltcat for the translation!
---
.../components/SiteSettings/General/GeneralSiteSettingsP.tsx | 1 +
app/javascript/translations/index.js.erb | 1 +
config/initializers/locale.rb | 3 ++-
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/app/javascript/components/SiteSettings/General/GeneralSiteSettingsP.tsx b/app/javascript/components/SiteSettings/General/GeneralSiteSettingsP.tsx
index 60ed6963..0a972438 100644
--- a/app/javascript/components/SiteSettings/General/GeneralSiteSettingsP.tsx
+++ b/app/javascript/components/SiteSettings/General/GeneralSiteSettingsP.tsx
@@ -162,6 +162,7 @@ const GeneralSiteSettingsP = ({
+
diff --git a/app/javascript/translations/index.js.erb b/app/javascript/translations/index.js.erb
index 24d457bc..30e94502 100644
--- a/app/javascript/translations/index.js.erb
+++ b/app/javascript/translations/index.js.erb
@@ -3,6 +3,7 @@ import I18n from "i18n-js"
I18n.translations = <%= I18n::JS.filtered_translations.to_json %>
I18n.locale = LOCALE
+I18n.pluralization["zh-CN"] = function(count) { return ["other"] }
I18n.pluralization["vi"] = function(count) { return ["other"] }
export default I18n
\ No newline at end of file
diff --git a/config/initializers/locale.rb b/config/initializers/locale.rb
index 988f9289..15e057df 100644
--- a/config/initializers/locale.rb
+++ b/config/initializers/locale.rb
@@ -1,11 +1,12 @@
# Configure I18n to look at subfolders too
I18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.yml')]
-I18n.available_locales = [:en, :it, :de, :fr, :ru, :es, :vi]
+I18n.available_locales = [:en, :it, :de, :fr, :es, 'zh-CN', :ru, :vi]
I18n.default_locale = :en
# Custom pluralization rules
# Those must be mirrored in app/javascript/translations/index.js.erb
I18n::Backend::Simple.include(I18n::Backend::Pluralization)
+I18n.backend.store_translations 'zh-CN', i18n: { plural: { rule: lambda { |n| :other } } } # Chinese simplified
I18n.backend.store_translations :vi, i18n: { plural: { rule: lambda { |n| :other } } } # Vietnamese
\ No newline at end of file