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 ?
I18n.t(`activerecord.attributes.${entity}.${attribute}`)
:
I18n.t(`activerecord.models.${entity}.one`)
I18n.t(`activerecord.models.${entity}`, { count: 1 })
);
export const getValidationMessage = (

View File

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

View File

@@ -4,3 +4,8 @@ I18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.yml')]
I18n.available_locales = [:en, :it, :de, :fr, :ru, :es, :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 :vi, i18n: { plural: { rule: lambda { |n| :other } } } # Vietnamese

View File

@@ -49,26 +49,19 @@ vi:
activerecord:
models:
board:
one: 'Bảng'
other: 'Các bảng'
other: 'Bảng'
comment:
one: 'Bình luận'
other: 'Các bình luận'
other: 'Bình luận'
like:
one: 'Phiếu bầu'
other: 'Các phiếu bầu'
other: 'Phiếu bầu'
o_auth:
one: 'Xác thực OAuth'
other: 'Các xác thực OAuth'
other: 'Xác thực OAuth'
post_status:
one: 'Trạng thái'
other: 'Các trạng thái'
other: 'Trạng thái'
post:
one: 'Bài viết'
other: 'Các bài viết'
other: 'Bài viết'
user:
one: 'Người dùng'
other: 'Các người dùng'
other: 'Người dùng'
attributes:
board:
name: 'Tên'
@@ -121,7 +114,7 @@ vi:
root_board_id: 'Trang gốc'
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 đề'
custom_css: 'Custom CSS'
custom_css: 'Tùy chỉnh CSS'
user:
email: 'Email'
full_name: 'Họ và tên'

View File

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

View File

@@ -59,5 +59,4 @@ vi:
not_found: "không tìm thấy"
not_locked: "không bị khóa"
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:"

View File

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

View File

@@ -69,7 +69,7 @@ fr:
page_title: 'Créez votre espace de feedback'
step1:
title: '1. Créer un compte utilisateur'
email_auth: 'S''inscrire par e-mail'
email_auth: 'S´inscrire avec une adresse e-mail'
step2:
title: '2. 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'
step1:
title: '1. Crea account utente'
email_auth: 'Sign up with email'
email_auth: 'Registrati con indirizzo email'
step2:
title: '2. Crea spazio di feedback'
create_button: 'Crea spazio feedback'

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -34,7 +34,6 @@ vi:
change_password: 'Đổi mật khẩu'
password_help: 'Ít nhất %{count} ký từ'
comments_number:
one: '1 bình luận'
other: '%{count} bình luận'
no_status: 'Không có trạng thái'
loading: 'Đang tải...'
@@ -57,13 +56,10 @@ vi:
datetime:
now: 'Vừa xong'
minutes:
one: '1 phút trước'
other: '%{count} phút trước'
hours:
one: '1 giờ trước'
other: '%{count} giờ trước'
days:
one: '1 ngày trước'
other: '%{count} ngày trước'
signup:
page_title: 'Tạo không gian phản hồi của bạn'

View File

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