From 59ff26bd8636c4429b93306225c90cc556bdfa2d Mon Sep 17 00:00:00 2001 From: bugy Date: Sun, 4 Feb 2018 20:46:50 +0100 Subject: [PATCH] #116: fixed wrong years name for russian locale --- .../net/buggy/shoplist/model/ModelHelper.java | 20 ++++++++++++++----- SheLi/src/main/res/values-ru/strings.xml | 6 +++++- SheLi/src/main/res/values/strings.xml | 5 ++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/SheLi/src/main/java/net/buggy/shoplist/model/ModelHelper.java b/SheLi/src/main/java/net/buggy/shoplist/model/ModelHelper.java index b1cf0c8..65fb047 100644 --- a/SheLi/src/main/java/net/buggy/shoplist/model/ModelHelper.java +++ b/SheLi/src/main/java/net/buggy/shoplist/model/ModelHelper.java @@ -89,7 +89,11 @@ public static Category createCategory(String name) { category.setName(name); final Random random = new Random(); - final int color = Color.argb(255, random.nextInt(256), random.nextInt(256), random.nextInt(256)); + final int color = Color.argb( + 255, + random.nextInt(256), + random.nextInt(256), + random.nextInt(256)); category.setColor(color); return category; @@ -139,7 +143,8 @@ public static String getAgeText(Date date, Context context) { int yearsRounded = (int) Math.round(daysDiff / 365); if (yearsRounded <= 5) { - return context.getString(R.string.years_ago, String.valueOf(yearsRounded)); + return context.getResources().getQuantityString( + R.plurals.years_ago, yearsRounded, yearsRounded); } return context.getString(R.string.long_ago); @@ -196,9 +201,14 @@ public static Map mapIds(Collection entities) { @NonNull public static EntitySynchronizationRecord createSyncRecord( - Long internalId, String externalId, String listId, Date modificationDate, Class entityClass) { - - final EntitySynchronizationRecord synchronizationRecord = new EntitySynchronizationRecord<>(); + Long internalId, + String externalId, + String listId, + Date modificationDate, + Class entityClass) { + + final EntitySynchronizationRecord synchronizationRecord = + new EntitySynchronizationRecord<>(); synchronizationRecord.setLastChangeDate(modificationDate); synchronizationRecord.setInternalId(internalId); synchronizationRecord.setExternalId(externalId); diff --git a/SheLi/src/main/res/values-ru/strings.xml b/SheLi/src/main/res/values-ru/strings.xml index 0e0ed65..be96eac 100644 --- a/SheLi/src/main/res/values-ru/strings.xml +++ b/SheLi/src/main/res/values-ru/strings.xml @@ -110,7 +110,11 @@ %sд назад %sн назад %sм назад - %sл назад + + %dг назад + %dг назад + %dл назад + очень давно All Удалить из списка покупок? diff --git a/SheLi/src/main/res/values/strings.xml b/SheLi/src/main/res/values/strings.xml index 2136dff..f0f179e 100644 --- a/SheLi/src/main/res/values/strings.xml +++ b/SheLi/src/main/res/values/strings.xml @@ -108,7 +108,10 @@ %sd ago %sw ago %sm ago - %sy ago + + %dy ago + %dy ago + long ago All English