[android][strings] Change bookmarks-related translations

For bookmarks and tracks categories wording of items count was changed.
Previous logic:
- 5 tracks and 5 bookmarks: "10 objects".

New logic:
- 5 tracks and 5 bookmarks: "5 tracks, 5 places".

Needs for: organicmaps#4218

Signed-off-by: Ilya Charkas <tscherkas.it@gmail.com>
Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Ilya Charkas 2023-04-28 19:48:44 +03:00 committed by Alexander Borsuk
parent 57dd866d90
commit d43db4c34a
9 changed files with 160 additions and 145 deletions

View file

@ -676,7 +676,7 @@
<activity
android:name="app.organicmaps.bookmarks.BookmarkCategoriesActivity"
android:configChanges="orientation|screenLayout|screenSize"
android:label="@string/bookmarks"
android:label="@string/bookmarks_and_tracks"
android:parentActivityName="app.organicmaps.MwmActivity"
android:windowSoftInputMode="adjustResize" />

View file

@ -122,9 +122,9 @@ public class BookmarkCategoriesAdapter extends BaseBookmarkCategoryAdapter<Recyc
{
final BookmarkCategory category = getCategoryByPosition(toCategoryPosition(position));
CategoryViewHolder categoryHolder = (CategoryViewHolder) holder;
categoryHolder.setCategory(category);
categoryHolder.setEntity(category);
categoryHolder.setName(category.getName());
bindSize(categoryHolder, category);
categoryHolder.setSize();
categoryHolder.setVisibilityState(category.isVisible());
ToggleVisibilityClickListener visibilityListener = new ToggleVisibilityClickListener(categoryHolder);
categoryHolder.setVisibilityListener(visibilityListener);
@ -151,13 +151,6 @@ public class BookmarkCategoriesAdapter extends BaseBookmarkCategoryAdapter<Recyc
}
}
private void bindSize(@NonNull CategoryViewHolder categoryHolder,
@NonNull BookmarkCategory category)
{
BookmarkCategory.CountAndPlurals template = category.getPluralsCountTemplate();
categoryHolder.setSize(template.getPlurals(), template.getCount());
}
@Override
public int getItemViewType(int position)
{

View file

@ -177,7 +177,7 @@ public class BookmarkCollectionAdapter extends RecyclerView.Adapter<RecyclerView
Holders.CollectionViewHolder collectionViewHolder = (Holders.CollectionViewHolder) holder;
collectionViewHolder.setEntity(category);
collectionViewHolder.setName(category.getName());
bindSize(collectionViewHolder, category);
collectionViewHolder.setSize();
collectionViewHolder.setVisibilityState(category.isVisible());
collectionViewHolder.setOnClickListener(mClickListener);
ToggleVisibilityClickListener listener = new ToggleVisibilityClickListener(collectionViewHolder);
@ -185,12 +185,6 @@ public class BookmarkCollectionAdapter extends RecyclerView.Adapter<RecyclerView
updateVisibility(collectionViewHolder.itemView);
}
private void bindSize(Holders.CollectionViewHolder holder, BookmarkCategory category)
{
BookmarkCategory.CountAndPlurals template = category.getPluralsCountTemplate();
holder.setSize(template.getPlurals(), template.getCount());
}
private void bindHeaderHolder(@NonNull RecyclerView.ViewHolder holder, int nextSectionPosition)
{
Holders.HeaderViewHolder headerViewHolder = (Holders.HeaderViewHolder) holder;

View file

@ -1,8 +1,8 @@
package app.organicmaps.bookmarks;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
import android.view.View;
@ -161,7 +161,71 @@ public class Holders
}
}
static class CollectionViewHolder extends RecyclerView.ViewHolder
static class CategoryViewHolderBase extends RecyclerView.ViewHolder
{
@Nullable
protected BookmarkCategory mEntity;
@NonNull
protected final TextView mSize;
public CategoryViewHolderBase(@NonNull View root)
{
super(root);
mSize = root.findViewById(R.id.size);
}
protected void setSize()
{
if (mEntity == null)
return;
mSize.setText(getSizeString());
}
private String getSizeString()
{
final Resources resources = mSize.getResources();
final int bookmarksCount = mEntity.getBookmarksCount();
final int tracksCount = mEntity.getTracksCount();
if (mEntity.size() == 0)
return getQuantified(resources, R.plurals.objects, 0);
if (bookmarksCount > 0 && tracksCount > 0)
{
final String bookmarks = getQuantified(resources, R.plurals.places, bookmarksCount);
final String tracks = getQuantified(resources, R.plurals.tracks, tracksCount);
final String template = resources.getString(R.string.comma_separated_pair);
return String.format(template, bookmarks, tracks);
}
if (bookmarksCount > 0)
return getQuantified(resources, R.plurals.places, bookmarksCount);
return getQuantified(resources, R.plurals.tracks, tracksCount);
}
void setEntity(@NonNull BookmarkCategory entity)
{
mEntity = entity;
}
@NonNull
public BookmarkCategory getEntity()
{
if (mEntity == null)
throw new AssertionError("BookmarkCategory is null");
return mEntity;
}
private String getQuantified(Resources resources, @PluralsRes int plural, int size)
{
return resources.getQuantityString(plural, size, size);
}
}
static class CollectionViewHolder extends CategoryViewHolderBase
{
@NonNull
private final View mView;
@ -169,10 +233,6 @@ public class Holders
private final TextView mName;
@NonNull
private final CheckBox mVisibilityMarker;
@NonNull
private final TextView mSize;
@Nullable
private BookmarkCategory mEntity;
CollectionViewHolder(@NonNull View root)
{
@ -180,7 +240,6 @@ public class Holders
mView = root;
mName = root.findViewById(R.id.name);
mVisibilityMarker = root.findViewById(R.id.checkbox);
mSize = root.findViewById(R.id.size);
}
void setOnClickListener(@Nullable OnItemClickListener<BookmarkCategory> listener)
@ -205,27 +264,9 @@ public class Holders
{
mName.setText(name);
}
void setSize(@PluralsRes int phrase, int size)
{
mSize.setText(mSize.getResources().getQuantityString(phrase, size, size));
}
void setEntity(@NonNull BookmarkCategory entity)
{
mEntity = entity;
}
@NonNull
public BookmarkCategory getEntity()
{
if (mEntity == null)
throw new AssertionError("BookmarkCategory is null");
return mEntity;
}
}
static class CategoryViewHolder extends RecyclerView.ViewHolder
static class CategoryViewHolder extends CategoryViewHolderBase
{
@NonNull
private final TextView mName;
@ -233,10 +274,6 @@ public class Holders
CheckBox mVisibilityMarker;
@NonNull
ImageView mMoreButton;
@NonNull
TextView mSize;
@Nullable
private BookmarkCategory mEntity;
CategoryViewHolder(@NonNull View root)
{
@ -247,7 +284,6 @@ public class Holders
int left = root.getResources().getDimensionPixelOffset(R.dimen.margin_half_plus);
int right = root.getResources().getDimensionPixelOffset(R.dimen.margin_base_plus);
UiUtils.expandTouchAreaForView(mVisibilityMarker, 0, left, 0, right);
mSize = root.findViewById(R.id.size);
}
void setVisibilityState(boolean visible)
@ -269,24 +305,6 @@ public class Holders
{
mName.setText(name);
}
void setSize(@PluralsRes int phrase, int size)
{
mSize.setText(mSize.getResources().getQuantityString(phrase, size, size));
}
void setCategory(@NonNull BookmarkCategory entity)
{
mEntity = entity;
}
@NonNull
public BookmarkCategory getEntity()
{
if (mEntity == null)
throw new AssertionError("BookmarkCategory is null");
return mEntity;
}
}
static abstract class BaseBookmarkHolder extends RecyclerView.ViewHolder

View file

@ -99,42 +99,6 @@ public class BookmarkCategory implements Parcelable
return mDescription;
}
@NonNull
public CountAndPlurals getPluralsCountTemplate()
{
if (size() == 0)
return new CountAndPlurals(0, R.plurals.objects);
if (getBookmarksCount() == 0)
return new CountAndPlurals(getTracksCount(), R.plurals.tracks);
if (getTracksCount() == 0)
return new CountAndPlurals(getBookmarksCount(), R.plurals.places);
return new CountAndPlurals(size(), R.plurals.objects);
}
public static class CountAndPlurals {
private final int mCount;
@PluralsRes
private final int mPlurals;
public CountAndPlurals(int count, int plurals)
{
mCount = count;
mPlurals = plurals;
}
public int getCount()
{
return mCount;
}
public int getPlurals()
{
return mPlurals;
}
}
@Override
public String toString()
{

View file

@ -1856,7 +1856,7 @@
zh-Hant = 收藏夾
[bookmarks]
comment = "Bookmarks" dialog title, please also edit it in iphone/plist.txt
comment = Should be used in the bookmarks-only context, see bookmarks_and_tracks if tracks are also implied.
tags = android,ios
en = Bookmarks
ar = الإشارات المرجعية
@ -1897,6 +1897,47 @@
zh-Hans = 书签
zh-Hant = 書籤
[bookmarks_and_tracks]
comment = "Bookmarks and Tracks" dialog title, also sync it with iphone/plist.txt
tags = android,ios
en = Bookmarks and Tracks
ar = الإشارات المرجعية والمسارات
be = Закладкі i cцежкі
bg = Отметки и пътеки
ca = Marcadors i traces
cs = Záložky a stopy
da = Bogmærker og ruter
de = Lesezeichen und Strecken
el = Αγαπημένα και διαδρομές
es = Marcadores y rutas
et = Järjehoidjad ja rajad
eu = Markagailuak eta ibilbideak
fa = نشانه‌ها و مسیر
fi = Kirjanmerkit ja reitit
fr = Signets et parcours
he = רשימות אתרים ונתיבים
hu = Könyvjelzők és nyomvonalak
id = Penanda dan jalur
it = Luoghi preferiti e percorsi
ja = ブックマークとトラック
ko = 북마크 및 트랙
mr = खूणपत्रे आणि ट्रॅक
nb = Bokmerker og ruter
nl = Bladwijzers en tracks
pl = Zakładki i trasy
pt = Favoritos e trilhas
pt-BR = Favoritos e trilhas
ro = Locuri preferate și trasee
ru = Метки и треки
sk = Záložky a stopy
sv = Bokmärken och rutter
th = บุ๊กมาร์กและการติดตาม
tr = Yer İmleri ve kayıtlar
uk = Мітки та маршрути
vi = Đánh dấu và dấu vết
zh-Hans = 书签和轨迹
zh-Hant = 書籤和軌跡
[core_my_places]
comment = Default bookmark list name
tags = android,ios
@ -19902,7 +19943,7 @@
fa:one = %d رد
fa:other = %d رد
fi = %d radat
fr = pistes %d
fr = %d pistes
hu = %d út
id = trek %d
it:one = %d percorso
@ -19911,7 +19952,7 @@
ko = %d 추적
mr = %d ट्रॅक
nb = %d stier
nl = %d routes
nl = %d tracks
pl = %d tras
pt-BR:one = %d percurso
pt-BR:other = %d percursos
@ -26271,3 +26312,8 @@
ru = https://wiki.openstreetmap.org/wiki/RU:О_проекте
tr = https://wiki.openstreetmap.org/wiki/Tr:About
uk = https://wiki.openstreetmap.org/wiki/Uk:Про_проект
[comma_separated_pair]
comment = A number of bookmarks and a number of tracks, separated by comma, like: 1 bookmark, 5 tracks
tags = android
en = %s, %s

View file

@ -47,7 +47,7 @@ import UIKit
guard let bookmarksControllers = bookmarksControllers else {
// Instead of BookmarksTabViewController
let bookmarks = BMCViewController(coordinator: self)
bookmarks.title = L("bookmarks")
bookmarks.title = L("bookmarks_and_tracks")
navigationController.pushViewController(bookmarks, animated: true)
return
}

View file

@ -131,7 +131,7 @@
<key>UIApplicationShortcutItemIconFile</key>
<string>ic_3dtouch_bookmarks</string>
<key>UIApplicationShortcutItemTitle</key>
<string>bookmarks</string>
<string>bookmarks_and_tracks</string>
<key>UIApplicationShortcutItemType</key>
<string>app.organicmaps.3daction.bookmarks</string>
</dict>

View file

@ -34,46 +34,46 @@
zh-Hans = 搜索
zh-Hant = 搜尋
[bookmarks]
[bookmarks_and_tracks]
tags = ios
comment = Used in home screen quick actions.
en = Bookmarks
ar = الإشارات المرجعية
be = Закладкі
bg = Отметки
ca = Marcadors
cs = Záložky
da = Bogmærker
de = Lesezeichen
el = Αγαπημένα
es = Marcadores
et = Järjehoidjad
eu = Markagailuak
fa = نشانه ها
fi = Kirjanmerkit
fr = Signets
he = רשימות אתרים
hu = Könyvjelzők
id = Penanda
it = Luoghi preferiti
ja = ブックマーク
ko = 북마크
mr = खूणपत्रे
nb = Bokmerker
nl = Bladwijzers
pl = Zakładki
pt = Favoritos
pt-BR = Favoritos
ro = Locuri preferate
ru = Метки
sk = Záložky
sv = Bokmärken
th = บุ๊กมาร์ก
tr = Yer İmleri
uk = Мітки
vi = Đánh dấu
zh-Hans = 书签
zh-Hant = 書籤
en = Bookmarks and Tracks
ar = الإشارات المرجعية والمسارات
be = Закладкі i cцежкі
bg = Отметки и пътеки
ca = Marcadors i traces
cs = Záložky a stopy
da = Bogmærker og ruter
de = Lesezeichen und Strecken
el = Αγαπημένα και διαδρομές
es = Marcadores y rutas
et = Järjehoidjad ja rajad
eu = Markagailuak eta ibilbideak
fa = نشانهها و مسیر
fi = Kirjanmerkit ja reitit
fr = Signets et parcours
he = רשימות אתרים ונתיבים
hu = Könyvjelzők és nyomvonalak
id = Penanda dan jalur
it = Luoghi preferiti e percorsi
ja = ブックマークとトラック
ko = 북마크 및 트랙
mr = खूणपत्रे आणि ट्रॅक
nb = Bokmerker og ruter
nl = Bladwijzers en tracks
pl = Zakładki i trasy
pt = Favoritos e trilhas
pt-BR = Favoritos e trilhas
ro = Locuri preferate și trasee
ru = Метки и треки
sk = Záložky a stopy
sv = Bokmärken och rutter
th = บุ๊กมาร์กและการติดตาม
tr = Yer İmleri ve kayıtlar
uk = Мітки та маршрути
vi = Đánh dấu và dấu vết
zh-Hans = 书签和轨迹
zh-Hant = 書籤和軌跡
[route]
tags = ios