[Akelos PHP Framework] #120: Layout localization doesn't work as expected

1 view
Skip to first unread message

Akelos PHP Framework

unread,
Feb 17, 2008, 11:48:12 AM2/17/08
to
#120: Layout localization doesn't work as expected
--------------------------+-------------------------------------------------
Reporter: pillgrim | Type: defect
Status: new | Priority: minor
Milestone: 0.9 | Component: Action Controller
Keywords: locale, i18n |
--------------------------+-------------------------------------------------
Suppose there is application.tpl file which contains some permanent
words/links, eg 'About Us'. Suppose there are 2 controllers/views a and b.
When AK_AUTOMATICALLY_UPDATE_LANGUAGE_FILES is set to true (default
value), both app/locales/a/ru.php and app/locales/b/ru.php do contain the
copy of 'About Us'. So instead of translating once these static words, I
must translate them for each controller. Translations in
app/locales/layout/ru.php are completely ignored if I don't miss enything.

To work around this problem, I've disabled
AK_AUTOMATICALLY_UPDATE_LANGUAGE_FILES and patched Ak.php in the following
way:

{{{

Index: Ak.php
===================================================================
--- Ak.php (revision 478)
+++ Ak.php (working copy)
@@ -186,6 +186,11 @@
return @$string[$try_whith_lang];
}

+ if(isset($controller) &&
!isset($framework_dictionary['layout_dictionary']) &&
is_file(AK_APP_DIR.DS.'locales'.DS.'layout'.DS.$lang.'.php')){
+ require(AK_APP_DIR.DS.'locales'.DS.'layout'.DS.$lang.'.php');
+ $framework_dictionary['layout_dictionary'] =
(array)$dictionary;
+ }
+
if(isset($controller) &&
!isset($framework_dictionary[$controller.'_dictionary']) &&
is_file(AK_APP_DIR.DS.'locales'.DS.$controller.DS.$lang.'.php')){
require(AK_APP_DIR.DS.'locales'.DS.$controller.DS.$lang.'.php');
$framework_dictionary[$controller.'_dictionary'] =
(array)$dictionary;
@@ -193,6 +198,8 @@

if(isset($controller) &&
isset($framework_dictionary[$controller.'_dictionary'][$string])){
$string =
$framework_dictionary[$controller.'_dictionary'][$string];
+ }else if (isset($controller) &&
isset($framework_dictionary['layout_dictionary'][$string])) {
+ $string =
$framework_dictionary['layout_dictionary'][$string];
}else {
$string = isset($framework_dictionary[$string]) ?
$framework_dictionary[$string] : $string;
}

}}}

--
Ticket URL: <http://trac.akelos.org/ticket/120>
Akelos PHP Framework <http://www.akelos.org/>
Akelos PHP Framework

Akelos PHP Framework

unread,
Dec 20, 2009, 11:39:42 AM12/20/09
to
#120: Layout localization doesn't work as expected
-------------------------------+--------------------------------------------
Reporter: pillgrim | Owner:
Type: defect | Status: new
Priority: minor | Milestone: 1.3.0
Component: Action Controller | Resolution:
Keywords: locale, i18n |
-------------------------------+--------------------------------------------
Changes (by bermi):

* milestone: 1.0.1 => 1.3.0

Comment:

Akelos now supports namespaces for translations. It should be investigated
how translations on layouts behave if no namespace is provided.

--
Ticket URL: <http://trac.akelos.org/ticket/120#comment:1>
Reply all
Reply to author
Forward
0 new messages