fix double plurals with context

This commit is contained in:
myl7 2022-02-06 20:09:59 +08:00
parent c0353b5455
commit 04e333aa36
No known key found for this signature in database
GPG key ID: 04F1013B67177C88
5 changed files with 21 additions and 6 deletions

View file

@ -321,10 +321,13 @@ const FileListing: FC<{ query?: ParsedUrlQuery }> = ({ query }) => {
{!onlyOnePage && (
<div className="rounded-b bg-white dark:bg-gray-900 dark:text-gray-100">
<div className="border-b border-gray-200 p-3 text-center font-mono text-sm text-gray-400 dark:border-gray-700">
{t('- showing {{count}} page(s) of {{totalFileNum}} files -', {
{t('- showing {{count}} page(s) ', {
count: size,
totalFileNum: isLoadingMore ? '...' : folderChildren.length
})}
}) +
(isLoadingMore
? t('of {{count}} file(s) -', { count: folderChildren.length, context: 'loading' })
: t('of {{count}} file(s) -', { count: folderChildren.length, context: 'loaded' }))}
</div>
<button
className={`flex w-full items-center justify-center space-x-2 p-3 disabled:cursor-not-allowed ${

View file

@ -9,6 +9,7 @@ module.exports = {
keySeparator: false,
namespaceSeparator: false,
pluralSeparator: '——',
contextSeparator: '——',
lineEnding: 'lf',
locales: i18n.locales,
output: path.join(localePath, '$LOCALE/$NAMESPACE.json'),

View file

@ -5,5 +5,10 @@ module.exports = {
defaultLocale: 'en',
locales: ['en', 'zh-CN']
},
localePath: path.resolve('public/locales')
localePath: path.resolve('public/locales'),
reloadOnPrerender: process.env.NODE_ENV === 'development',
keySeparator: false,
namespaceSeparator: false,
pluralSeparator: '——',
contextSeparator: '——'
}

View file

@ -1,6 +1,6 @@
{
"- showing {{count}} page(s) of {{totalFileNum}} files -——one": "- showing {{count}} page of {{totalFileNum}} files -",
"- showing {{count}} page(s) of {{totalFileNum}} files -——other": "- showing {{count}} pages of {{totalFileNum}} files -",
"- showing {{count}} page(s) ——one": "- showing {{count}} page ",
"- showing {{count}} page(s) ——other": "- showing {{count}} pages ",
"{{count}} item(s)——one": "{{count}} item",
"{{count}} item(s)——other": "{{count}} items",
"Actions": "Actions",
@ -45,6 +45,10 @@
"Name": "Name",
"No more files": "No more files",
"Nothing here.": "Nothing here.",
"of {{count}} file(s) -——loaded——one": "of {{count}} file -",
"of {{count}} file(s) -——loaded——other": "of {{count}} files -",
"of {{count}} file(s) -——loading——one": "of ... file(s) -",
"of {{count}} file(s) -——loading——other": "of ... file(s) -",
"Oops, that&apos;s a <1>four-oh-four</1>.": "Oops, that&apos;s a <1>four-oh-four</1>.",
"Press <2>F12</2> and open devtools for more details, or seek help at <6>onedrive-vercel-index discussions</6>.": "Press <2>F12</2> and open devtools for more details, or seek help at <6>onedrive-vercel-index discussions</6>.",
"Search ...": "Search ...",

View file

@ -1,5 +1,5 @@
{
"- showing {{count}} page(s) of {{totalFileNum}} files -——other": "已显示 {{count}} ,共 {{totalFileNum}} 个文件",
"- showing {{count}} page(s) ——other": "已显示 {{count}} 页",
"{{count}} item(s)——other": "{{count}} 个项目",
"Actions": "操作",
"Cancel": "取消",
@ -43,6 +43,8 @@
"Name": "文件名",
"No more files": "加载完毕",
"Nothing here.": "无内容。",
"of {{count}} file(s) -——loaded——other": "共 {{count}} 个文件",
"of {{count}} file(s) -——loading——other": "共 ... 个文件",
"Oops, that&apos;s a <1>four-oh-four</1>.": "Oops这里是 <1>404</1> 页面。",
"Press <2>F12</2> and open devtools for more details, or seek help at <6>onedrive-vercel-index discussions</6>.": "请按下 <2>F12</2> 来打开开发者工具窗口以获取详细信息,或是到 <6>onedrive-vercel-index 社区讨论</6> 处寻求帮助。",
"Search ...": "搜索……",