Skip to content

Commit

Permalink
use plurals
Browse files Browse the repository at this point in the history
  • Loading branch information
Logan676 committed Feb 13, 2015
1 parent dff0f4b commit f3612ed
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 25 deletions.
43 changes: 28 additions & 15 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name">Seafile</string>
<string name="app_url">http://seafile.com</string>
<string name="welcome_to_seafile">Welcome to Seafile</string>
Expand Down Expand Up @@ -85,7 +85,11 @@
<string name="image_gallery_NoImageView_text">No image found</string>
<string name="pick_photo_video_title">Choose photos/videos to upload</string>
<string name="select_upload_items">Select items to upload</string>
<string name="n_upload_items_selected">%d items selected</string>
<plurals name="n_upload_items_selected">
<item quantity="one"><xliff:g id="number_of_selected">%1$d</xliff:g> item selected</item>
<item quantity="other"><xliff:g id="numbers_of_selected">%1$d</xliff:g> items selected</item>
</plurals>

<string name="dir_name_empty">Please enter the name of the folder</string>
<string name="file_name_empty">Please enter the name of the file</string>
<string name="password_empty">Please enter the password</string>
Expand Down Expand Up @@ -159,7 +163,10 @@
<string name="select_upload_files">Select files to upload</string>
<string name="storage_removed">Storage was removed</string>
<string name="error_selecting_file">Error when selecting file</string>
<string name="n_upload_files_selected">%d file(s) selected</string>
<plurals name="n_upload_files_selected">
<item quantity="one"><xliff:g id="number_of_selected">%1$d</xliff:g> file selected</item>
<item quantity="other"><xliff:g id="numbers_of_selected">%1$d</xliff:g> files selected</item>
</plurals>
<string name="empty_folder">Empty folder</string>
<string name="choose_file">Choose a file</string>
<string name="ssl_error">Security check failed</string>
Expand Down Expand Up @@ -193,7 +200,7 @@

<string name="settings_account">Account</string>
<string name="settings_account_info_title">User info</string>
<string name="settings_account_info_load_data">loading...</string>
<string name="settings_account_info_load_data">loading&#8230;</string>
<string name="settings_account_space_title">Space used</string>
<string name="settings_account_sign_out_title">Sign out</string>
<string name="settings_account_sign_out_hint">Click to sign out</string>
Expand All @@ -210,9 +217,15 @@
<string name="lockscreen_access_pattern_detected">Pattern detected</string>
<string name="lockscreen_access_pattern_passwd_forget">Forgot password</string>
<string name="lockscreen_access_pattern_failure">Failed 5 times, please wait 30 seconds before trying</string>
<string name="lockscreen_access_pattern_failure_left_try_seconds">You can retry %d seconds later</string>
<string name="lockscreen_access_pattern_failure_left_try_times">Incorrect pattern, you can try another %d times</string>
<string name="lockscreen_access_pattern_failure_not_long_enough">Linking points not long enough, please try again</string>
<plurals name="lockscreen_access_pattern_failure_left_try_seconds">
<item quantity="one">You can retry <xliff:g id="second">%1$d</xliff:g> second later</item>
<item quantity="other">You can retry <xliff:g id="seconds">%1$d</xliff:g> seconds later</item>
</plurals>
<plurals name="lockscreen_access_pattern_failure_left_try_times">
<item quantity="one">Incorrect pattern, you can try another <xliff:g id="time">%1$d</xliff:g> time</item>
<item quantity="other">Incorrect pattern, you can try another <xliff:g id="times">%1$d</xliff:g> times</item>
</plurals>
<string name="lockscreen_access_pattern_failure_not_long_enough">Linking points not long enough, pelase try again</string>
<string name="lockpattern_retry_button_text">Retry</string>
<string name="lockpattern_continue_button_text">Next</string>
<string name="lockpattern_confirm_button_text">OK</string>
Expand Down Expand Up @@ -274,13 +287,13 @@
<string name="settings_cache_empty">0 KB</string>

<!-- pull to refresh -->
<string name="pull_to_refresh_pull_label">Pull to refresh</string>
<string name="pull_to_refresh_release_label">Release to refresh</string>
<string name="pull_to_refresh_refreshing_label">Loading</string>
<string name="pull_to_refresh_pull_label">Pull to refresh&#8230;</string>
<string name="pull_to_refresh_release_label">Release to refresh&#8230;</string>
<string name="pull_to_refresh_refreshing_label">Loading&#8230;</string>
<string name="pull_to_refresh_last_update">Last update:&#160;</string>
<string name="pull_to_refresh_last_update_seconds_ago">&#160;seconds ago</string>
<string name="pull_to_refresh_last_update_minutes_ago">&#160;minutes ago</string>
<string name="pull_to_refresh_last_update_hours_ago">&#160;hours ago</string>
<string name="pull_to_refresh_last_update_seconds_ago">%d seconds ago</string>
<string name="pull_to_refresh_last_update_minutes_ago">%d minutes ago</string>
<string name="pull_to_refresh_last_update_hours_ago">%d hours ago</string>

<!-- storage access framework -->
<string name="saf_open_file_exception">Could not open file %s.</string>
Expand All @@ -296,9 +309,9 @@
<string name="shib_server_incorrect_prefix">Server should starts with either http:// or https://</string>
<string name="shib_load_page_error">Error:&#160;</string>
<string name="shib_login_title">Shibboleth Login</string>
<string name="shib_server_hint">Input server...</string>
<string name="shib_server_hint">Input server&#8230;</string>
<string name="shib_actionbar_title">Login with Shibboleth</string>
<string name="shib_loading">loading...</string>
<string name="shib_loading">loading&#8230;</string>

<!-- Transfer List -->
<string name="transfer_list_network_error">Network connection error, please try again later!</string>
Expand Down
6 changes: 3 additions & 3 deletions src/com/seafile/seadroid2/data/DataManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ public String getLastPullToRefreshTime(String whichFragment) {
sb.append(SeadroidApplication.getAppContext().getString(R.string.pull_to_refresh_last_update));

if (seconds < 60) {
sb.append(seconds + SeadroidApplication.getAppContext().getString(R.string.pull_to_refresh_last_update_seconds_ago));
sb.append(SeadroidApplication.getAppContext().getString(R.string.pull_to_refresh_last_update_seconds_ago, seconds));
} else {
int minutes = (seconds / 60);
if (minutes > 60) {
Expand All @@ -792,11 +792,11 @@ public String getLastPullToRefreshTime(String whichFragment) {
Date date = new Date(lastUpdate);
sb.append(ptrDataFormat.format(date));
} else {
sb.append(hours + SeadroidApplication.getAppContext().getString(R.string.pull_to_refresh_last_update_hours_ago));
sb.append(SeadroidApplication.getAppContext().getString(R.string.pull_to_refresh_last_update_hours_ago, hours));
}

} else {
sb.append(minutes + SeadroidApplication.getAppContext().getString(R.string.pull_to_refresh_last_update_minutes_ago));
sb.append(SeadroidApplication.getAppContext().getString(R.string.pull_to_refresh_last_update_minutes_ago, minutes));
}
}
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ private void updateSelectionStatus() {
if (nSelected == 0) {
status = getResources().getString(R.string.select_upload_files);
} else {
status = String.format(getResources().getString(R.string.n_upload_files_selected),
nSelected);
status = getResources().getQuantityString(R.plurals.n_upload_files_selected, nSelected, nSelected);
}
mFooterFragment.getStatusView().setText(status);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,7 @@ private void updateSelectionStatus() {
if (nSelected == 0) {
status = getResources().getString(R.string.select_upload_items);
} else {
status = String.format(getResources().getString(R.string.n_upload_items_selected),
nSelected);
status = getResources().getQuantityString(R.plurals.n_upload_items_selected, nSelected, nSelected);
}
mSelectionStatus.setText(status);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public void onPatternDetected(List<LockPatternView.Cell> pattern) {
- mFailedPatternAttemptsSinceLastTimeout;
if (retry >= 0) {
if (retry == 0)
ToastUtils.show(UnlockGesturePasswordActivity.this, getResources().getString(R.string.lockscreen_access_pattern_failure));
mHeadTextView.setText(getResources().getString(R.string.lockscreen_access_pattern_failure_left_try_times, retry));
ToastUtils.show(UnlockGesturePasswordActivity.this, getResources().getString(R.string.lockscreen_access_pattern_failure));
mHeadTextView.setText(getResources().getQuantityString(R.plurals.lockscreen_access_pattern_failure_left_try_times, retry, retry));
mHeadTextView.setTextColor(Color.RED);
mHeadTextView.startAnimation(mShakeAnim);
}
Expand Down Expand Up @@ -143,7 +143,7 @@ public void run() {
public void onTick(long millisUntilFinished) {
int secondsRemaining = (int) (millisUntilFinished / 1000) - 1;
if (secondsRemaining > 0) {
mHeadTextView.setText(getResources().getString(R.string.lockscreen_access_pattern_failure_left_try_seconds, secondsRemaining));
mHeadTextView.setText(getResources().getQuantityString(R.plurals.lockscreen_access_pattern_failure_left_try_seconds, secondsRemaining, secondsRemaining));
} else {
mHeadTextView.setText(R.string.lockscreen_access_pattern_hint);
mHeadTextView.setTextColor(Color.WHITE);
Expand Down

0 comments on commit f3612ed

Please sign in to comment.