Add custom pluralization rule for Vietnamese (#279)

This commit is contained in:
Riccardo Graziosi
2024-02-14 11:07:23 +01:00
committed by GitHub
parent 3910c85898
commit 1d5df21301
16 changed files with 30 additions and 35 deletions

View File

@@ -8,7 +8,7 @@ export const getLabel = (
attribute ? attribute ?
I18n.t(`activerecord.attributes.${entity}.${attribute}`) I18n.t(`activerecord.attributes.${entity}.${attribute}`)
: :
I18n.t(`activerecord.models.${entity}.one`) I18n.t(`activerecord.models.${entity}`, { count: 1 })
); );
export const getValidationMessage = ( export const getValidationMessage = (

View File

@@ -3,4 +3,6 @@ import I18n from "i18n-js"
I18n.translations = <%= I18n::JS.filtered_translations.to_json %> I18n.translations = <%= I18n::JS.filtered_translations.to_json %>
I18n.locale = LOCALE I18n.locale = LOCALE
I18n.pluralization["vi"] = function(count) { return ["other"] }
export default I18n export default I18n

View File

@@ -3,4 +3,9 @@ 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, :ru, :es, :vi]
I18n.default_locale = :en 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 :vi, i18n: { plural: { rule: lambda { |n| :other } } } # Vietnamese

View File

@@ -49,26 +49,19 @@ vi:
activerecord: activerecord:
models: models:
board: board:
one: 'Bảng' other: 'Bảng'
other: 'Các bảng'
comment: comment:
one: 'Bình luận' other: 'Bình luận'
other: 'Các bình luận'
like: like:
one: 'Phiếu bầu' other: 'Phiếu bầu'
other: 'Các phiếu bầu'
o_auth: o_auth:
one: 'Xác thực OAuth' other: 'Xác thực OAuth'
other: 'Các xác thực OAuth'
post_status: post_status:
one: 'Trạng thái' other: 'Trạng thái'
other: 'Các trạng thái'
post: post:
one: 'Bài viết' other: 'Bài viết'
other: 'Các bài viết'
user: user:
one: 'Người dùng' other: 'Người dùng'
other: 'Các người dùng'
attributes: attributes:
board: board:
name: 'Tên' name: 'Tên'
@@ -121,7 +114,7 @@ vi:
root_board_id: 'Trang gốc' root_board_id: 'Trang gốc'
show_roadmap_in_header: 'Hiển thị liên kết lộ trình trên tiêu đề' show_roadmap_in_header: 'Hiển thị liên kết lộ trình trên tiêu đề'
collapse_boards_in_header: 'Thu gọn các bảng trong tiêu đề' collapse_boards_in_header: 'Thu gọn các bảng trong tiêu đề'
custom_css: 'Custom CSS' custom_css: 'Tùy chỉnh CSS'
user: user:
email: 'Email' email: 'Email'
full_name: 'Họ và tên' full_name: 'Họ và tên'
@@ -136,4 +129,4 @@ vi:
blank: 'không thể để trống' blank: 'không thể để trống'
taken: 'đã tồn tại' taken: 'đã tồn tại'
too_short: 'quá ngắn (ít nhất %{count} ký tự)' too_short: 'quá ngắn (ít nhất %{count} ký tự)'
too_long: 'quá dài (tối đa %{count} ký tự)' too_long: 'quá dài (tối đa %{count} ký tự)'

View File

@@ -69,7 +69,7 @@ de:
page_title: 'Deinen Feedback-Bereich erstellen' page_title: 'Deinen Feedback-Bereich erstellen'
step1: step1:
title: '1. Benutzerkonto erstellen' title: '1. Benutzerkonto erstellen'
email_auth: 'Sign up with email' email_auth: 'Mit E-Mail registrieren'
step2: step2:
title: '2. Feedbackbereich erstellen' title: '2. Feedbackbereich erstellen'
create_button: 'Feedbackbereich erstellen' create_button: 'Feedbackbereich erstellen'

View File

@@ -59,5 +59,4 @@ vi:
not_found: "không tìm thấy" not_found: "không tìm thấy"
not_locked: "không bị khóa" not_locked: "không bị khóa"
not_saved: not_saved:
one: "1 lỗi đã ngăn %{resource} này khỏi việc lưu:" other: "%{count} lỗi đã ngăn %{resource} này khỏi việc lưu:"
other: "%{count} lỗi đã ngăn %{resource} này khỏi việc lưu:"

View File

@@ -69,7 +69,7 @@ es:
page_title: 'Create your feedback space' page_title: 'Create your feedback space'
step1: step1:
title: '1. Create user account' title: '1. Create user account'
email_auth: 'Sign up with email' email_auth: 'Registrar con e-mail'
step2: step2:
title: '2. Create feedback space' title: '2. Create feedback space'
create_button: 'Create feedback space' create_button: 'Create feedback space'

View File

@@ -69,7 +69,7 @@ fr:
page_title: 'Créez votre espace de feedback' page_title: 'Créez votre espace de feedback'
step1: step1:
title: '1. Créer un compte utilisateur' title: '1. Créer un compte utilisateur'
email_auth: 'S''inscrire par e-mail' email_auth: 'S´inscrire avec une adresse e-mail'
step2: step2:
title: '2. Créer un espace de feedback' title: '2. Créer un espace de feedback'
create_button: 'Créer un espace de feedback' create_button: 'Créer un espace de feedback'

View File

@@ -69,7 +69,7 @@ it:
page_title: 'Crea il tuo spazio di feedback' page_title: 'Crea il tuo spazio di feedback'
step1: step1:
title: '1. Crea account utente' title: '1. Crea account utente'
email_auth: 'Sign up with email' email_auth: 'Registrati con indirizzo email'
step2: step2:
title: '2. Crea spazio di feedback' title: '2. Crea spazio di feedback'
create_button: 'Crea spazio feedback' create_button: 'Crea spazio feedback'

View File

@@ -65,7 +65,7 @@ ja:
page_title: 'Create your feedback space' page_title: 'Create your feedback space'
step1: step1:
title: '1. Create user account' title: '1. Create user account'
email_auth: 'Sign up with email' email_auth: 'Register with email'
step2: step2:
title: '2. Create feedback space' title: '2. Create feedback space'
create_button: 'Create feedback space' create_button: 'Create feedback space'

View File

@@ -65,7 +65,7 @@ ko:
page_title: 'Create your feedback space' page_title: 'Create your feedback space'
step1: step1:
title: '1. Create user account' title: '1. Create user account'
email_auth: 'Sign up with email' email_auth: 'Register with email'
step2: step2:
title: '2. Create feedback space' title: '2. Create feedback space'
create_button: 'Create feedback space' create_button: 'Create feedback space'

View File

@@ -69,7 +69,7 @@ nl:
page_title: 'Create your feedback space' page_title: 'Create your feedback space'
step1: step1:
title: '1. Create user account' title: '1. Create user account'
email_auth: 'Sign up with email' email_auth: 'Register with email'
step2: step2:
title: '2. Create feedback space' title: '2. Create feedback space'
create_button: 'Create feedback space' create_button: 'Create feedback space'

View File

@@ -69,7 +69,7 @@ pt:
page_title: 'Crie seu espaço de comentário' page_title: 'Crie seu espaço de comentário'
step1: step1:
title: 'Criar conta de usuário' title: 'Criar conta de usuário'
email_auth: 'Sign up with email' email_auth: 'Cadastrar com e-mail'
step2: step2:
title: '2. Criar espaço de feedback' title: '2. Criar espaço de feedback'
create_button: 'Criar espaço de feedback' create_button: 'Criar espaço de feedback'

View File

@@ -77,7 +77,7 @@ ru:
page_title: 'Создайте область обратной связи' page_title: 'Создайте область обратной связи'
step1: step1:
title: '1. Создание учетной записи пользователя' title: '1. Создание учетной записи пользователя'
email_auth: 'Sign up with email' email_auth: 'Регистрация по электронной почте'
step2: step2:
title: '2. Создать область обратной связи' title: '2. Создать область обратной связи'
create_button: 'Создать область обратной связи' create_button: 'Создать область обратной связи'

View File

@@ -34,7 +34,6 @@ vi:
change_password: 'Đổi mật khẩu' change_password: 'Đổi mật khẩu'
password_help: 'Ít nhất %{count} ký từ' password_help: 'Ít nhất %{count} ký từ'
comments_number: comments_number:
one: '1 bình luận'
other: '%{count} bình luận' other: '%{count} bình luận'
no_status: 'Không có trạng thái' no_status: 'Không có trạng thái'
loading: 'Đang tải...' loading: 'Đang tải...'
@@ -57,13 +56,10 @@ vi:
datetime: datetime:
now: 'Vừa xong' now: 'Vừa xong'
minutes: minutes:
one: '1 phút trước'
other: '%{count} phút trước' other: '%{count} phút trước'
hours: hours:
one: '1 giờ trước'
other: '%{count} giờ trước' other: '%{count} giờ trước'
days: days:
one: '1 ngày trước'
other: '%{count} ngày trước' other: '%{count} ngày trước'
signup: signup:
page_title: 'Tạo không gian phản hồi của bạn' page_title: 'Tạo không gian phản hồi của bạn'
@@ -222,4 +218,4 @@ vi:
title_edit: 'Chỉnh sửa OAuth Provider' title_edit: 'Chỉnh sửa OAuth Provider'
subtitle_oauth_config: 'Cấu hình OAuth' subtitle_oauth_config: 'Cấu hình OAuth'
subtitle_user_profile_config: 'Cấu hình Thông tin người dùng' subtitle_user_profile_config: 'Cấu hình Thông tin người dùng'
client_secret_help: 'đã ẩn vì mục đích bảo mật' client_secret_help: 'đã ẩn vì mục đích bảo mật'

View File

@@ -65,7 +65,7 @@ zh-CN:
page_title: 'Create your feedback space' page_title: 'Create your feedback space'
step1: step1:
title: '1. Create user account' title: '1. Create user account'
email_auth: 'Sign up with email' email_auth: 'Register with email'
step2: step2:
title: '2. Create feedback space' title: '2. Create feedback space'
create_button: 'Create feedback space' create_button: 'Create feedback space'