The application uses only Russian localization. All strings are in values/strings.xml . Including such a plural:

 <plurals name="days_left"> <item quantity="one">Остался %d день</item> <item quantity="few">Осталось %d дня</item> <item quantity="many">Осталось %d дней</item> </plurals> 

If you install on the phone, for example, English, then the plural rules for the Russian language are not applied and are used that are inherent in the established language. Specifically, in this case, few do not work, and for 2, 3, 4, an expression from many substituted: 2 days left

Is it possible to forcibly use the required locale for the plural rules? As, for example, this is done in String.format(Locale l, String format, Object... args)

    2 answers 2

    Starting with Api 17, you can get resources for a specific locale:

     @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public Resources getResourcesByLocale() { Configuration configuration = new Configuration(getResources().getConfiguration()); configuration.setLocale(new Locale("ru")); return createConfigurationContext(configuration).getResources(); } 

    And accordingly, then from these localized resources pull out plurals:

     for (int i = 1; i < 10; i++) { String daysLeft = getResourcesByLocale().getQuantityString(R.plurals.days_left, i, i); Log.i("Plurals", daysLeft); } 

      Try to set the locale forcibly to Russian at the application level, something like this :

       public class MyApplication extends Application { @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); newConfig.locale = new Locale("ru"); Locale.setDefault(new Locale("ru")); getBaseContext().getResources().updateConfiguration(newConfig, getBaseContext().getResources().getDisplayMetrics()); } @Override public void onCreate() { super.onCreate(); Locale.setDefault(new Locale("ru")); config.locale = new Locale("ru"); getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics()); } }