fix(timeline/gap): use plurals for time (#829)
Co-authored-by: sk <sk22@mailbox.org>
This commit is contained in:
parent
1079f600bc
commit
05f7a44bd5
|
@ -218,11 +218,20 @@ public class UiUtils {
|
||||||
if(diff<1000L){
|
if(diff<1000L){
|
||||||
return context.getString(R.string.time_now);
|
return context.getString(R.string.time_now);
|
||||||
}else if(diff<60_000L){
|
}else if(diff<60_000L){
|
||||||
return context.getString(ago ? R.string.time_seconds_ago_short : R.string.sk_time_seconds, diff/1000L);
|
long time = diff/1000L;
|
||||||
|
return ago ?
|
||||||
|
context.getString(R.string.time_seconds_ago_short, time) :
|
||||||
|
context.getResources().getQuantityString(R.plurals.sk_time_seconds, (int) time, time);
|
||||||
}else if(diff<3600_000L){
|
}else if(diff<3600_000L){
|
||||||
return context.getString(ago ? R.string.time_minutes_ago_short : R.string.sk_time_minutes, diff/60_000L);
|
long time = diff/60_000L;
|
||||||
|
return ago ?
|
||||||
|
context.getString(R.string.time_minutes_ago_short, time) :
|
||||||
|
context.getResources().getQuantityString(R.plurals.sk_time_minutes, (int) time, time);
|
||||||
}else if(diff<3600_000L*24L){
|
}else if(diff<3600_000L*24L){
|
||||||
return context.getString(ago ? R.string.time_hours_ago_short : R.string.sk_time_hours, diff/3600_000L);
|
long time = diff/3600_000L;
|
||||||
|
return ago ?
|
||||||
|
context.getString(R.string.time_hours_ago_short, time) :
|
||||||
|
context.getResources().getQuantityString(R.plurals.sk_time_hours, (int) time, time);
|
||||||
} else {
|
} else {
|
||||||
int days = (int) (diff / (3600_000L * 24L));
|
int days = (int) (diff / (3600_000L * 24L));
|
||||||
if (ago && days > 30) {
|
if (ago && days > 30) {
|
||||||
|
@ -233,7 +242,7 @@ public class UiUtils {
|
||||||
return DATE_FORMATTER_SHORT_WITH_YEAR.format(dt);
|
return DATE_FORMATTER_SHORT_WITH_YEAR.format(dt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return context.getString(ago ? R.string.time_days_ago_short : R.string.sk_time_days, days);
|
return ago ? context.getString(R.string.time_days_ago_short, days) : context.getResources().getQuantityString(R.plurals.sk_time_days, days, days);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -382,10 +382,6 @@
|
||||||
<item quantity="other">Beiträge</item>
|
<item quantity="other">Beiträge</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
<string name="sk_settings_show_labels_in_navigation_bar">Tab-Bezeichnungen in der Navigationsleiste anzeigen</string>
|
<string name="sk_settings_show_labels_in_navigation_bar">Tab-Bezeichnungen in der Navigationsleiste anzeigen</string>
|
||||||
<string name="sk_time_seconds">%d Sekunden</string>
|
|
||||||
<string name="sk_time_minutes">%d Minuten</string>
|
|
||||||
<string name="sk_time_hours">%d Stunden</string>
|
|
||||||
<string name="sk_time_days">%d Tage</string>
|
|
||||||
<string name="sk_suicide_helplines_url">https://findahelpline.com</string>
|
<string name="sk_suicide_helplines_url">https://findahelpline.com</string>
|
||||||
<string name="sk_load_missing_posts_below">Ältere Beiträge laden</string>
|
<string name="sk_load_missing_posts_below">Ältere Beiträge laden</string>
|
||||||
<string name="sk_load_missing_posts_above">Neuere Beiträge laden</string>
|
<string name="sk_load_missing_posts_above">Neuere Beiträge laden</string>
|
||||||
|
|
|
@ -370,9 +370,5 @@
|
||||||
<string name="sk_settings_auto_reveal_equal_spoilers">Revelar automaticamente Avisos de Conteúdo nas respostas</string>
|
<string name="sk_settings_auto_reveal_equal_spoilers">Revelar automaticamente Avisos de Conteúdo nas respostas</string>
|
||||||
<string name="sk_icon_recycle_bin">Lixeira de reciclagem</string>
|
<string name="sk_icon_recycle_bin">Lixeira de reciclagem</string>
|
||||||
<string name="sk_tab_search">Pesquisar</string>
|
<string name="sk_tab_search">Pesquisar</string>
|
||||||
<string name="sk_time_minutes">%d minutos</string>
|
|
||||||
<string name="sk_time_hours">%d horas</string>
|
|
||||||
<string name="sk_suicide_search_terms">Suicídio</string>
|
<string name="sk_suicide_search_terms">Suicídio</string>
|
||||||
<string name="sk_time_seconds">%d segundos</string>
|
|
||||||
<string name="sk_time_days">%d dias</string>
|
|
||||||
</resources>
|
</resources>
|
|
@ -388,10 +388,22 @@
|
||||||
<string name="sk_post_contains_media">Post contains media</string>
|
<string name="sk_post_contains_media">Post contains media</string>
|
||||||
<string name="sk_load_missing_posts_above">Load newer posts</string>
|
<string name="sk_load_missing_posts_above">Load newer posts</string>
|
||||||
<string name="sk_load_missing_posts_below">Load older posts</string>
|
<string name="sk_load_missing_posts_below">Load older posts</string>
|
||||||
<string name="sk_time_seconds">%d seconds</string>
|
<plurals name="sk_time_seconds">
|
||||||
<string name="sk_time_minutes">%d minutes</string>
|
<item quantity="one">%d second</item>
|
||||||
<string name="sk_time_hours">%d hours</string>
|
<item quantity="other">%d seconds</item>
|
||||||
<string name="sk_time_days">%d days</string>
|
</plurals>
|
||||||
|
<plurals name="sk_time_minutes">
|
||||||
|
<item quantity="one">%d minute</item>
|
||||||
|
<item quantity="other">%d minutes</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="sk_time_hours">
|
||||||
|
<item quantity="one">%d hour</item>
|
||||||
|
<item quantity="other">%d hours</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="sk_time_days">
|
||||||
|
<item quantity="one">%d day</item>
|
||||||
|
<item quantity="other">%d days</item>
|
||||||
|
</plurals>
|
||||||
<string name="sk_muted_accounts">Muted accounts</string>
|
<string name="sk_muted_accounts">Muted accounts</string>
|
||||||
<string name="sk_blocked_accounts">Blocked accounts</string>
|
<string name="sk_blocked_accounts">Blocked accounts</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue