[Isocial-svn] SF.net SVN: isocial: [85]
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <agu...@us...> - 2008-03-16 18:52:53
|
Revision: 85 http://isocial.svn.sourceforge.net/isocial/?rev=85&view=rev Author: aguidrevitch Date: 2008-03-16 11:52:55 -0700 (Sun, 16 Mar 2008) Log Message: ----------- project name can be changed easily now, as well as outgoing email Modified Paths: -------------- app/application_controller.php app/locales/layout/en.php app/locales/layout/ru.php app/locales/user/en.php app/locales/user/ru.php app/views/layouts/application.tpl app/views/message/email/send.tpl app/views/user/email/confirm.tpl app/views/user/email/forgot_password.tpl app/views/user/email/register.tpl app/views/user/login.tpl config/DEFAULT-config.php Added Paths: ----------- app/helpers/translate_helper.php app/vendor/ext_sintags/ app/vendor/ext_sintags/ExtSintags/ app/vendor/ext_sintags/ExtSintags/ExtSintagsParser.php app/vendor/ext_sintags/ExtSintags.php Removed Paths: ------------- app/views/shared/compiled/ app/views/shared/default/compiled/ app/views/shared/loggedin/compiled/ Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-03-16 17:43:01 UTC (rev 84) +++ app/application_controller.php 2008-03-16 18:52:55 UTC (rev 85) @@ -2,6 +2,7 @@ require_once(AK_LIB_DIR.DS.'AkActionController.php'); require_once(AK_APP_DIR.DS.'vendor'.DS.'utf8_to_ascii'.DS.'utf8_to_ascii.php'); +require_once(AK_APP_DIR.DS.'vendor'.DS.'ext_sintags'.DS.'ExtSintags.php'); /** * This file is application-wide controller file. You can put all @@ -20,9 +21,10 @@ var $_errors = array(); var $app_models = array('User', 'Message'); - var $app_helpers = array('AutoComplete', 'City'); + var $app_helpers = array('AutoComplete', 'City', 'Translate'); var $current_user; + function beforeAction ( $method = '' ) { $this->_validateLoginStatus(); } Added: app/helpers/translate_helper.php =================================================================== --- app/helpers/translate_helper.php (rev 0) +++ app/helpers/translate_helper.php 2008-03-16 18:52:55 UTC (rev 85) @@ -0,0 +1,16 @@ +<?php + +class TranslateHelper extends TextHelper { + + /** + * Translate strings to the current locale. PROJECT_NAME will be replaced with real project name + */ + function translate($string, $args = null, $locale_namespace = null) + { + $result = Ak::t($string, $args, empty($locale_namespace) ? + AkInflector::underscore($this->_controller->getControllerName()) : $locale_namespace); + return str_replace('PROJECT_NAME', PROJECT_NAME, $result); + } +} + +?> \ No newline at end of file Modified: app/locales/layout/en.php =================================================================== --- app/locales/layout/en.php 2008-03-16 17:43:01 UTC (rev 84) +++ app/locales/layout/en.php 2008-03-16 18:52:55 UTC (rev 85) @@ -4,19 +4,6 @@ $dictionary = array(); -$dictionary['Email'] = 'Email'; -$dictionary['Password'] = 'Password'; -$dictionary['Login'] = 'Login'; -$dictionary['Remember me'] = 'Remember me'; -$dictionary['Forgot Password?'] = 'Forgot Password?'; -$dictionary['Hello world'] = 'Hello world'; -$dictionary['About iSocial'] = 'About iSocial'; -$dictionary['Terms'] = 'Terms'; -$dictionary['Help'] = 'Help'; -$dictionary['Sign Up'] = 'Sign Up'; -$dictionary['Everyone Can Join'] = 'Everyone Can Join'; - - $dictionary['PhotoApp'] = 'Photos'; $dictionary['GroupApp'] = 'Groups'; $dictionary['EventApp'] = 'Events'; Modified: app/locales/layout/ru.php =================================================================== --- app/locales/layout/ru.php 2008-03-16 17:43:01 UTC (rev 84) +++ app/locales/layout/ru.php 2008-03-16 18:52:55 UTC (rev 85) @@ -10,7 +10,7 @@ $dictionary['Remember me'] = 'Запомнить меня'; $dictionary['Forgot Password?'] = 'Забыли пароль?'; $dictionary['Hello world'] = 'Привет, мир'; -$dictionary['About iSocial'] = 'Про iSocial'; +$dictionary['About PROJECT_NAME'] = 'Про PROJECT_NAME'; $dictionary['Terms'] = 'Соглашение'; $dictionary['Help'] = 'Помощь'; $dictionary['Sign Up'] = 'Регистрация'; Modified: app/locales/user/en.php =================================================================== --- app/locales/user/en.php 2008-03-16 17:43:01 UTC (rev 84) +++ app/locales/user/en.php 2008-03-16 18:52:55 UTC (rev 85) @@ -3,8 +3,5 @@ // File created on: 2008-02-17 15:13:51 $dictionary = array(); -$dictionary['iSocial Login'] = 'iSocial Login'; -$dictionary['Incorrect email/password combination'] = 'Incorrect email/password combination'; -$dictionary['Passwords are case sensitive. Please check your CAPS lock key'] = 'Passwords are case sensitive. Please check your CAPS lock key'; ?> Modified: app/locales/user/ru.php =================================================================== --- app/locales/user/ru.php 2008-03-16 17:43:01 UTC (rev 84) +++ app/locales/user/ru.php 2008-03-16 18:52:55 UTC (rev 85) @@ -3,8 +3,8 @@ // File created on: 2008-02-17 15:13:51 $dictionary = array(); -$dictionary['iSocial Login'] = 'Вход в iSocial'; -$dictionary['Sign Up for iSocial'] = 'Регистрация в iSocial'; +$dictionary['PROJECT_NAME Login'] = 'Вход в PROJECT_NAME'; +$dictionary['Sign Up for PROJECT_NAME'] = 'Регистрация в PROJECT_NAME'; $dictionary['Sign Up'] = 'Регистрация'; $dictionary['Incorrect email/password combination'] = 'Неправильные email и/или пароль'; $dictionary['Passwords are case sensitive. Please check your CAPS lock key'] = 'Пароли чувствительны к регистру. Проверьте, не нажата ли клавиша Caps Lock'; @@ -29,15 +29,15 @@ $dictionary['Check please your email and click on confirmation link'] = 'Проверьте, пожалуйста, Ваш email и подтвердите регистрацию переходом по ссылке'; $dictionary['go to login'] = 'войти'; $dictionary['Confirmation'] = 'Подтверждение'; -$dictionary['Thank you for signing up on iSocial'] = 'Спасибо за регистрацию в iSocial'; +$dictionary['Thank you for signing up on PROJECT_NAME'] = 'Спасибо за регистрацию в PROJECT_NAME'; $dictionary['With best regards'] = 'С наилучшими пожеланиями'; -$dictionary['The iSocial Team'] = 'команда iSocial'; +$dictionary['The PROJECT_NAME Team'] = 'команда PROJECT_NAME'; $dictionary['Hey'] = 'Привет'; -$dictionary['iSocial confirm registration'] = 'Подтверждение регистрации в iSocial'; -$dictionary['You recently registered for iSocial using this email address.'] = 'Вы только что зарегистрировались в iSocial используя этот email адрес'; +$dictionary['PROJECT_NAME confirm registration'] = 'Подтверждение регистрации в PROJECT_NAME'; +$dictionary['You recently registered for PROJECT_NAME using this email address.'] = 'Вы только что зарегистрировались в PROJECT_NAME используя этот email адрес'; $dictionary['To complete your registration, follow the link below'] = 'Для завершения регистрации, перейдите по ссылке ниже'; $dictionary['If clicking on the link doesn\'t work, try copying and pasting it into your browser'] = 'Если переход по ссылке не работает, попробуйте скопировать ее и вставить в адресную строку Вашего браузера'; -$dictionary['If you did not register for iSocial, please disregard this message'] = 'Если Вы не регистрировались в iSocial, проигнорируйте, пожалуйста, это сообщение'; +$dictionary['If you did not register for PROJECT_NAME, please disregard this message'] = 'Если Вы не регистрировались в PROJECT_NAME, проигнорируйте, пожалуйста, это сообщение'; $dictionary['Check out'] = 'Посетите'; $dictionary['if you have any questions'] = 'если у Вас есть какие-либо вопросы'; $dictionary['Thanks'] = 'Спасибо'; @@ -58,7 +58,7 @@ $dictionary['Please enter a new password'] = 'Введите, пожалуйста, новый пароль'; $dictionary['Link for login'] = 'Ссылка для входа'; $dictionary['here'] = 'здесь'; -$dictionary['iSocial Password Reset Confirmation'] = 'Подтверждение сброса пароля на iSocial'; +$dictionary['PROJECT_NAME Password Reset Confirmation'] = 'Подтверждение сброса пароля на PROJECT_NAME'; $dictionary['You recently requested a new password'] = 'Вы недавно запросили новый пароль'; $dictionary['To reset your password, follow the link below'] = 'Чтобы сбросить Ваш старый пароль, перейдите по ссылке ниже'; $dictionary['If you did not reset your password, please disregard this message'] = 'Если Вы не хотите менять пароль, не обращайте внимание на это письмо'; Added: app/vendor/ext_sintags/ExtSintags/ExtSintagsParser.php =================================================================== --- app/vendor/ext_sintags/ExtSintags/ExtSintagsParser.php (rev 0) +++ app/vendor/ext_sintags/ExtSintags/ExtSintagsParser.php 2008-03-16 18:52:55 UTC (rev 85) @@ -0,0 +1,21 @@ +<?php +class ExtSintagsParser extends AkSintagsParser +{ + function Translation($match, $state) + { + switch ($state){ + case AK_LEXER_ENTER: + $this->_translation_tokens = array(); + $this->output .= '<?php echo $translate_helper->translate(\''; + break; + case AK_LEXER_UNMATCHED: + $this->output.= $this->_unescapeChars(str_replace("'","\'",$match), true); + break; + case AK_LEXER_EXIT: + $this->output .= '\', array('.(empty($this->_translation_tokens)?'':join(', ',$this->_translation_tokens)).')); ?>'; + } + return true; + } +} + +?> \ No newline at end of file Added: app/vendor/ext_sintags/ExtSintags.php =================================================================== --- app/vendor/ext_sintags/ExtSintags.php (rev 0) +++ app/vendor/ext_sintags/ExtSintags.php 2008-03-16 18:52:55 UTC (rev 85) @@ -0,0 +1,16 @@ +<?php + +require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'TemplateEngines'.DS.'AkSintags.php'); +require_once(AK_APP_DIR.DS.'vendor'.DS.'ext_sintags'.DS.'ExtSintags'.DS.'ExtSintagsParser.php'); + +class ExtSintags extends AkSintags +{ + + function toPhp() + { + $Parser =& new ExtSintagsParser(); + return $Parser->parse($this->_code); + } +} + +?> \ No newline at end of file Modified: app/views/layouts/application.tpl =================================================================== --- app/views/layouts/application.tpl 2008-03-16 17:43:01 UTC (rev 84) +++ app/views/layouts/application.tpl 2008-03-16 18:52:55 UTC (rev 85) @@ -47,11 +47,11 @@ </div> <div id="pagefooter"> <div class="copyright"> - <a href="http://isocial.sourceforge.net/">iSocial © 2008</a>; + <a href="http://isocial.sourceforge.net/">_{PROJECT_NAME} © 2008</a>; </div> <div class="linksarea"> <ul> - <li><a href="/">_{About iSocial}</a></li> + <li><a href="/">_{About PROJECT_NAME}</a></li> <li><a href="/">_{Terms}</a></li> <li><a href="/">_{Help}</a></li> </ul> Modified: app/views/message/email/send.tpl =================================================================== --- app/views/message/email/send.tpl 2008-03-16 17:43:01 UTC (rev 84) +++ app/views/message/email/send.tpl 2008-03-16 18:52:55 UTC (rev 85) @@ -1,5 +1,5 @@ -Subject: <?= $controller->current_user->name ?> _{sent you a message} _{on} iSocial... -From: iSocial <no-...@ma...> +Subject: <?= $controller->current_user->name ?> _{sent you a message} _{on} _{PROJECT_NAME}... +From: <?= NOREPLY_EMAIL ?> <?= $controller->current_user->name ?> _{sent you a message}. Modified: app/views/user/email/confirm.tpl =================================================================== --- app/views/user/email/confirm.tpl 2008-03-16 17:43:01 UTC (rev 84) +++ app/views/user/email/confirm.tpl 2008-03-16 18:52:55 UTC (rev 85) @@ -1,13 +1,13 @@ -Subject: _{Thank you for signing up on iSocial} -From: iSocial <no-...@ma...> +Subject: _{Thank you for signing up on PROJECT_NAME} +From: <?= NOREPLY_EMAIL ?> <? $user = $controller->User->findFirst(array( 'email' => $controller->params['email'] )) ?> <p>_{Hey}, <?= $user->name ?>!</p> -<p>_{Thank you for signing up on iSocial}.</p> +<p>_{Thank you for signing up on PROJECT_NAME}.</p> <? $link = AK_SITE_URL . "user/login" ?> <p>_{Link for login} <a href="{link}">_{here}</a>.</p> <p>_{With best regards},<br> -_{The iSocial Team}</p> +_{The PROJECT_NAME Team}</p> Modified: app/views/user/email/forgot_password.tpl =================================================================== --- app/views/user/email/forgot_password.tpl 2008-03-16 17:43:01 UTC (rev 84) +++ app/views/user/email/forgot_password.tpl 2008-03-16 18:52:55 UTC (rev 85) @@ -1,5 +1,5 @@ -Subject: _{iSocial Password Reset Confirmation} -From: iSocial <no-...@ma...> +Subject: _{PROJECT_NAME Password Reset Confirmation} +From: <?= NOREPLY_EMAIL ?> <? $user = $controller->User->findFirst(array( 'email' => $controller->params['email'] )) ?> <p>_{Hey}, <?= $user->name ?>!</p> @@ -15,4 +15,4 @@ _{Check out} <a href="{link}">{link}</a> _{if you have any questions}.</p> <p>_{Thanks},<br> -_{The iSocial Team}</p> +_{The PROJECT_NAME Team}</p> Modified: app/views/user/email/register.tpl =================================================================== --- app/views/user/email/register.tpl 2008-03-16 17:43:01 UTC (rev 84) +++ app/views/user/email/register.tpl 2008-03-16 18:52:55 UTC (rev 85) @@ -1,18 +1,18 @@ -Subject: _{iSocial confirm registration} -From: iSocial <no-...@ma...> +Subject: _{PROJECT_NAME confirm registration} +From: <?= NOREPLY_EMAIL ?> <p>_{Hey}, <?= $controller->User->name ?>!</p> -<p>_{You recently registered for iSocial using this email address.} _{To complete your registration, follow the link below}:<br> +<p>_{You recently registered for PROJECT_NAME using this email address.} _{To complete your registration, follow the link below}:<br> <? $link = AK_SITE_URL . "user/confirm?uuid=" . $controller->Confirmation->uuid . "&email=" . $controller->User->email ?> <a href="<?= $link ?>"><?= $link ?></a><br> (_{If clicking on the link doesn't work, try copying and pasting it into your browser})</p> -<p>_{If you did not register for iSocial, please disregard this message}.<br> +<p>_{If you did not register for PROJECT_NAME, please disregard this message}.<br> <? $link = AK_SITE_URL . "help" ?> _{Check out} <a href="{link}">{link}</a> _{if you have any questions}.</p> <p>_{Thanks},<br> -_{The iSocial Team}</p> +_{The PROJECT_NAME Team}</p> Modified: app/views/user/login.tpl =================================================================== --- app/views/user/login.tpl 2008-03-16 17:43:01 UTC (rev 84) +++ app/views/user/login.tpl 2008-03-16 18:52:55 UTC (rev 85) @@ -1,4 +1,4 @@ -<div class="title">_{iSocial Login}</div> +<div class="title">_{PROJECT_NAME Login}</div> <?= $controller->renderErrors() ?> @@ -24,7 +24,7 @@ </div> <div class="formrow"> <label></label> - _{or} <strong><a href="/user/register">_{Sign Up for iSocial}</a></strong> + _{or} <strong><a href="/user/register">_{Sign Up for PROJECT_NAME}</a></strong> </div> <p class="formrow forgotpassword"> <label></label> Modified: config/DEFAULT-config.php =================================================================== --- config/DEFAULT-config.php 2008-03-16 17:43:01 UTC (rev 84) +++ config/DEFAULT-config.php 2008-03-16 18:52:55 UTC (rev 85) @@ -52,9 +52,17 @@ define('AK_AUTOMATICALLY_UPDATE_LANGUAGE_FILES', false); // disable security checks, at least before http://trac.akelos.org/ticket/122 gets fixed define('AK_TEMPLATE_SECURITY_CHECK', false); +// overriding default translation mechanics +define('AK_DEFAULT_TEMPLATE_ENGINE', 'ExtSintags'); -define('I_NOREPLAY_EMAIL', ''); +define('PROJECT_NAME', 'iSocial'); +define('NOREPLY_EMAIL', 'no-reply <no-...@is...>'); +if (!defined(NOREPLY_EMAIL) || + !defined(PROJECT_NAME)) { + die("NOREPLY_EMAIL, PROJECT_NAME should be defined"); +} + include_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'boot.php'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |