Troubleshooting Plural String Issues in Loco Translate
Content
Working with plural forms is a common source of confusion when translating WordPress themes and plugins with Loco Translate. Users often report that their plural strings aren't detected, appear incorrectly, or don't translate properly on the front end. This guide will help you understand and resolve the most common plural string issues.
Common Symptoms of Plural String Problems
- Plural forms not appearing in the translation interface after syncing
- Only the singular form is available for translation, missing the plural tab
- Translations work for singular but not plural quantities
- Incorrect variable placement in plural strings (e.g., %s vs %2$s)
- Unexpected strings appearing in translation files
Why These Issues Occur
Plural string extraction depends on several factors working correctly together:
- Proper POT File Generation: The template file must be correctly generated to include plural forms from functions like _n(), _nx(), and _n_noop().
- String Extraction Settings: Loco Translate must be configured to recognize pluralization functions used by your theme or plugin.
- Consistent Formatting: Placeholder variables (%s, %d, %2$s) must match exactly between source and translation strings.
- Language Configuration: The plural forms formula in the PO file header must match the language's grammatical rules.
Most Effective Solutions
1. Regenerate Your POT File
Many plural detection issues stem from incomplete POT files. As mentioned in Thread 2, recreating the POT file often resolves the problem:
- Use code scanning tools that properly extract plural forms
- Ensure your extraction tool recognizes _n, _nx, and related functions
- Verify the generated POT contains both singular and plural forms of each string
2. Configure Function Recognition
Loco Translate might not detect all pluralization functions by default. As noted in Thread 8, some functions like _nx() may need manual configuration:
- Navigate to Loco Translate → Settings → Advanced
- Add missing pluralization functions to the "Text Domain Functions" setting
- Common functions to add: _n, _nx, _n_noop, _nx_noop
- After adding functions, resync your translation files
3. Verify Plural Tab Usage
When translating strings with plural forms, you must use the Plural tab (Thread 5):
- Find your plural string in the translation list
- Click the "Plural" tab next to the "Singular" tab
- Enter the appropriate translations for each plural form
- Save your changes and clear any caching mechanisms
4. Check Placeholder Consistency
As highlighted in Threads 4 and 10, placeholder variables must match exactly:
- Ensure the number and order of %s, %d, %2$s placeholders match the original
- Watch for translation errors that might remove or alter placeholders
- Test with different quantities to ensure all placeholders work correctly
5. Validate Language Configuration
For languages with complex plural rules (Threads 7 and 12):
- Verify the "Plural-Forms" header in your PO file matches your language's requirements
- Consult language-specific guidelines for the correct plural formula
- Test with various numbers to ensure the correct form displays
When to Look Elsewhere
Some issues might originate outside Loco Translate:
- The original code might have syntax errors in translation functions (Thread 6)
- Dynamic text values in translation functions won't extract properly
- Conflicts between multiple translation functions using the same text
- Caching plugins might be serving old translations
By methodically working through these solutions, most plural string issues can be resolved. Start with regenerating your POT file and ensuring proper function recognition, as these address the most common problems reported by users.
Related Support Threads Support
-
[NSFW] Plural strings seem to be set wronghttps://wordpress.org/support/topic/plural-strings-seem-to-be-set-wrong/
-
Need instruction on how to add plural translationhttps://wordpress.org/support/topic/need-instruction-on-how-to-add-plural-translation/
-
Strange string and some Cities like Aïn Defla, Al Sharqiahttps://wordpress.org/support/topic/strange-string-and-some-cities-like-ain-defla-al-sharqia/
-
Variables in singular/plural strings seem to be set wronghttps://wordpress.org/support/topic/variables-in-singular-plural-strings-seem-to-be-set-wrong/
-
Adding plural translationshttps://wordpress.org/support/topic/adding-plural-translations/
-
Incorrect work with _n* functionshttps://wordpress.org/support/topic/incorrect-work-with-_n-functions/
-
Incorrect use of _n()https://wordpress.org/support/topic/incorrect-use-of-_n-3/
-
Plugin is not parsing _nx() string translationshttps://wordpress.org/support/topic/plugin-is-not-parsing-_nx-string-translations/
-
_n() not being picked up properly?!https://wordpress.org/support/topic/_n-not-being-picked-up-properly/
-
feature request: feedback on %s inconsistencies in translationshttps://wordpress.org/support/topic/feature-request-feedback-on-s-inconsistencies-in-translations/
-
Norwegian nb_NO / nn_NO problemhttps://wordpress.org/support/topic/norwegian-nb_no-nn_no-problem/
-
Plural-Forms conflicthttps://wordpress.org/support/topic/plural-forms-conflict/