From cd0c4ae7dd3fdc9266ee834ce8348c962877945e Mon Sep 17 00:00:00 2001 From: nikrou Date: Tue, 23 Mar 2010 16:19:13 +0000 Subject: Fix missing key translations for nbm and c13y git-svn-id: http://piwigo.org/svn/trunk@5287 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/check_integrity.class.php | 8 ++-- themes/default/template/mail/text/html/footer.tpl | 4 +- .../mail/text/html/notification_by_mail.tpl | 24 +++++----- themes/default/template/mail/text/plain/footer.tpl | 2 +- .../mail/text/plain/notification_by_mail.tpl | 24 +++++----- tools/replace.php | 53 ++++++++++++++++++++++ 6 files changed, 84 insertions(+), 31 deletions(-) create mode 100755 tools/replace.php diff --git a/admin/include/check_integrity.class.php b/admin/include/check_integrity.class.php index a4ea52d7c..70c8d73ac 100644 --- a/admin/include/check_integrity.class.php +++ b/admin/include/check_integrity.class.php @@ -72,7 +72,7 @@ class check_integrity if (count($this->retrieve_list) > 0) { $header_notes[] = - l10n_dec('c13y_anomaly_count', 'c13y_anomalies_count', + l10n_dec('%d anomaly has been detected.', '%d anomalies have been detected.', count($this->retrieve_list)); } @@ -119,13 +119,13 @@ class check_integrity if ($corrected_count > 0) { $page['infos'][] = - l10n_dec('c13y_anomaly_corrected_count', 'c13y_anomalies_corrected_count', + l10n_dec('%d anomaly has been corrected.', '%d anomalies have been detected corrected.', $corrected_count); } if ($not_corrected_count > 0) { $page['errors'][] = - l10n_dec('c13y_anomaly_not_corrected_count', 'c13y_anomalies_not_corrected_count', + l10n_dec('%d anomaly has not been corrected.', '%d anomalies have not been corrected.', $not_corrected_count); } } @@ -148,7 +148,7 @@ class check_integrity if ($ignored_count > 0) { $page['infos'][] = - l10n_dec('c13y_anomaly_ignored_count', 'c13y_anomalies_ignored_count', + l10n_dec('%d anomaly has been ignored.', '%d anomalies have been ignored.', $ignored_count); } } diff --git a/themes/default/template/mail/text/html/footer.tpl b/themes/default/template/mail/text/html/footer.tpl index 92e69b089..b1f1b9317 100644 --- a/themes/default/template/mail/text/html/footer.tpl +++ b/themes/default/template/mail/text/html/footer.tpl @@ -7,12 +7,12 @@ {* Please, do not remove this copyright. If you really want to, contact us on http://piwigo.org to find a solution on how to show the origin of the script...*} - - {'powered_by'|@translate} + - {'Powered by'|@translate} Piwigo {$VERSION} - - {'send_mail'|@translate} + - {'Contact'|@translate} {'Webmaster'|@translate} diff --git a/themes/default/template/mail/text/html/notification_by_mail.tpl b/themes/default/template/mail/text/html/notification_by_mail.tpl index 5a0115e2f..7a749fe8b 100644 --- a/themes/default/template/mail/text/html/notification_by_mail.tpl +++ b/themes/default/template/mail/text/html/notification_by_mail.tpl @@ -1,24 +1,24 @@

{'Notification'|@translate}

-

{'nbm_content_hello_1'|@translate}{$USERNAME}{'nbm_content_hello_2'|@translate}

+

{'Hello '|@translate}{$USERNAME},

{if isset($subscribe_by_admin)} -

{'nbm_content_subscribe_by_admin'|@translate}

+

{'The webmaster has subscribed you to receiving notifications by mail.'|@translate}

{/if} {if isset($subscribe_by_himself)} -

{'nbm_content_subscribe_by_himself'|@translate}

+

{'You have subscribed to receiving notifications by mail.'|@translate}

{/if} {if isset($unsubscribe_by_admin)} -

{'nbm_content_unsubscribe_by_admin'|@translate}

+

{'The webmaster has unsubscribed you from receiving notifications by mail.'|@translate}

{/if} {if isset($unsubscribe_by_himself)} -

{'nbm_content_unsubscribe_by_himself'|@translate}

+

{'You have unsubscribed from receiving notifications by mail.'|@translate}

{/if} {if isset($content_new_elements_single)} -

{'nbm_content_new_elements'|@translate}{'nbm_content_new_elements_single'|@translate}{$content_new_elements_single.DATE_SINGLE}.

+

{'New elements were added '|@translate}{' on '|@translate}{$content_new_elements_single.DATE_SINGLE}.

{/if} {if isset($content_new_elements_between)} -

{'nbm_content_new_elements'|@translate}{'nbm_content_new_elements_between_1'|@translate}{$content_new_elements_between.DATE_BETWEEN_1}{'nbm_content_new_elements_between_2'|@translate}{$content_new_elements_between.DATE_BETWEEN_2}.

+

{'New elements were added '|@translate}{' between '|@translate}{$content_new_elements_between.DATE_BETWEEN_1}{' and '|@translate}{$content_new_elements_between.DATE_BETWEEN_2}.

{/if} {if not empty($global_new_lines)} @@ -34,15 +34,15 @@ {/if} {if not empty($GOTO_GALLERY_TITLE)} -

{'nbm_content_goto_1'|@translate}{$GOTO_GALLERY_TITLE}{'nbm_content_goto_2'|@translate}

+

{'Go to '|@translate}{$GOTO_GALLERY_TITLE}.

{/if} -

{'nbm_content_byebye'|@translate}

+

{'See you soon,'|@translate}

{$SEND_AS_NAME}



-{'nbm_content_unsubscribe_link'|@translate}{'nbm_content_click_on'|@translate}{$UNSUBSCRIBE_LINK}
-{'nbm_content_subscribe_link'|@translate}{'nbm_content_click_on'|@translate}{$SUBSCRIBE_LINK}
-{'nbm_content_problem_contact'|@translate}{$CONTACT_EMAIL}
+{'To unsubscribe'|@translate}{', click on '|@translate}{$UNSUBSCRIBE_LINK}
+{'To subscribe '|@translate}{', click on '|@translate}{$SUBSCRIBE_LINK}
+{'If you encounter problems or have any question, please send a message to '|@translate}{$CONTACT_EMAIL}


{if not empty($recent_posts)} diff --git a/themes/default/template/mail/text/plain/footer.tpl b/themes/default/template/mail/text/plain/footer.tpl index c386f0962..9c6ea62fb 100644 --- a/themes/default/template/mail/text/plain/footer.tpl +++ b/themes/default/template/mail/text/plain/footer.tpl @@ -1,3 +1,3 @@ ------------------------------------------------------------------------------ -{'Sent by'|@translate} {$GALLERY_URL} - {'powered_by'|@translate} Piwigo {$VERSION} - {'send_mail'|@translate} {$MAIL} +{'Contact'|@translate} {$GALLERY_URL} - {'Contact'|@translate} Piwigo {$VERSION} - {'Contact'|@translate} {$MAIL} diff --git a/themes/default/template/mail/text/plain/notification_by_mail.tpl b/themes/default/template/mail/text/plain/notification_by_mail.tpl index b1928853f..be527da64 100644 --- a/themes/default/template/mail/text/plain/notification_by_mail.tpl +++ b/themes/default/template/mail/text/plain/notification_by_mail.tpl @@ -1,22 +1,22 @@ -{'nbm_content_hello_1'|@translate}{$USERNAME}{'nbm_content_hello_2'|@translate} +{'Hello '|@translate}{$USERNAME}, {if isset($subscribe_by_admin)} -{'nbm_content_subscribe_by_admin'|@translate} +{'The webmaster has subscribed you to receiving notifications by mail.'|@translate} {/if} {if isset($subscribe_by_himself)} -{'nbm_content_subscribe_by_himself'|@translate} +{'You have subscribed to receiving notifications by mail.'|@translate} {/if} {if isset($unsubscribe_by_admin)} -{'nbm_content_unsubscribe_by_admin'|@translate} +{'The webmaster has unsubscribed you from receiving notifications by mail.'|@translate} {/if} {if isset($unsubscribe_by_himself)} -{'nbm_content_unsubscribe_by_himself'|@translate} +{'You have unsubscribed from receiving notifications by mail.'|@translate} {/if} {if isset($content_new_elements_single)} -{'nbm_content_new_elements'|@translate}{'nbm_content_new_elements_single'|@translate}{$content_new_elements_single.DATE_SINGLE}. +{'New elements were added '|@translate}{' on '|@translate}{$content_new_elements_single.DATE_SINGLE}. {/if} {if isset($content_new_elements_between)} -{'nbm_content_new_elements'|@translate}{'nbm_content_new_elements_between_1'|@translate}{$content_new_elements_between.DATE_BETWEEN_1}{'nbm_content_new_elements_between_2'|@translate}{$content_new_elements_between.DATE_BETWEEN_2}. +{'New elements were added '|@translate}{' between '|@translate}{$content_new_elements_between.DATE_BETWEEN_1}{' and '|@translate}{$content_new_elements_between.DATE_BETWEEN_2}. {/if} {if not empty($global_new_lines)} {foreach from=$global_new_lines item=line} @@ -27,15 +27,15 @@ {$custom_mail_content} {/if} {if not empty($GOTO_GALLERY_TITLE)} -{'nbm_content_goto_1'|@translate}{$GOTO_GALLERY_TITLE} {$GOTO_GALLERY_URL} {'nbm_content_goto_2'|@translate} +{'.'|@translate}{$GOTO_GALLERY_TITLE} {$GOTO_GALLERY_URL} {'.'|@translate} {/if} -{'nbm_content_byebye'|@translate} +{'See you soon,'|@translate} {$SEND_AS_NAME} ______________________________________________________________________________ -{'nbm_content_unsubscribe_link'|@translate}{'nbm_content_click_on'|@translate}{$UNSUBSCRIBE_LINK} -{'nbm_content_subscribe_link'|@translate}{'nbm_content_click_on'|@translate}{$SUBSCRIBE_LINK} -{'nbm_content_problem_contact'|@translate}{$CONTACT_EMAIL} +{'To unsubscribe'|@translate}{', click on '|@translate}{$UNSUBSCRIBE_LINK} +{'To subscribe'|@translate}{', click on '|@translate}{$SUBSCRIBE_LINK} +{'If you encounter problems or have any question, please send a message to '|@translate}{$CONTACT_EMAIL} ______________________________________________________________________________ diff --git a/tools/replace.php b/tools/replace.php new file mode 100755 index 000000000..21d38c0e4 --- /dev/null +++ b/tools/replace.php @@ -0,0 +1,53 @@ +#!/usr/bin/php -qn +\n"; + echo "\n"; + exit(1); +} + +$filename = trim($_SERVER['argv'][1]); +$lines = file($filename); +$content = file_get_contents($filename); + +$n = 0; +$nbLines = count($lines); + +$pattern = "`(.*{')(.*)('\|@translate}.*)`Um"; +$replace = "'{\''.keyReplace('\\1').'\'|@translate}'"; + +include "language/en_UK/common.lang.php"; +include "language/en_UK/admin.lang.php"; +include "language/en_UK/upgrade.lang.php"; +include "language/en_UK/install.lang.php"; + +while ($n < $nbLines) { + preg_match_all($pattern, $lines[$n], $matches); + echo str_replace($matches[2], keyReplace($matches[2]), $lines[$n]); + $n++; +} + +function keyReplace($key) { + global $lang; + + if (is_array($key)) { + $translation = array(); + foreach ($key as $i => $k) { + if (isset($lang[$k])) { + $translation = addslashes($lang[$k]); + } else { + $translation = "$k"; + } + } + } else { + if (isset($lang[$key])) { + $translation = addslashes($lang[$key]); + } else { + $translation = "$key"; + } + } + return $translation; +} +?> \ No newline at end of file -- cgit v1.2.3