From: David A. Velasco Date: Wed, 22 Apr 2015 06:56:56 +0000 (+0200) Subject: More i18n-friendly format for footer in list of files (no string composition) X-Git-Tag: oc-android-1.7.2~1^2~11^2^2 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/69a5b6f25da7e7c6fc2c9ee7b03966e67163289d More i18n-friendly format for footer in list of files (no string composition) Conflicts FIXED: res/values/strings.xml --- diff --git a/res/values/strings.xml b/res/values/strings.xml index f5ea7bcb..ac8fd3ab 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -72,12 +72,8 @@ Uploading seconds ago Nothing in here. Upload something! - Loading... + Loading… There are no files in this folder. - folder - folders - file - files Tap on a file to display additional information. Size: Type: @@ -301,7 +297,7 @@ An error occurred while waiting for the server, the operation couldn\'t have been done The operation couldn\'t be completed, server is unavailable - + You do not have permission %s to rename this file @@ -350,4 +346,14 @@ Not enough memory Username + + 1 folder + %1$d folders + 1 file + 1 file, 1 folder + 1 file, %1$d folders + %1$d files + %1$d files, 1 folder + %1$d files, %1$d folders + diff --git a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java index dd8ed029..a8f7ff07 100644 --- a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -438,23 +438,47 @@ public class OCFileListFragment extends ExtendedListFragment { } private String generateFooterText(int filesCount, int foldersCount) { - String output = ""; - if (filesCount > 0){ - if (filesCount == 1) { - output = output + filesCount + " " + getResources().getString(R.string.file_list_file); - } else { - output = output + filesCount + " " + getResources().getString(R.string.file_list_files); + String output; + if (filesCount <= 0) { + if (foldersCount <= 0) { + output = ""; + + } else if (foldersCount == 1) { + output = getResources().getString(R.string.file_list__footer__folder); + + } else { // foldersCount > 1 + output = getResources().getString(R.string.file_list__footer__folders); + String.format(output, foldersCount); + } - } - if (foldersCount > 0 && filesCount > 0){ - output = output + ", "; - } - if (foldersCount == 1) { - output = output + foldersCount + " " + getResources().getString(R.string.file_list_folder); - } else if (foldersCount > 1) { - output = output + foldersCount + " " + getResources().getString(R.string.file_list_folders); - } + } else if (filesCount == 1) { + if (foldersCount <= 0) { + output = getResources().getString(R.string.file_list__footer__file); + + } else if (foldersCount == 1) { + output = getResources().getString(R.string.file_list__footer__file_and_folder); + + } else { // foldersCount > 1 + output = getResources().getString(R.string.file_list__footer__file_and_folders); + String.format(output, foldersCount); + + } + } else { // filesCount > 1 + if (foldersCount <= 0) { + output = getResources().getString(R.string.file_list__footer__files); + String.format(output, filesCount); + + } else if (foldersCount == 1) { + output = getResources().getString(R.string.file_list__footer__files_and_folder); + String.format(output, filesCount); + + } else { // foldersCount > 1 + output = getResources().getString(R.string.file_list__footer__files_and_folders); + String.format(output, filesCount, foldersCount); + + } + } return output; }