Prefix for Internationalization

2009-08-24 Thread blablu

Hi,

I want to internationalize a cake website. My intention was to use
prefixes like
/eng/posts/index
/fra/posts/index
/deu/posts/index
to differentiate the languages for the user, search machines and the
app itself.

Whit the routing I do something like that:
Router::connect('/:language/posts/:action/*', array('controller' =>
'posts'), array('language' => '[a-z]{3}'));

This works fine. Now what I don't get to work is the url generating
with the html helper function. I tried to overwrite the url Method
with the AppHelper class, so that the current, selected language will
automtically added to the url to match the above url layout:

function url($url = null, $full = false) {

if(!is_array($url)) {
$urlString = $url;
unset($url);
$url[] = $urlString;
}

if(isset($this->params['language'])) {
$url['prefix'] = $this->params['language'];
} else {
$url['prefix'] = Configure::read('App.defaultLang');
}

$result = parent::url($url, $full);

return $result;
   }


I tried some other ideas with $url['bare'] = '/fra'.$urlString; but
nothing works properly.


Do you have any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



New HABTM saving process in cake 1.2?

2008-08-27 Thread blablu

Hi,

I just updated to the new 1.2 RC2 release, I made the necessary
changes but I still have some trouble with saving habtm relations.

I have the two models German and English with the following relation:

German Model:
var $hasAndBelongsToMany = array(
'English' =>
array('className' => 'English',
'joinTable' => 
'englishes_germans',
'foreignKey' => 'german_id',
'associationForeignKey' => 
'english_id'
));


English Model:
var $hasAndBelongsToMany = array(
'German' =>
array('className' => 'German',
'joinTable' => 
'englishes_germans',
'foreignKey' => 'english_id',
'associationForeignKey' => 
'german_id'
),
);


In the database I have already a relation between German and English,
let's say a German entry "Abschlag" has two relations in the English
table: "damnum" and "discount".

Now I want delete the relations, that means for the $data array:

Array
(
[German] => Array
(
[id] => 1
)

[English] => Array
(
[English] => Array
(
)
)
)

Okay I do this with $this->German->save($data); but no changes in the
relation! Strange, because before the update this works perfectly. But
something I dont understand is, that if adding relations this way
works..

Is there a change in the new release or do I something wrong?

greets

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---