fix timespan plurals (#1240)

* fix timespan plurals

* rename poll timestamp strings and helper method
This commit is contained in:
Konrad Pozniak 2019-05-06 09:59:06 +02:00 committed by GitHub
parent 4ffd149362
commit d7c32258ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 24 additions and 84 deletions

View File

@ -802,7 +802,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
if(useAbsoluteTime) { if(useAbsoluteTime) {
pollDurationInfo = context.getString(R.string.poll_info_time_absolute, getAbsoluteTime(poll.getExpiresAt())); pollDurationInfo = context.getString(R.string.poll_info_time_absolute, getAbsoluteTime(poll.getExpiresAt()));
} else { } else {
String pollDuration = DateUtils.formatDuration(pollDescription.getContext(), poll.getExpiresAt().getTime(), timestamp); String pollDuration = DateUtils.formatPollDuration(pollDescription.getContext(), poll.getExpiresAt().getTime(), timestamp);
pollDurationInfo = context.getString(R.string.poll_info_time_relative, pollDuration); pollDurationInfo = context.getString(R.string.poll_info_time_relative, pollDuration);
} }
} }

View File

@ -78,7 +78,7 @@ public class DateUtils {
return context.getString(format, span); return context.getString(format, span);
} }
public static String formatDuration(Context context, long then, long now) { public static String formatPollDuration(Context context, long then, long now) {
long span = then - now; long span = then - now;
if (span < 0) { if (span < 0) {
span = 0; span = 0;
@ -86,20 +86,20 @@ public class DateUtils {
int format; int format;
if (span < MINUTE_IN_MILLIS) { if (span < MINUTE_IN_MILLIS) {
span /= SECOND_IN_MILLIS; span /= SECOND_IN_MILLIS;
format = R.string.timespan_seconds; format = R.plurals.poll_timespan_seconds;
} else if (span < HOUR_IN_MILLIS) { } else if (span < HOUR_IN_MILLIS) {
span /= MINUTE_IN_MILLIS; span /= MINUTE_IN_MILLIS;
format = R.string.timespan_minutes; format = R.plurals.poll_timespan_minutes;
} else if (span < DAY_IN_MILLIS) { } else if (span < DAY_IN_MILLIS) {
span /= HOUR_IN_MILLIS; span /= HOUR_IN_MILLIS;
format = R.string.timespan_hours; format = R.plurals.poll_timespan_hours;
} else { } else {
span /= DAY_IN_MILLIS; span /= DAY_IN_MILLIS;
format = R.string.timespan_days; format = R.plurals.poll_timespan_days;
} }
return context.getString(format, span); return context.getResources().getQuantityString(format, (int) span, (int) span);
} }
} }

View File

@ -355,11 +355,6 @@
<string name="dialog_redraft_toot_warning">هل تريد حذف وإعادة صياغة هذا التبويق؟</string> <string name="dialog_redraft_toot_warning">هل تريد حذف وإعادة صياغة هذا التبويق؟</string>
<string name="timespan_days">%d أيام</string>
<string name="timespan_hours">%d ساعات</string>
<string name="timespan_minutes">%d دقائق</string>
<string name="timespan_seconds">%d ثوان</string>
<string name="description_status_favourited">تم تفضيله</string> <string name="description_status_favourited">تم تفضيله</string>
<string name="edit_hashtag_title">تعديل الوسم</string> <string name="edit_hashtag_title">تعديل الوسم</string>
<string name="edit_hashtag_hint">وسم بدون #</string> <string name="edit_hashtag_hint">وسم بدون #</string>

View File

@ -395,11 +395,6 @@
<string name="action_delete_and_redraft">Smazat a přepsat</string> <string name="action_delete_and_redraft">Smazat a přepsat</string>
<string name="dialog_redraft_toot_warning">Smazat a přepsat tento toot\?</string> <string name="dialog_redraft_toot_warning">Smazat a přepsat tento toot\?</string>
<string name="timespan_days">%d dní</string>
<string name="timespan_hours">%d hodin</string>
<string name="timespan_minutes">%d minut</string>
<string name="timespan_seconds">%d sekund</string>
<string name="poll_info_format"> <!-- 15 votes • 1 hour left --> %1$s • %2$s</string> <string name="poll_info_format"> <!-- 15 votes • 1 hour left --> %1$s • %2$s</string>
<plurals name="poll_info_votes"> <plurals name="poll_info_votes">
<item quantity="one">%s hlas</item> <item quantity="one">%s hlas</item>

View File

@ -394,11 +394,6 @@
<string name="action_delete_and_redraft">Effacer et ré-écrire</string> <string name="action_delete_and_redraft">Effacer et ré-écrire</string>
<string name="dialog_redraft_toot_warning">Effacer et ré-écrire ce pouet \?</string> <string name="dialog_redraft_toot_warning">Effacer et ré-écrire ce pouet \?</string>
<string name="timespan_days">%d jours</string>
<string name="timespan_hours">%d heures</string>
<string name="timespan_minutes">%d minutes</string>
<string name="timespan_seconds">%d secondes</string>
<plurals name="poll_info_votes"> <plurals name="poll_info_votes">
<item quantity="one">%s vote</item> <item quantity="one">%s vote</item>
<item quantity="other">%s votes</item> <item quantity="other">%s votes</item>

View File

@ -326,10 +326,6 @@
<string name="abbreviated_minutes_ago">%dp</string> <string name="abbreviated_minutes_ago">%dp</string>
<string name="abbreviated_seconds_ago">%dm</string> <string name="abbreviated_seconds_ago">%dm</string>
<string name="timespan_days">%d nap</string>
<string name="timespan_hours">%d óra</string>
<string name="timespan_minutes">%d perc</string>
<string name="timespan_seconds">%d másodperc</string>
<string name="replying_to">Válasz @%s részére</string> <string name="replying_to">Válasz @%s részére</string>
<string name="pref_title_public_filter_keywords">Nyilvános idővonalak</string> <string name="pref_title_public_filter_keywords">Nyilvános idővonalak</string>

View File

@ -392,11 +392,6 @@
<string name="action_delete_and_redraft">Cancella e riscrivi</string> <string name="action_delete_and_redraft">Cancella e riscrivi</string>
<string name="dialog_redraft_toot_warning">Cancellare e riscrivere questo toot\?</string> <string name="dialog_redraft_toot_warning">Cancellare e riscrivere questo toot\?</string>
<string name="timespan_days">%d giorni</string>
<string name="timespan_hours">%d ore</string>
<string name="timespan_minutes">%d minuti</string>
<string name="timespan_seconds">%d secondi</string>
<plurals name="poll_info_votes"> <plurals name="poll_info_votes">
<item quantity="one">%s voto</item> <item quantity="one">%s voto</item>
<item quantity="other">%s voti</item> <item quantity="other">%s voti</item>

View File

@ -383,10 +383,6 @@
<string name="action_delete_and_redraft">Verwijderen en herschrijven</string> <string name="action_delete_and_redraft">Verwijderen en herschrijven</string>
<string name="dialog_redraft_toot_warning">Deze toot verwijderen en herschrijven\?</string> <string name="dialog_redraft_toot_warning">Deze toot verwijderen en herschrijven\?</string>
<string name="timespan_days">%d dagen</string>
<string name="timespan_hours">%d uur</string>
<string name="timespan_minutes">%d minuten</string>
<string name="timespan_seconds">%d seconden</string>
<string name="notifications_clear">Leegmaken</string> <string name="notifications_clear">Leegmaken</string>
<string name="notifications_apply_filter">Filter</string> <string name="notifications_apply_filter">Filter</string>

View File

@ -411,10 +411,6 @@
<string name="action_delete_and_redraft">Slett og skriv på nytt</string> <string name="action_delete_and_redraft">Slett og skriv på nytt</string>
<string name="dialog_redraft_toot_warning">Vil du slette dette tottet og skrive det på nytt\?</string> <string name="dialog_redraft_toot_warning">Vil du slette dette tottet og skrive det på nytt\?</string>
<string name="timespan_days">%d dager</string>
<string name="timespan_hours">%d timer</string>
<string name="timespan_minutes">%d minutter</string>
<string name="timespan_seconds">%d sekunder</string>
<string name="poll_info_format"> <!-- 15 votes • 1 hour left --> %1$s • %2$s</string> <string name="poll_info_format"> <!-- 15 votes • 1 hour left --> %1$s • %2$s</string>
<plurals name="poll_info_votes"> <plurals name="poll_info_votes">

View File

@ -393,11 +393,6 @@
<string name="media_hide_none">Totjorn mostrar los mèdias marcat coma sensibles</string> <string name="media_hide_none">Totjorn mostrar los mèdias marcat coma sensibles</string>
<string name="media_hide_all">Totjorn amagar los mèdias</string> <string name="media_hide_all">Totjorn amagar los mèdias</string>
<string name="timespan_days">%d jorns</string>
<string name="timespan_hours">%d oras</string>
<string name="timespan_minutes">%d minutas</string>
<string name="timespan_seconds">%d segondas</string>
<string name="notifications_clear">Netejar</string> <string name="notifications_clear">Netejar</string>
<string name="notifications_apply_filter">Filtrar</string> <string name="notifications_apply_filter">Filtrar</string>
<string name="filter_apply">Aplicar</string> <string name="filter_apply">Aplicar</string>

View File

@ -414,10 +414,6 @@
<string name="action_delete_and_redraft">Izbriši in preoblikuj</string> <string name="action_delete_and_redraft">Izbriši in preoblikuj</string>
<string name="dialog_redraft_toot_warning">Izbriši in preoblikuj tut\?</string> <string name="dialog_redraft_toot_warning">Izbriši in preoblikuj tut\?</string>
<string name="timespan_days">%d dni</string>
<string name="timespan_hours">%d ur</string>
<string name="timespan_minutes">%d minut</string>
<string name="timespan_seconds">%d sekund</string>
<string name="poll_info_format"> <!-- 15 votes • 1 hour left --> %1$s • %2$s</string> <string name="poll_info_format"> <!-- 15 votes • 1 hour left --> %1$s • %2$s</string>
<plurals name="poll_info_votes"> <plurals name="poll_info_votes">

View File

@ -394,11 +394,6 @@
<string name="action_delete_and_redraft">Radera och skriv nytt</string> <string name="action_delete_and_redraft">Radera och skriv nytt</string>
<string name="dialog_redraft_toot_warning">Radera och skriva ny toot\?</string> <string name="dialog_redraft_toot_warning">Radera och skriva ny toot\?</string>
<string name="timespan_days">%d dagar</string>
<string name="timespan_hours">%d timmar</string>
<string name="timespan_minutes">%d minuter</string>
<string name="timespan_seconds">%d sekunder</string>
<string name="poll_info_format"> <!-- 15 röster • 1 timme kvar --> %1$s • %2$s</string> <string name="poll_info_format"> <!-- 15 röster • 1 timme kvar --> %1$s • %2$s</string>
<plurals name="poll_info_votes"> <plurals name="poll_info_votes">
<item quantity="one">%s röst</item> <item quantity="one">%s röst</item>

View File

@ -309,11 +309,6 @@
<string name="abbreviated_minutes_ago">%d 分钟前</string> <string name="abbreviated_minutes_ago">%d 分钟前</string>
<string name="abbreviated_seconds_ago">%d 秒前</string> <string name="abbreviated_seconds_ago">%d 秒前</string>
<!--These are for timestamps on polls -->
<string name="timespan_days">%d 天</string>
<string name="timespan_hours">%d 小时</string>
<string name="timespan_minutes">%d 分钟</string>
<string name="timespan_seconds">%d 秒</string>
<string name="follows_you">关注了你</string> <string name="follows_you">关注了你</string>
<string name="pref_title_alway_show_sensitive_media">总是显示所有敏感媒体内容</string> <string name="pref_title_alway_show_sensitive_media">总是显示所有敏感媒体内容</string>

View File

@ -309,11 +309,6 @@
<string name="abbreviated_minutes_ago">%d 分鐘前</string> <string name="abbreviated_minutes_ago">%d 分鐘前</string>
<string name="abbreviated_seconds_ago">%d 秒前</string> <string name="abbreviated_seconds_ago">%d 秒前</string>
<!--These are for timestamps on polls -->
<string name="timespan_days">%d 天</string>
<string name="timespan_hours">%d 小時</string>
<string name="timespan_minutes">%d 分鐘</string>
<string name="timespan_seconds">%d 秒</string>
<string name="follows_you">關注了你</string> <string name="follows_you">關注了你</string>
<string name="pref_title_alway_show_sensitive_media">總是顯示所有敏感媒體內容</string> <string name="pref_title_alway_show_sensitive_media">總是顯示所有敏感媒體內容</string>

View File

@ -309,11 +309,6 @@
<string name="abbreviated_minutes_ago">%d 分鐘前</string> <string name="abbreviated_minutes_ago">%d 分鐘前</string>
<string name="abbreviated_seconds_ago">%d 秒前</string> <string name="abbreviated_seconds_ago">%d 秒前</string>
<!--These are for timestamps on polls -->
<string name="timespan_days">%d 天</string>
<string name="timespan_hours">%d 小時</string>
<string name="timespan_minutes">%d 分鐘</string>
<string name="timespan_seconds">%d 秒</string>
<string name="follows_you">關注了你</string> <string name="follows_you">關注了你</string>
<string name="pref_title_alway_show_sensitive_media">總是顯示所有敏感媒體內容</string> <string name="pref_title_alway_show_sensitive_media">總是顯示所有敏感媒體內容</string>

View File

@ -309,11 +309,6 @@
<string name="abbreviated_minutes_ago">%d 分钟前</string> <string name="abbreviated_minutes_ago">%d 分钟前</string>
<string name="abbreviated_seconds_ago">%d 秒前</string> <string name="abbreviated_seconds_ago">%d 秒前</string>
<!--These are for timestamps on polls -->
<string name="timespan_days">%d 天</string>
<string name="timespan_hours">%d 小时</string>
<string name="timespan_minutes">%d 分钟</string>
<string name="timespan_seconds">%d 秒</string>
<string name="follows_you">关注了你</string> <string name="follows_you">关注了你</string>
<string name="pref_title_alway_show_sensitive_media">总是显示所有敏感媒体内容</string> <string name="pref_title_alway_show_sensitive_media">总是显示所有敏感媒体内容</string>

View File

@ -309,11 +309,6 @@
<string name="abbreviated_minutes_ago">%d 分鐘前</string> <string name="abbreviated_minutes_ago">%d 分鐘前</string>
<string name="abbreviated_seconds_ago">%d 秒前</string> <string name="abbreviated_seconds_ago">%d 秒前</string>
<!--These are for timestamps on polls -->
<string name="timespan_days">%d 天</string>
<string name="timespan_hours">%d 小時</string>
<string name="timespan_minutes">%d 分鐘</string>
<string name="timespan_seconds">%d 秒</string>
<string name="follows_you">關注了你</string> <string name="follows_you">關注了你</string>
<string name="pref_title_alway_show_sensitive_media">總是顯示所有敏感媒體內容</string> <string name="pref_title_alway_show_sensitive_media">總是顯示所有敏感媒體內容</string>

View File

@ -312,12 +312,6 @@
<string name="abbreviated_minutes_ago">%dm</string> <string name="abbreviated_minutes_ago">%dm</string>
<string name="abbreviated_seconds_ago">%ds</string> <string name="abbreviated_seconds_ago">%ds</string>
<!--These are for timestamps on polls -->
<string name="timespan_days">%d days</string>
<string name="timespan_hours">%d hours</string>
<string name="timespan_minutes">%d minutes</string>
<string name="timespan_seconds">%d seconds</string>
<string name="follows_you">Follows you</string> <string name="follows_you">Follows you</string>
<string name="pref_title_alway_show_sensitive_media">Always show sensitive content</string> <string name="pref_title_alway_show_sensitive_media">Always show sensitive content</string>
<string name="title_media">Media</string> <string name="title_media">Media</string>
@ -492,5 +486,22 @@
<string name="poll_ended_voted">A poll you have voted in has ended</string> <string name="poll_ended_voted">A poll you have voted in has ended</string>
<string name="poll_ended_created">A poll you created has ended</string> <string name="poll_ended_created">A poll you created has ended</string>
<!--These are for timestamps on polls -->
<plurals name="poll_timespan_days">
<item quantity="one">%d day</item>
<item quantity="other">%d days</item>
</plurals>
<plurals name="poll_timespan_hours">
<item quantity="one">%d hour</item>
<item quantity="other">%d hours</item>
</plurals>
<plurals name="poll_timespan_minutes">
<item quantity="one">%d minute</item>
<item quantity="other">%d minutes</item>
</plurals>
<plurals name="poll_timespan_seconds">
<item quantity="one">%d second</item>
<item quantity="other">%d seconds</item>
</plurals>
</resources> </resources>