Add class for translation of dynamic elements: number of notes, reviews, etc.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- php
- Lĩnh vực
- internationalization, localization
Hướng nghiên cứu
Bắt đầu bằng cách đọc cuộc thảo luận trong php/web-php#1057 và các ví dụ onlinephp.io được liên kết. Xác định cách các số đếm động hiện được hiển thị và những ngôn ngữ nào cần quy tắc số nhiều. Công việc được xem là hoàn thành khi có thiết kế đã được thống nhất và phần triển khai để định dạng số đếm theo từng ngôn ngữ, chẳng hạn như số ghi chú, bài đánh giá và lượt upvote.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Base on: https://github.com/php/web-php/pull/1057#discussion_r1748003699
I suggest add methods for different languages to form on doc-site correct plurals for different dynamic elements: the total note count, the number of upvotes, etc.
Maybe something like this:
Contributors from each country will only have to implement their plural method and call in the code:
<?php
$num_notes = 1;
echo NumberBaseDeclinsion::decline($num_notes, ['note', 'notes',], 'en',); // 1 note
echo NumberBaseDeclinsion::decline($num_notes, ['заметка', 'заметки', 'заметок',], 'ru',); // 1 заметка
$num_notes = 2;
echo NumberBaseDeclinsion::decline($num_notes, ['note', 'notes',], 'en',); // 2 notes
echo NumberBaseDeclinsion::decline($num_notes, ['заметка', 'заметки', 'заметок',], 'ru',); // 2 заметки
$num_notes = 5;
echo NumberBaseDeclinsion::decline($num_notes, ['note', 'notes',], 'en',); // 5 notes
echo NumberBaseDeclinsion::decline($num_notes, ['заметка', 'заметки', 'заметок',], 'ru',); // 5 заметок
// Phrase
echo NumberBaseDeclinsion::decline(38, ['pink flamingo', 'pink flamingos',], 'en',); // 38 pink flamingos
echo NumberBaseDeclinsion::decline(38, ['розовый фламинго', 'розовых фламинго', 'розовых фламинго',], 'ru',); // 38 розовых фламинго
// And if you want the text not to break between the number and the next word, you can add an unbreakable space:
echo NumberBaseDeclinsion::decline(8, ['comment', 'comments',], 'en', ' ',); // 8 comments
More examples can be found at the link.
In particular, if you translate the total number of notes of the contribution notes, then for the Russian language you will need 1 singular form + 2 plural forms. And for English, only two forms are enough. Therefore, a separate method (or function, if it is decided to write in a functional style) will be required for each language, which will form the correct string with a number for its language
- Ngôn ngữ chính
- PHP
- Star
- 1.1k
- Fork
- 641
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 19
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của php/web-php
-
Bug Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Page: downloads
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
Page: downloads
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
-
Bug Status: Needs Triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Issue tương tự
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Automattic/safe-publish#594 ·
-
needs-triage Platform(Default)
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
HttpClient
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
symfony/symfony-docs#23092 ·
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100