AdvancedCustomFields / AdvancedCustomFields/acf

Proper Pluralization

Open
#262 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Hi @elliotcondon

I just wanted to flag that the use of '1' in plural i18n functions like _n() shouldn't be used and instead the placeholder is more appropriate. This is mostly due to Arabic, Russian and other multi-plural languages as often the singular doesn't indicate 1 (in Arabic it's 0, and in Russian it's 1, 21, 31, etc)

From the Plugin Handbook;
"singular – the singular form of the string (note that it can be used for numbers other than one in some languages, so '%s item' should be used instead of 'One item')"
https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#plurals

Example of this on translate.wp.org for your plugin;
Arabic - https://translate.wordpress.org/projects/wp-plugins/advanced-custom-fields/stable/ar/default/?filters%5Boriginal_id%5D=7728762
Russian - https://translate.wordpress.org/projects/wp-plugins/advanced-custom-fields/stable/ru/default/?filters%5Boriginal_id%5D=7728762

A couple of instances I see in the github repo for the plugin;
https://github.com/AdvancedCustomFields/acf/blob/20a0aaa6a8f40e62ca0bc35ebae07415ca8bcfde/includes/admin/tools/class-acf-admin-tool-import.php#L138
https://github.com/AdvancedCustomFields/acf/blob/f7061f75ddd36b3b11c11083596ac8125be2e5dd/includes/admin/tools/class-acf-admin-tool-export.php#L174
*These following ones don't use 1 explicitly but they don't provide the %s placeholder.
https://github.com/AdvancedCustomFields/acf/blob/20a0aaa6a8f40e62ca0bc35ebae07415ca8bcfde/includes/admin/admin-field-groups.php#L156
https://github.com/AdvancedCustomFields/acf/blob/20a0aaa6a8f40e62ca0bc35ebae07415ca8bcfde/includes/admin/admin-field-groups.php#L243

Also note while looking through the plugin I found the acf._n JS function here;
https://github.com/AdvancedCustomFields/acf/blob/482b8284a54df284d5bd84cb95ed3cc6ce2df763/assets/js/acf-input.js#L644
*This function switches singular/plural depending if the number == 1 which doesn't support languages like Arabic/Russian.

All the best,
Cheers

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with includes/admin/tools/class-acf-admin-tool-import.php, includes/admin/tools/class-acf-admin-tool-export.php, and the two locations in includes/admin/admin-field-groups.php cited in the issue. Then inspect acf._n in assets/js/acf-input.js; review the listed pluralization calls and verify that PHP and JavaScript handling supports placeholders and the plural rules described for Arabic and Russian.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
internationalization, localization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.