[aur-dev] Fix for some plural strings

Safa Alfulaij safa1996alfulaij at gmail.com
Thu Jul 17 09:08:18 EDT 2014


This is a patch to fix some strings that are not in plural. Hope you can
add some comments to "It must be between %s and %s characters long" string
parts so that the translator can understand whats going on. Also I didn't
check if the var. is a number or a string.
Patch attached.

Regards,
Safa
-------------- next part --------------
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index f07580b..b46bd14 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -255,25 +255,25 @@ if ($uid):
 			 * limitations are exceeded.
 			 */
 			if (strlen($pi['pkgname']) > 64) {
-				$error = __("Error - Package name cannot be greater than %d characters", 64);
+				$error = _n("Error - Package name cannot be greater than %d character", "Error - Package name cannot be greater than %d characters", 64);
 				break;
 			}
 			if (strlen($pi['url']) > 255) {
-				$error = __("Error - Package URL cannot be greater than %d characters", 255);
+				$error = _n("Error - Package URL cannot be greater than %d character", "Error - Package URL cannot be greater than %d characters", 255);
 				break;
 			}
 			if (strlen($pi['pkgdesc']) > 255) {
-				$error = __("Error - Package description cannot be greater than %d characters", 255);
+				$error = __("Error - Package description cannot be greater than %d character", "Error - Package description cannot be greater than %d characters", 255);
 				break;
 			}
 			foreach ($pi['license'] as $lic) {
 				if (strlen($lic > 64)) {
-					$error = __("Error - Package license cannot be greater than %d characters", 64);
+					$error = __("Error - Package license cannot be greater than %d character", "Error - Package license cannot be greater than %d characters", 64);
 					break;
 				}
 			}
 			if (strlen($pkginfo[$key]['full-version']) > 32) {
-				$error = __("Error - Package version cannot be greater than %d characters", 32);
+				$error = __("Error - Package version cannot be greater than %d character", "Error - Package version cannot be greater than %d characters", 32);
 				break;
 			}
 
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index 73d01a5..d869bbb 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -119,8 +119,8 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",
 
 	if (!$error && !valid_username($U)) {
 		$error = __("The username is invalid.") . "<ul>\n"
-			."<li>" . __("It must be between %s and %s characters long",
-			USERNAME_MIN_LEN,  USERNAME_MAX_LEN )
+                        ."<li>" . __("It must be between %s and %s long",
+                        _n('%s','%s',USERNAME_MIN_LEN),  _n('%s character','%s characters',USERNAME_MAX_LEN))
 			. "</li>"
 			. "<li>" . __("Start and end with a letter or number") . "</li>"
 			. "<li>" . __("Can contain only one period, underscore or hyphen.")
@@ -131,7 +131,7 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",
 		$error = __("Password fields do not match.");
 	}
 	if (!$error && $P != '' && !good_passwd($P))
-		$error = __("Your password must be at least %s characters.",PASSWD_MIN_LEN);
+                $error = _n("Your password must be at least %s character.","Your password must be at least %s characters.",PASSWD_MIN_LEN);
 
 	if (!$error && !valid_email($E)) {
 		$error = __("The email address is invalid.");
diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php
index 20521a0..9c02daf 100644
--- a/web/template/pkg_comments.php
+++ b/web/template/pkg_comments.php
@@ -47,7 +47,7 @@ $count = pkgbase_comments_count($base_id);
 <?php if ($count > 10 && !isset($_GET['comments'])): ?>
 <div id="news">
 	<h3>
-		<a href="<?= htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title="<?= __('View all %s comments', $count) ?>"><?= __('All comments', $count) ?></a>
+		<a href="<?= htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title="<?= _n('View all %s comment', 'View all %s comments', $count) ?>"><?= __('All comments', $count) ?></a>
 	</h3>
 </div>
 <?php endif; ?>


More information about the aur-dev mailing list