Re: how to deploy i18n translations ?

2016-01-29 Thread Dino Moreira
One year later and I have this exactly problem. 

Messages in __("English") are translated as expected in WAMP development 
environment. But not in Fedora FC21 Linux Using same apache+php versions...




-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: how to deploy i18n translations ?

2016-01-03 Thread José Lorenzo
In what language are the messages inside __('...') ?

On Tuesday, December 29, 2015 at 11:46:31 AM UTC+1, Alysson Azevedo wrote:
>
> In my development environment the I18n works fine, i can set the locale 
> with both ini_set('intl.default_locale', 'pt_BR') and 
> I18n::locale('pt_BR').
>
> But on my server nothing seems to work.
> Permissions are fine, cakephp can read the src/Locale files and write 
> cache files on tmp/cache/persistent.
> In fact cakephp do write the translated cache file
> $ cat tmp/cache/persistent/app_cake_core_translations_default_pt_br 
> 1450793103
>
> O:20:"Aura\Intl\Translator":4:{s:11:"*fallback";N;s:12:"*formatter";O:32:"Cake\I18n\Formatter\IcuFormatter":0:{}s:9:"*locale";s:5:"pt_br";s:11:"*messages";a:0:{}}
>
>>
> I my environment the *messages has all the translations while server none.
>
> What else could be the problem? I don't know what else can i do.
>
> Thanks.
>
> Alysson Gonçalves de Azevedo
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


how to deploy i18n translations ?

2015-12-29 Thread Alysson Gonçalves de Azevedo
In my development environment the I18n works fine, i can set the locale
with both ini_set('intl.default_locale', 'pt_BR') and I18n::locale('pt_BR').

But on my server nothing seems to work.
Permissions are fine, cakephp can read the src/Locale files and write cache
files on tmp/cache/persistent.
In fact cakephp do write the translated cache file
$ cat tmp/cache/persistent/app_cake_core_translations_default_pt_br
1450793103
O:20:"Aura\Intl\Translator":4:{s:11:"*fallback";N;s:12:"*formatter";O:32:"Cake\I18n\Formatter\IcuFormatter":0:{}s:9:"*locale";s:5:"pt_br";s:11:"*messages";a:0:{}}

>
I my environment the *messages has all the translations while server none.

What else could be the problem? I don't know what else can i do.

Thanks.

Alysson Gonçalves de Azevedo

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


CakePHP 2.6 and PHP PHP 5.6.7-1. Cabnnot run i18n shell

2015-05-01 Thread Athanassios
Hi everyone
After I upgraded my test server from Debian Wheezy (PHP 5.4) to Jessie (PHP 
5.6.7-1) I can no longer run my i18n shell.

The error I am getting is :

Error: Class FMFile does not exist
#0 /var/www/hermonax/lib/Cake/Console/Command/Task/ExtractTask.php(498): 
ReflectionClass-__construct('FMFile')
#1 /var/www/hermonax/lib/Cake/Console/Command/Task/ExtractTask.php(475): 
ExtractTask-_extractPluginValidationMessages(NULL)
#2 /var/www/hermonax/lib/Cake/Console/Command/Task/ExtractTask.php(292): 
ExtractTask-_extractValidationMessages()
#3 /var/www/hermonax/lib/Cake/Console/Command/Task/ExtractTask.php(237): 
ExtractTask-_extract()
#4 /var/www/hermonax/lib/Cake/Console/Shell.php(444): ExtractTask-execute()
#5 /var/www/hermonax/lib/Cake/Console/Shell.php(441): 
Shell-runCommand('execute', Array)
#6 /var/www/hermonax/lib/Cake/Console/ShellDispatcher.php(209): 
Shell-runCommand('extract', Array)
#7 /var/www/hermonax/lib/Cake/Console/ShellDispatcher.php(66): 
ShellDispatcher-dispatch()
#8 /var/www/hermonax/app/Console/cake.php(47): ShellDispatcher::run(Array)
#9 {main}


The rest of the application seems to work without problems,

Thanks in Advance
Athanassios

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: DRY - flash message i18n

2015-04-06 Thread Salines
OK, But what if you first time create post?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: DRY - flash message i18n

2015-04-05 Thread Harold Putman
How about: Your changes have been saved. and There was an error saving 
your changes.



On Saturday, April 4, 2015 at 5:44:09 AM UTC-4, Salines wrote:

 Hi,

 as a person who works mostly non-English web applications, usually 
 frustrating me bake generated flash messages, where each model has its own 
 success and error messages. If you build an application with dozens of 
 models, the process of translation is time-consuming, repetitive sentences 
 where the only difference in the one word that is the model name. and I 
 think that message should be universal, ie unique flash messages.

 I would like to ask you, which sentence would be appropriate to replace 
 existing flash messages, in order to have universally-meaning for all 
 models?

 The 'ModelName' has been saved; x 30

 The 'ModelName' could not be saved. Please, try again; x 30


 I plan to write a plugin that will extend bake shell, including a bake 
 theme. example:

 $this-Flash-success(__('Success: universal message here'));

 and

 $this-Flash-error(__('Error: universal message here'));

 Thank You




-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


DRY - flash message i18n

2015-04-04 Thread Salines
Hi,

as a person who works mostly non-English web applications, usually 
frustrating me bake generated flash messages, where each model has its own 
success and error messages. If you build an application with dozens of 
models, the process of translation is time-consuming, repetitive sentences 
where the only difference in the one word that is the model name. and I 
think that message should be universal, ie unique flash messages.

I would like to ask you, which sentence would be appropriate to replace 
existing flash messages, in order to have universally-meaning for all 
models?

The 'ModelName' has been saved; x 30

The 'ModelName' could not be saved. Please, try again; x 30


I plan to write a plugin that will extend bake shell, including a bake 
theme. example:

$this-Flash-success(__('Success: universal message here'));

and

$this-Flash-error(__('Error: universal message here'));

Thank You


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: cakephp-3.0.0-beta3 Fatal error: Class 'Locale' not found in \cakephp-3.0.0-beta3\vendor\cakephp\cakephp\src\I18n\I18n.php on line 229

2015-01-02 Thread John Andersen
Please provide more information.

How did you install and setup CakePHP 3.0.0-beta3?

What does your folder structure look like? Where is the webroot folder 
located?

Did you setup your webserver to point the documentroot at the webroot?

The reason I ask, is that I just downloaded CakePHP 3.0.0-beta3 and 
followed the quick guide, installed it successfully, then pointed my 
webservers documentroot at the webroot folder and voila, it just worked.

Enjoy, John

On Friday, 2 January 2015 02:37:01 UTC+2, Lorne Dudley wrote:

 I am a novice cakephp user who just downloaded the 3.0.0-beta3 version.  
  I get *Fatal error*: Class 'Locale' not found in 
 *\cakephp-3.0.0-beta3\vendor\cakephp\cakephp\src\I18n\I18n.php* on line 
 *229*when I attempt to access http://localhost/cakephp-3.0.0-beta3

 Can anyone give me some simple instructions as to how to resolve this ?


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: cakephp-3.0.0-beta3 Fatal error: Class 'Locale' not found in \cakephp-3.0.0-beta3\vendor\cakephp\cakephp\src\I18n\I18n.php on line 229

2015-01-02 Thread John Andersen
I see you got the answer in another thread, so ignore my previous post :)
Enjoy, John

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


cakephp-3.0.0-beta3 Fatal error: Class 'Locale' not found in \cakephp-3.0.0-beta3\vendor\cakephp\cakephp\src\I18n\I18n.php on line 229

2015-01-01 Thread Lorne Dudley
I am a novice cakephp user who just downloaded the 3.0.0-beta3 version.  
 I get *Fatal error*: Class 'Locale' not found in 
*\cakephp-3.0.0-beta3\vendor\cakephp\cakephp\src\I18n\I18n.php* on line 
*229*when I attempt to access http://localhost/cakephp-3.0.0-beta3

Can anyone give me some simple instructions as to how to resolve this ?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: i18n problem

2014-10-22 Thread Lucky1968
Hi,

Here's an example:

I have an element which generates a navigation menu.

This is the code in the element:
App::import('Model', array('Shop.ShopCategory'));
$menuObj = new ShopCategory();
$nav_top = $menuObj-nav_top('');
ShopCategory has a translated 'name'-field which is also the models 
displayField.

In the element I have a:
foreach ($nav_top as $menuItem) {} loop

When I call this element from any other controller I can access the value 
of the name-field within this foreach-loop by:
$menuItem['ShopCategory']['name'] 
or $menuItem['ShopCategory'][$menuObj-displayField]

But when I'm in a page from the same 'shop_categories'-controller then 
$menuItem['ShopCategory']['name'] 
or $menuItem['ShopCategory'][$menuObj-displayField] (and all other 
translated keys) are empty.
But then I can find the desired value in 
$nav_top[0]['ShopCategory'][0]['ShopCategory__i18n_name']

Can anyone tell me what goes wrong here?

Thanx in advance.



On Tuesday, October 21, 2014 9:11:39 PM UTC+2, José Lorenzo wrote:

 First time I see this. What Cake version are you using?

 On Monday, October 20, 2014 8:56:39 AM UTC+2, Lucky1968 wrote:

 Hi,

 Is there anyone who can help me with this?

 Thanx.

 On Wednesday, October 1, 2014 9:32:05 AM UTC+2, Lucky1968 wrote:

 Hi,

 I'm using i18n in my application and it seems that in certain views I 
 can use $array['translated_field'] as in other views I need to use 
 $array[0]['Model__i18n_translated_field'] to get the same information 
 coming from the same find in the same model.

 Can anyone tell me why this is?

 This is my code:

 MY MODEL (SettingsSite.php):
 code
 class SettingsSite extends AppModel {

 public $actsAs = array(
 'Translate' = array(
 'slogan'
 )
 );

 ...

 public function first_site() {
 return $this-find('first', array('recursive' = -1));
 }

 }
 /code

 MY VIEWS:
 code
 App::import('Model', array('SettingsSite'));
 $settingsSiteObj = new SettingsSite();
 $first_site = $settingsSiteObj-first_site();
 /code

 RESULTS:
 In (almost) all my view files within my main application and in all my 
 view files in plugins I get the results like this:

 array(
 'SettingsSite' = array(
 ...
 'locale' = 'eng',
 'slogan' = 'Translated Slogan'
 )
 )

 But in (apparently form-) view files in my main application I get the 
 results like this:

 array(
 'SettingsSite' = array(
 ...
 'locale' = 'eng',
 'slogan' = ''
 ),
 (int) 0 = array(
 'SettingsSite__i18n_slogan' = 'Translated Slogan'
 )
 )

 As said, all the code in the view files is identical and therefor 
 pointing to the same function in the same model. And the a.m. result code 
 is the result of debug() within the models function, so IMHO, shouldn't be 
 influenced by anything else in the view file.

 Can someone tell me why this is?

 Thanx.

 Luc



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: i18n problem

2014-10-21 Thread José Lorenzo
First time I see this. What Cake version are you using?

On Monday, October 20, 2014 8:56:39 AM UTC+2, Lucky1968 wrote:

 Hi,

 Is there anyone who can help me with this?

 Thanx.

 On Wednesday, October 1, 2014 9:32:05 AM UTC+2, Lucky1968 wrote:

 Hi,

 I'm using i18n in my application and it seems that in certain views I can 
 use $array['translated_field'] as in other views I need to use 
 $array[0]['Model__i18n_translated_field'] to get the same information 
 coming from the same find in the same model.

 Can anyone tell me why this is?

 This is my code:

 MY MODEL (SettingsSite.php):
 code
 class SettingsSite extends AppModel {

 public $actsAs = array(
 'Translate' = array(
 'slogan'
 )
 );

 ...

 public function first_site() {
 return $this-find('first', array('recursive' = -1));
 }

 }
 /code

 MY VIEWS:
 code
 App::import('Model', array('SettingsSite'));
 $settingsSiteObj = new SettingsSite();
 $first_site = $settingsSiteObj-first_site();
 /code

 RESULTS:
 In (almost) all my view files within my main application and in all my 
 view files in plugins I get the results like this:

 array(
  'SettingsSite' = array(
  ...
  'locale' = 'eng',
  'slogan' = 'Translated Slogan'
  )
 )

 But in (apparently form-) view files in my main application I get the 
 results like this:

 array(
  'SettingsSite' = array(
  ...
  'locale' = 'eng',
  'slogan' = ''
  ),
  (int) 0 = array(
  'SettingsSite__i18n_slogan' = 'Translated Slogan'
  )
 )

 As said, all the code in the view files is identical and therefor 
 pointing to the same function in the same model. And the a.m. result code 
 is the result of debug() within the models function, so IMHO, shouldn't be 
 influenced by anything else in the view file.

 Can someone tell me why this is?

 Thanx.

 Luc



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: i18n problem

2014-10-21 Thread Luc Bernard
Hi,
I'm using 2.3.10



 On 21 Oct 2014, at 21:11, José Lorenzo jose@gmail.com wrote:
 
 First time I see this. What Cake version are you using?
 
 On Monday, October 20, 2014 8:56:39 AM UTC+2, Lucky1968 wrote:
 Hi,
 
 Is there anyone who can help me with this?
 
 Thanx.
 
 On Wednesday, October 1, 2014 9:32:05 AM UTC+2, Lucky1968 wrote:
 Hi,
 
 I'm using i18n in my application and it seems that in certain views I can 
 use $array['translated_field'] as in other views I need to use 
 $array[0]['Model__i18n_translated_field'] to get the same information 
 coming from the same find in the same model.
 
 Can anyone tell me why this is?
 
 This is my code:
 
 MY MODEL (SettingsSite.php):
 code
 class SettingsSite extends AppModel {
 
 public $actsAs = array(
 'Translate' = array(
 'slogan'
 )
 );
 
 ...
 
 public function first_site() {
 return $this-find('first', array('recursive' = -1));
 }
 
 }
 /code
 
 MY VIEWS:
 code
 App::import('Model', array('SettingsSite'));
 $settingsSiteObj = new SettingsSite();
 $first_site = $settingsSiteObj-first_site();
 /code
 
 RESULTS:
 In (almost) all my view files within my main application and in all my view 
 files in plugins I get the results like this:
 array(
 'SettingsSite' = array(
 ...
 'locale' = 'eng',
 'slogan' = 'Translated Slogan'
 )
 )
 But in (apparently form-) view files in my main application I get the 
 results like this:
 array(
 'SettingsSite' = array(
 ...
 'locale' = 'eng',
 'slogan' = ''
 ),
 (int) 0 = array(
 'SettingsSite__i18n_slogan' = 'Translated Slogan'
 )
 )
 As said, all the code in the view files is identical and therefor pointing 
 to the same function in the same model. And the a.m. result code is the 
 result of debug() within the models function, so IMHO, shouldn't be 
 influenced by anything else in the view file.
 
 Can someone tell me why this is?
 
 Thanx.
 
 Luc
 
 -- 
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP
 
 --- 
 You received this message because you are subscribed to a topic in the Google 
 Groups CakePHP group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/cake-php/KXpXkUh2tHI/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: i18n problem

2014-10-20 Thread Lucky1968
Hi,

Is there anyone who can help me with this?

Thanx.

On Wednesday, October 1, 2014 9:32:05 AM UTC+2, Lucky1968 wrote:

 Hi,

 I'm using i18n in my application and it seems that in certain views I can 
 use $array['translated_field'] as in other views I need to use 
 $array[0]['Model__i18n_translated_field'] to get the same information 
 coming from the same find in the same model.

 Can anyone tell me why this is?

 This is my code:

 MY MODEL (SettingsSite.php):
 code
 class SettingsSite extends AppModel {

 public $actsAs = array(
 'Translate' = array(
 'slogan'
 )
 );

 ...

 public function first_site() {
 return $this-find('first', array('recursive' = -1));
 }

 }
 /code

 MY VIEWS:
 code
 App::import('Model', array('SettingsSite'));
 $settingsSiteObj = new SettingsSite();
 $first_site = $settingsSiteObj-first_site();
 /code

 RESULTS:
 In (almost) all my view files within my main application and in all my 
 view files in plugins I get the results like this:

 array(
   'SettingsSite' = array(
   ...
   'locale' = 'eng',
   'slogan' = 'Translated Slogan'
   )
 )

 But in (apparently form-) view files in my main application I get the 
 results like this:

 array(
   'SettingsSite' = array(
   ...
   'locale' = 'eng',
   'slogan' = ''
   ),
   (int) 0 = array(
   'SettingsSite__i18n_slogan' = 'Translated Slogan'
   )
 )

 As said, all the code in the view files is identical and therefor pointing 
 to the same function in the same model. And the a.m. result code is the 
 result of debug() within the models function, so IMHO, shouldn't be 
 influenced by anything else in the view file.

 Can someone tell me why this is?

 Thanx.

 Luc


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: i18n base language and database fields

2014-10-01 Thread Lucky1968
Hi!

I suggest you use your solution c), so make everything in English by __() 
 and do the translation when your application is ready by extracting the 
.pot files. Extremely easy.

Regards,

Luc

On Monday, September 29, 2014 5:55:20 PM UTC+2, Radharadhya Dasa wrote:

 Hi,

 I follow cakePHP conventions, so my database tables and fields have 
 english names, as it so for cake's default error messages. I am building a 
 webapp for a Hungarian client. I would like to use i18n as I think later 
 the client will need internationalizing and localizing. But for now they do 
 not need it.

 So I do not want to create all my view files strings in English and than 
 translate to Hungarian, but I want to use translate behaviour to translate 
 database field names to Hungarian.

 What is the best approach for this scenario?

 rrd 


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: i18n base language and database fields

2014-10-01 Thread Dr. Tarique Sani
On Wed, Oct 1, 2014 at 12:07 PM, Lucky1968 lucbern...@telenet.be wrote:


 I suggest you use your solution c), so make everything in English by __()
  and do the translation when your application is ready by extracting the
 .pot files. Extremely easy.


Yep! +1 to the above suggestion

./Console/cake i18n extract

Will create the .po file for you

T

-- 
=
Hire a CakePHP dev team : http://sanisoft.com
=

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


i18n problem

2014-10-01 Thread Lucky1968
Hi,

I'm using i18n in my application and it seems that in certain views I can 
use $array['translated_field'] as in other views I need to use 
$array[0]['Model__i18n_translated_field'] to get the same information 
coming from the same find in the same model.

Can anyone tell me why this is?

This is my code:

MY MODEL (SettingsSite.php):
code
class SettingsSite extends AppModel {

public $actsAs = array(
'Translate' = array(
'slogan'
)
);

...

public function first_site() {
return $this-find('first', array('recursive' = -1));
}

}
/code

MY VIEWS:
code
App::import('Model', array('SettingsSite'));
$settingsSiteObj = new SettingsSite();
$first_site = $settingsSiteObj-first_site();
/code

RESULTS:
In (almost) all my view files within my main application and in all my view 
files in plugins I get the results like this:

array(
'SettingsSite' = array(
...
'locale' = 'eng',
'slogan' = 'Translated Slogan'
)
)

But in (apparently form-) view files in my main application I get the 
results like this:

array(
'SettingsSite' = array(
...
'locale' = 'eng',
'slogan' = ''
),
(int) 0 = array(
'SettingsSite__i18n_slogan' = 'Translated Slogan'
)
)

As said, all the code in the view files is identical and therefor pointing 
to the same function in the same model. And the a.m. result code is the 
result of debug() within the models function, so IMHO, shouldn't be 
influenced by anything else in the view file.

Can someone tell me why this is?

Thanx.

Luc

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: i18n problem

2014-10-01 Thread Lucky1968
UPDATE: I also have to use $array[0]['Model__i18n_translated_field'] in 
normal (not forms) view files.

On Wednesday, October 1, 2014 9:32:05 AM UTC+2, Lucky1968 wrote:

 Hi,

 I'm using i18n in my application and it seems that in certain views I can 
 use $array['translated_field'] as in other views I need to use 
 $array[0]['Model__i18n_translated_field'] to get the same information 
 coming from the same find in the same model.

 Can anyone tell me why this is?

 This is my code:

 MY MODEL (SettingsSite.php):
 code
 class SettingsSite extends AppModel {

 public $actsAs = array(
 'Translate' = array(
 'slogan'
 )
 );

 ...

 public function first_site() {
 return $this-find('first', array('recursive' = -1));
 }

 }
 /code

 MY VIEWS:
 code
 App::import('Model', array('SettingsSite'));
 $settingsSiteObj = new SettingsSite();
 $first_site = $settingsSiteObj-first_site();
 /code

 RESULTS:
 In (almost) all my view files within my main application and in all my 
 view files in plugins I get the results like this:

 array(
   'SettingsSite' = array(
   ...
   'locale' = 'eng',
   'slogan' = 'Translated Slogan'
   )
 )

 But in (apparently form-) view files in my main application I get the 
 results like this:

 array(
   'SettingsSite' = array(
   ...
   'locale' = 'eng',
   'slogan' = ''
   ),
   (int) 0 = array(
   'SettingsSite__i18n_slogan' = 'Translated Slogan'
   )
 )

 As said, all the code in the view files is identical and therefor pointing 
 to the same function in the same model. And the a.m. result code is the 
 result of debug() within the models function, so IMHO, shouldn't be 
 influenced by anything else in the view file.

 Can someone tell me why this is?

 Thanx.

 Luc


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: i18n base language and database fields

2014-09-30 Thread José Lorenzo
I'm not sure I follow, can you give an example of what you need to do?

On Monday, September 29, 2014 5:55:20 PM UTC+2, Radharadhya Dasa wrote:

 Hi,

 I follow cakePHP conventions, so my database tables and fields have 
 english names, as it so for cake's default error messages. I am building a 
 webapp for a Hungarian client. I would like to use i18n as I think later 
 the client will need internationalizing and localizing. But for now they do 
 not need it.

 So I do not want to create all my view files strings in English and than 
 translate to Hungarian, but I want to use translate behaviour to translate 
 database field names to Hungarian.

 What is the best approach for this scenario?

 rrd 


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: i18n base language and database fields

2014-09-30 Thread Radharadhya Dasa
Actually this si 2 questions.

1. View files are generated by bake. So I have for example:
echo $this-Form-input('name');
This will generate a lable contains the string 'Name'. As I understand it
could be translated into Hungarian without manually adding the label
property, and than use __() method and translate.
But I am not sure how should I do the translation. i18n shell will
automatically extratct coloumn names also?

2. I added a menu to my default.ctp with a lot of links in an unordered
list. Links are in Hungarian as the current request from the client is
Hungarian only. I am pretty sure that they would like to have English also,
but later.
So this is a teoretical question. What should I do?
a) make it Hungarian without __() and worry about other languages when they
actually ask it?
b) make it Hungarian with __() and later I could make translation
c) make it English with __() and do Hungarian translation now.
d) something else.

rrd

2014-09-30 14:40 GMT+02:00 José Lorenzo jose@gmail.com:

 I'm not sure I follow, can you give an example of what you need to do?

 On Monday, September 29, 2014 5:55:20 PM UTC+2, Radharadhya Dasa wrote:

 Hi,

 I follow cakePHP conventions, so my database tables and fields have
 english names, as it so for cake's default error messages. I am building a
 webapp for a Hungarian client. I would like to use i18n as I think later
 the client will need internationalizing and localizing. But for now they do
 not need it.

 So I do not want to create all my view files strings in English and than
 translate to Hungarian, but I want to use translate behaviour to translate
 database field names to Hungarian.

 What is the best approach for this scenario?

 rrd

  --
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP

 ---
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


i18n base language and database fields

2014-09-29 Thread Radharadhya Dasa
Hi,

I follow cakePHP conventions, so my database tables and fields have english 
names, as it so for cake's default error messages. I am building a webapp 
for a Hungarian client. I would like to use i18n as I think later the 
client will need internationalizing and localizing. But for now they do not 
need it.

So I do not want to create all my view files strings in English and than 
translate to Hungarian, but I want to use translate behaviour to translate 
database field names to Hungarian.

What is the best approach for this scenario?

rrd 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


i18n Tree problem

2013-12-01 Thread Lucky1968
 When trying to get language dependent values through javascript from a 
translated tree model I only get the tree spacers without the actual values.

In my controller I have: 

  $modelObj = new $model_name();
  if($modelObj-actsAs[0] == 'Tree') { 
   $optionslist = $modelObj-generateTreeList(null, null, null, 
TREE_SPACER_ADMIN_LISTING); 
  } else { 
   $optionslist = $modelObj-find('list'); 
  } 
  $options = ''; 
  foreach($optionslist as $key = $value) { 
   $options .= 'option value=' . $key . '' . $value . 
'/option'; 
  } 
  echo $options; 

This worked fine in my 1 language site but after changing to i18n the 
$value only holds the TREE_SPACER_ADMIN_LISTING without the 
actual $displayField value. 
When used in combination with a NON-TREE-object it gives me a $displayfield 
value but not in the selected language 

Can anyone tell me what to add to my code?  

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: i18n Tree problem

2013-12-01 Thread AD7six
Check the Data that comes back from the 
dbhttps://github.com/cakephp/cakephp/blob/master/lib/Cake/Model/Behavior/TreeBehavior.php#L386.
 
Either it's missing completely (probably due to the recursive setting used 
in the find, since translation data is joined in) or the data is in a 
different position when translated and you'll need to specify the value 
path explicitly.

AD

On Sunday, 1 December 2013 09:16:11 UTC+1, Lucky1968 wrote:

 When trying to get language dependent values through javascript from a 
 translated tree model I only get the tree spacers without the actual values.

 In my controller I have: 

   $modelObj = new $model_name();
   if($modelObj-actsAs[0] == 'Tree') { 
$optionslist = $modelObj-generateTreeList(null, null, 
 null, TREE_SPACER_ADMIN_LISTING); 
   } else { 
$optionslist = $modelObj-find('list'); 
   } 
   $options = ''; 
   foreach($optionslist as $key = $value) { 
$options .= 'option value=' . $key . '' . $value . 
 '/option'; 
   } 
   echo $options; 

 This worked fine in my 1 language site but after changing to i18n the 
 $value only holds the TREE_SPACER_ADMIN_LISTING without the 
 actual $displayField value. 
 When used in combination with a NON-TREE-object it gives me a 
 $displayfield value but not in the selected language 

 Can anyone tell me what to add to my code?  


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


i18n shell validation msgs not being extracted

2013-09-17 Thread aka
I'm trying to generate the pot files from my site with cake's i18n shell 
useing cake 2.3. As mentioned in the cake docs the shell should 
automatically extract the validation msgs. However, none of the validation 
strings are added to my pot files. 

My validation array simply looks like: 
public $validate = array( 
'currency' = array(
'notempty' = array(
'rule' = array('notempty'),
'message' = 'Select a currency'
),
),
'title' = array(
'notempty' = array(
'rule' = array('notempty'),
'message' = 'Fill out a title'
),
)

... etc
)


What am i not seeing here?!

Thanks allot!

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Pagination with i18n field condition (pagination + translation behavior error)

2013-09-10 Thread aka
Why is this no working (throws a column not found) :

$conditions = array('OR' = array( 'I18n__title.content LIKE' = 
'%'.$searchKey.'%'));

$this-paginate = array(
'conditions' = $conditions
);

$results = $this-paginate();

*Error: * SQLSTATE[42S22]: Column not found: 1054 Unknown column 
'I18n__title.content' in 'where clause'

While a normal find works fine: 
$this-MyModel-find('all',  array('conditions' = $conditions));



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Pagination with i18n field condition (pagination + translation behavior error)

2013-09-10 Thread aka
Sorry, a little typo in my example:

$conditions = array('OR' = array( 'I18n__title.content LIKE' = 
'%'.$searchKey.'%'));

should be 

$conditions = array('OR' = array( I18n__titleTranslation LIKE' = 
'%'.$searchKey.'%'));


That doesn't change the outcome though.. 


On Tuesday, September 10, 2013 12:30:53 PM UTC+2, aka wrote:

 Why is this no working (throws a column not found) :

 $conditions = array('OR' = array( 'I18n__title.content LIKE' = 
 '%'.$searchKey.'%'));

 $this-paginate = array(
 'conditions' = $conditions
 );

 $results = $this-paginate();

 *Error: * SQLSTATE[42S22]: Column not found: 1054 Unknown column 
 'I18n__title.content' in 'where clause'

 While a normal find works fine: 
 $this-MyModel-find('all',  array('conditions' = $conditions));





-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


i18n Search for string in multiple translations

2013-09-03 Thread aka
Hi there,

Im trying to set up a search function for a multilingual website. I'm using 
cake's (2.2) translation behavior and my translated fields are saved in a 
separate table (for example: I18n__titleTranslation)

Now i would like to search these records and their translations but the 
only way I seem to be able to do that is by looping through all the site 
languages (6 in my case) and setting $this-Model-locale = lang for 
every language before I do a find. To me this comes over as a bit expensive 
and in the process actually can result in duplicate results (keyword 'test' 
can be found on multiple translations). 

Does anyone have an idea of how to tackle this? 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: CakePhp 2.x - Internationalization/Localization/Translate Behavior/i18n - How to use in 2.x?

2013-04-14 Thread Livin Inchina

Hi Kicaj and thanks for your post, I stumbled upon it before to start the 
internationalization of project.
It was helpful but my main problem is that I can't save data with 
validation, I have to turn them off on my save($data,false) and I can't 
figure why it won't work!

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: CakePhp 2.x - Internationalization/Localization/Translate Behavior/i18n - How to use in 2.x?

2013-04-09 Thread kicaj
Read my article on bakery site: 
http://bakery.cakephp.org/articles/kicaj/2013/01/27/internationalization_with_static_and_dynamic_content_routing_and_switching

W dniu wtorek, 2 kwietnia 2013 05:06:25 UTC+2 użytkownik Livin Inchina 
napisał:

 Hi everyone!

 I'm having a hard time making my website multilingual and I after going 
 through the net seeking for answers, I found out that I wasn't the first 
 one to have these issues with version 2.x.

 I'm trying to translate my blog. So I have a Post.php model, a 
 PostsController.php and a view admin_edit.ctp.

 Using the console, I've created the i18n table by hitting the command  
 cake i18n.

 Following are my files:

 *bootstrap.php*

 Configure::write('Config.languages', array('fra','eng'));
 Configure::write('Config.language','fra');
 *
 *
 *Post.php*

 ?php
 class Post extends AppModel{

 public $actsAs = array(
 'Translate' = array(
 'name'= '_name',
 'slug'= '_slug',
 'content' = '_content'
 )
 );
 }

 *PostsController.php*
 *
 *
 function admin_edit($id=null){

 if (!empty($this-request-data)) {

 $this-Post-create();
 $this-Post-locale = Configure::read('Config.languages');

 if (!empty($this-request-data['Post']['file']['name'])  
 !empty($this-request-data['Post']['photo'])) {
 $dir = IMAGES.'news';
 if (!file_exists($dir)) {
 mkdir($dir,0777);
 }
 $photo = preg_replace('~[^\w-\.]~', '-', 
 strtolower($this-request-data['Post']['photo']['fra']));
 $f = explode('.',$this-request-data['Post']['file']['name']);
 $ext = '.'.end($f);
 $filename = $photo.date('-YmdHis');

 move_uploaded_file($this-request-data['Post']['file']['tmp_name'], 
 $dir.DS.$filename.$ext);
 }

 if ($this-Post-save($this-request-data, false)) {
 debug($this-request-data);
 // $this-redirect(array('action' = 'admin_index'));
 }

 if ($id!=null) {
 $this-Post-id = $id;
 $this-request-data = $this-Post-readAll();
 }
 }
 }

 *admin_edit.ctp*
 *
 *
 ?php
 echo $this-Form-create('Post', array('type' = 'file'));

 echo $this-Form-input('file', array('type' = 'file'));
 echo $this-Form-input('photo', array();

 foreach (Configure::read('Config.languages') as $lang):
 echo $this-Form-input('Post.name.'.$lang, array('div' = false, 'label' 
 = false));
 echo $this-Form-input('Post.slug.'.$lang, array('div' = false, 'label' 
 = false));
 echo $this-Form-textarea('Post.content.'.$lang, array('div' = false, 
 'label' = false));
 endforeach;

 echo $this-Form-input('id');
 echo $this-Form-hidden('created');

 echo $this-Form-end('done');
 ?


 --

 You will notice that in my controller I use $this-Post-locale = 
 Configure::read('Config.languages'); to save all my languages at once.
 To do that, I also loop my input in the view foreach 
 (Configure::read('Config.languages') as $lang):

 This code is working as it but it's not enough. As you can see I have a 
 picture and I would like to insert its name in the posts table.
 Right now, if I want to save the name of the picture, I have to do like 
 that: my-image.jpg, meaning I have to manually format it in the form.
 Also, I have a slug and to create it I would like to use the name field 
 and add - instead of the spaces to format my slug.

 With my code above, I just do a simple 
 $this-Post-save($this-request-data, false) but I cannot format my data.
 What I'd like to do is something like that for example:

 $success = array(
 'name'= $name,
 'slug'= $slug,
 'photo'   = $photo,
 'content' = $content,
 'id'  = $id
 );
 $this-Post-save($success,false);

 The problem when I do that is that it needs to be saved in as many 
 languages as I have because. When I loop it to save all the languages, 
 everything is save in the i18n table,
 all the values are translated, the only problem is that the locale column 
 data are all the same, the locale that has been used when saved.

 By the way, you will notice that I disabled the validation in the second 
 parameter of the save. If I don't do that, nothing happens.
 That's one of the problem I can't figure, why couldn't I do validations?

 So my questions are, how can I save my data in both tables i18n and posts 
 with the possibility to format the data before saving?
 How come I have to disable the validation to make the saving work?
 If you already done that on V2.x, how did you do it?

 I'm really stuck on this, the only solution I have right now is no 
 validations, and format data manually in the form.
 This is really not convenient and not pro.

 I really hope somebody will help me, I've posted this problem in every 
 forum and group I know, and nobody answered me yet.
 Help for a desperate guy...

 Thank you very very much for your help!


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com

CakePhp 2.x - Internationalization/Localization/Translate Behavior/i18n - How to use in 2.x?

2013-04-02 Thread Livin Inchina
Hi everyone!

I'm having a hard time making my website multilingual and I after going 
through the net seeking for answers, I found out that I wasn't the first 
one to have these issues with version 2.x.

I'm trying to translate my blog. So I have a Post.php model, a 
PostsController.php and a view admin_edit.ctp.

Using the console, I've created the i18n table by hitting the command  
cake i18n.

Following are my files:

*bootstrap.php*

Configure::write('Config.languages', array('fra','eng'));
Configure::write('Config.language','fra');
*
*
*Post.php*

?php
class Post extends AppModel{

public $actsAs = array(
'Translate' = array(
'name'= '_name',
'slug'= '_slug',
'content' = '_content'
)
);
}

*PostsController.php*
*
*
function admin_edit($id=null){

if (!empty($this-request-data)) {

$this-Post-create();
$this-Post-locale = Configure::read('Config.languages');

if (!empty($this-request-data['Post']['file']['name'])  
!empty($this-request-data['Post']['photo'])) {
$dir = IMAGES.'news';
if (!file_exists($dir)) {
mkdir($dir,0777);
}
$photo = preg_replace('~[^\w-\.]~', '-', 
strtolower($this-request-data['Post']['photo']['fra']));
$f = explode('.',$this-request-data['Post']['file']['name']);
$ext = '.'.end($f);
$filename = $photo.date('-YmdHis');

move_uploaded_file($this-request-data['Post']['file']['tmp_name'], 
$dir.DS.$filename.$ext);
}

if ($this-Post-save($this-request-data, false)) {
debug($this-request-data);
// $this-redirect(array('action' = 'admin_index'));
}

if ($id!=null) {
$this-Post-id = $id;
$this-request-data = $this-Post-readAll();
}
}
}

*admin_edit.ctp*
*
*
?php
echo $this-Form-create('Post', array('type' = 'file'));

echo $this-Form-input('file', array('type' = 'file'));
echo $this-Form-input('photo', array();

foreach (Configure::read('Config.languages') as $lang):
echo $this-Form-input('Post.name.'.$lang, array('div' = false, 'label' 
= false));
echo $this-Form-input('Post.slug.'.$lang, array('div' = false, 'label' 
= false));
echo $this-Form-textarea('Post.content.'.$lang, array('div' = false, 
'label' = false));
endforeach;

echo $this-Form-input('id');
echo $this-Form-hidden('created');

echo $this-Form-end('done');
?


--

You will notice that in my controller I use $this-Post-locale = 
Configure::read('Config.languages'); to save all my languages at once.
To do that, I also loop my input in the view foreach 
(Configure::read('Config.languages') as $lang):

This code is working as it but it's not enough. As you can see I have a 
picture and I would like to insert its name in the posts table.
Right now, if I want to save the name of the picture, I have to do like 
that: my-image.jpg, meaning I have to manually format it in the form.
Also, I have a slug and to create it I would like to use the name field and 
add - instead of the spaces to format my slug.

With my code above, I just do a simple 
$this-Post-save($this-request-data, false) but I cannot format my data.
What I'd like to do is something like that for example:

$success = array(
'name'= $name,
'slug'= $slug,
'photo'   = $photo,
'content' = $content,
'id'  = $id
);
$this-Post-save($success,false);

The problem when I do that is that it needs to be saved in as many 
languages as I have because. When I loop it to save all the languages, 
everything is save in the i18n table,
all the values are translated, the only problem is that the locale column 
data are all the same, the locale that has been used when saved.

By the way, you will notice that I disabled the validation in the second 
parameter of the save. If I don't do that, nothing happens.
That's one of the problem I can't figure, why couldn't I do validations?

So my questions are, how can I save my data in both tables i18n and posts 
with the possibility to format the data before saving?
How come I have to disable the validation to make the saving work?
If you already done that on V2.x, how did you do it?

I'm really stuck on this, the only solution I have right now is no 
validations, and format data manually in the form.
This is really not convenient and not pro.

I really hope somebody will help me, I've posted this problem in every 
forum and group I know, and nobody answered me yet.
Help for a desperate guy...

Thank you very very much for your help!

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Extracting core validation messages for I18N with the cake shell

2012-12-19 Thread AD7six
why not just use https://github.com/cakephp/localized#po-files

AD

On Sunday, 9 December 2012 20:50:15 UTC+1, Cyrille Faucheux wrote:

 That's also what I thought.

 Which is the reason why I can't see why I cannot extract in one operation 
 every messages that may be displayed by my app: the core messages (like you 
 said, the times/dates stuff), my app messages (from my views, 
 controllers...) and the model validation messages.

 I've opened a ticket on lighthouse about my issue: 
 http://cakephp.lighthouseapp.com/projects/42648-cakephp/tickets/3442

 Le dimanche 9 décembre 2012 20:01:07 UTC+1, euromark a écrit :

 @cricket
 I think you messed sth up earlier.
 the dev messages (domain dev) are the ones not public.
 the normal core messages will very much end up in the frontend (being 
 times/dates for examples or other global stuff)

 its just that they do not change that often - compared to the app ones.




 Am Sonntag, 9. Dezember 2012 03:00:02 UTC+1 schrieb cricket:

 On Sat, Dec 8, 2012 at 5:10 AM, Cyrille Faucheux 
 cyrille@gmail.com wrote: 
  Yes, using version control is a solution, just as saving and replacing 
 some 
  files, but I don't like this solution, because it requires a manual 
  intervention. 
  
  What do you mean by nothing will get done ? That it's working the 
 way 
  it's meant to work, or that nobody will take care of it ? 

 I was referring to your unwillingness to overwrite your pot files. But 
 I think now that I misunderstood what you meant. When you extract the 
 core files you should be asked: Would you like to merge all domains 
 [sic] strings into the default.pot file? 

 If you choose not to, you'll end up with several files: 

 app.pot  cake_console.pot  cake_dev.pot  cake.pot  default.pot 

 The default file is the one with your app's strings. 

  I can submit a patch if it's what you are pointing out. I'm just 
 looking for 
  some insight about how it's supposed to work. 

 I don't know what the initial problem is, or whether it's a bug. If 
 you think it is you can report it here (or check if it's already 
 there): 

 http://cakephp.lighthouseapp.com/dashboard 

  Currently, I can't see why the extract process has an option 
  --extract-core. Why would someone want to ignore the core messages ? 
 And 
  why extracting the core messages is exclusive to extracting the 
 validation 
  messages ? Does someone knows why it has been desined this way ? 

 Many people (myself included) will not want to translate the core 
 messages because with debug = 0 they will not be seen by the public. 
 If I'm not going to take the time to translate them, I'm not going to 
 want them extracted (and certainly not merged into default.pot). The 
 exception is for 404 errors and such, but those can be placed in 
 View/Error and they'll be extracted along with the rest of the 
 non-core files. But missing_action, missing_table, etc. can be ignored 
 because those aren't errors that should be thrown in a live site. Of 
 course, it's another story if your developers would prefer reading dev 
 errors in their own language. But it's good to have the option whether 
 to extract everything or just the app's strings because a lot of 
 people can't be bothered. 



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Extracting core validation messages for I18N with the cake shell

2012-12-09 Thread euromark
@cricket
I think you messed sth up earlier.
the dev messages (domain dev) are the ones not public.
the normal core messages will very much end up in the frontend (being 
times/dates for examples or other global stuff)

its just that they do not change that often - compared to the app ones.




Am Sonntag, 9. Dezember 2012 03:00:02 UTC+1 schrieb cricket:

 On Sat, Dec 8, 2012 at 5:10 AM, Cyrille Faucheux 
 cyrille@gmail.com javascript: wrote: 
  Yes, using version control is a solution, just as saving and replacing 
 some 
  files, but I don't like this solution, because it requires a manual 
  intervention. 
  
  What do you mean by nothing will get done ? That it's working the way 
  it's meant to work, or that nobody will take care of it ? 

 I was referring to your unwillingness to overwrite your pot files. But 
 I think now that I misunderstood what you meant. When you extract the 
 core files you should be asked: Would you like to merge all domains 
 [sic] strings into the default.pot file? 

 If you choose not to, you'll end up with several files: 

 app.pot  cake_console.pot  cake_dev.pot  cake.pot  default.pot 

 The default file is the one with your app's strings. 

  I can submit a patch if it's what you are pointing out. I'm just looking 
 for 
  some insight about how it's supposed to work. 

 I don't know what the initial problem is, or whether it's a bug. If 
 you think it is you can report it here (or check if it's already 
 there): 

 http://cakephp.lighthouseapp.com/dashboard 

  Currently, I can't see why the extract process has an option 
  --extract-core. Why would someone want to ignore the core messages ? 
 And 
  why extracting the core messages is exclusive to extracting the 
 validation 
  messages ? Does someone knows why it has been desined this way ? 

 Many people (myself included) will not want to translate the core 
 messages because with debug = 0 they will not be seen by the public. 
 If I'm not going to take the time to translate them, I'm not going to 
 want them extracted (and certainly not merged into default.pot). The 
 exception is for 404 errors and such, but those can be placed in 
 View/Error and they'll be extracted along with the rest of the 
 non-core files. But missing_action, missing_table, etc. can be ignored 
 because those aren't errors that should be thrown in a live site. Of 
 course, it's another story if your developers would prefer reading dev 
 errors in their own language. But it's good to have the option whether 
 to extract everything or just the app's strings because a lot of 
 people can't be bothered. 


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Extracting core validation messages for I18N with the cake shell

2012-12-09 Thread Cyrille Faucheux
That's also what I thought.

Which is the reason why I can't see why I cannot extract in one operation 
every messages that may be displayed by my app: the core messages (like you 
said, the times/dates stuff), my app messages (from my views, 
controllers...) and the model validation messages.

I've opened a ticket on lighthouse about my issue: 
http://cakephp.lighthouseapp.com/projects/42648-cakephp/tickets/3442

Le dimanche 9 décembre 2012 20:01:07 UTC+1, euromark a écrit :

 @cricket
 I think you messed sth up earlier.
 the dev messages (domain dev) are the ones not public.
 the normal core messages will very much end up in the frontend (being 
 times/dates for examples or other global stuff)

 its just that they do not change that often - compared to the app ones.




 Am Sonntag, 9. Dezember 2012 03:00:02 UTC+1 schrieb cricket:

 On Sat, Dec 8, 2012 at 5:10 AM, Cyrille Faucheux 
 cyrille@gmail.com wrote: 
  Yes, using version control is a solution, just as saving and replacing 
 some 
  files, but I don't like this solution, because it requires a manual 
  intervention. 
  
  What do you mean by nothing will get done ? That it's working the 
 way 
  it's meant to work, or that nobody will take care of it ? 

 I was referring to your unwillingness to overwrite your pot files. But 
 I think now that I misunderstood what you meant. When you extract the 
 core files you should be asked: Would you like to merge all domains 
 [sic] strings into the default.pot file? 

 If you choose not to, you'll end up with several files: 

 app.pot  cake_console.pot  cake_dev.pot  cake.pot  default.pot 

 The default file is the one with your app's strings. 

  I can submit a patch if it's what you are pointing out. I'm just 
 looking for 
  some insight about how it's supposed to work. 

 I don't know what the initial problem is, or whether it's a bug. If 
 you think it is you can report it here (or check if it's already 
 there): 

 http://cakephp.lighthouseapp.com/dashboard 

  Currently, I can't see why the extract process has an option 
  --extract-core. Why would someone want to ignore the core messages ? 
 And 
  why extracting the core messages is exclusive to extracting the 
 validation 
  messages ? Does someone knows why it has been desined this way ? 

 Many people (myself included) will not want to translate the core 
 messages because with debug = 0 they will not be seen by the public. 
 If I'm not going to take the time to translate them, I'm not going to 
 want them extracted (and certainly not merged into default.pot). The 
 exception is for 404 errors and such, but those can be placed in 
 View/Error and they'll be extracted along with the rest of the 
 non-core files. But missing_action, missing_table, etc. can be ignored 
 because those aren't errors that should be thrown in a live site. Of 
 course, it's another story if your developers would prefer reading dev 
 errors in their own language. But it's good to have the option whether 
 to extract everything or just the app's strings because a lot of 
 people can't be bothered. 



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Extracting core validation messages for I18N with the cake shell

2012-12-08 Thread Cyrille Faucheux
Yes, using version control is a solution, just as saving and replacing some 
files, but I don't like this solution, because it requires a manual 
intervention.

What do you mean by nothing will get done ? That it's working the way 
it's meant to work, or that nobody will take care of it ?

I can submit a patch if it's what you are pointing out. I'm just looking 
for some insight about how it's supposed to work.

Currently, I can't see why the extract process has an option 
--extract-core. Why would someone want to ignore the core messages ? And 
why extracting the core messages is exclusive to extracting the validation 
messages ? Does someone knows why it has been desined this way ?

Le vendredi 7 décembre 2012 23:58:24 UTC+1, cricket a écrit :

 The only thing you can be sure of is that nothing will get done. Just 
 make a copy of your Locale directory. Better yet: use version control. 

 On Fri, Dec 7, 2012 at 5:23 AM, Cyrille Faucheux 
 cyrille@gmail.com javascript: wrote: 
  Because the extracting process overwrite all the files. 
  I probably could do it manually, by backuping and replacing some files, 
 but 
  I don't want to since I'm sure it will lead to mistakes. 
  
  Le jeudi 6 décembre 2012 17:07:09 UTC+1, euromark a écrit : 
  
  why not running it twice? once for the core and once for the app? 
  
  
  Am Donnerstag, 6. Dezember 2012 09:24:25 UTC+1 schrieb Cyrille 
 Faucheux: 
  
  Hi everyone, 
  
  I'm trying to internationalize an application, and I face some 
 problems 
  with the I18N shell when extracting messages. 
  
  When I run the extract task (cake.bat i18n extract), I'm asked whether 
 I 
  want to extract messages from the Cake core, which is what I want 
 since 
  there is some important messages to translate in the core (for 
 example, the 
  names of the months, in the Form helper). 
  
  But when the extraction of core messages is enabled, the extraction of 
  validation messages from the models is disabled. Of course, I want 
 both... 
  
  I can see some logic behind that, for example, having the translations 
 of 
  the core for one version of Cake which can be shared among several 
  applications, but this is not the case. 
  
  Does someone know why this is working this way, if this is a bug or a 
  feature I'm not using properly ? 
  
  Thanks in advance. 
  
  Cyrille 
  
  -- 
  Like Us on FaceBook https://www.facebook.com/CakePHP 
  Find us on Twitter http://twitter.com/CakePHP 
  
  --- 
  You received this message because you are subscribed to the Google 
 Groups 
  CakePHP group. 
  To post to this group, send email to cake...@googlegroups.comjavascript:. 

  To unsubscribe from this group, send email to 
  cake-php+u...@googlegroups.com javascript:. 
  Visit this group at http://groups.google.com/group/cake-php?hl=en. 
  
  


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Extracting core validation messages for I18N with the cake shell

2012-12-08 Thread lowpass
On Sat, Dec 8, 2012 at 5:10 AM, Cyrille Faucheux
cyrille.fauch...@gmail.com wrote:
 Yes, using version control is a solution, just as saving and replacing some
 files, but I don't like this solution, because it requires a manual
 intervention.

 What do you mean by nothing will get done ? That it's working the way
 it's meant to work, or that nobody will take care of it ?

I was referring to your unwillingness to overwrite your pot files. But
I think now that I misunderstood what you meant. When you extract the
core files you should be asked: Would you like to merge all domains
[sic] strings into the default.pot file?

If you choose not to, you'll end up with several files:

app.pot  cake_console.pot  cake_dev.pot  cake.pot  default.pot

The default file is the one with your app's strings.

 I can submit a patch if it's what you are pointing out. I'm just looking for
 some insight about how it's supposed to work.

I don't know what the initial problem is, or whether it's a bug. If
you think it is you can report it here (or check if it's already
there):

http://cakephp.lighthouseapp.com/dashboard

 Currently, I can't see why the extract process has an option
 --extract-core. Why would someone want to ignore the core messages ? And
 why extracting the core messages is exclusive to extracting the validation
 messages ? Does someone knows why it has been desined this way ?

Many people (myself included) will not want to translate the core
messages because with debug = 0 they will not be seen by the public.
If I'm not going to take the time to translate them, I'm not going to
want them extracted (and certainly not merged into default.pot). The
exception is for 404 errors and such, but those can be placed in
View/Error and they'll be extracted along with the rest of the
non-core files. But missing_action, missing_table, etc. can be ignored
because those aren't errors that should be thrown in a live site. Of
course, it's another story if your developers would prefer reading dev
errors in their own language. But it's good to have the option whether
to extract everything or just the app's strings because a lot of
people can't be bothered.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Extracting core validation messages for I18N with the cake shell

2012-12-07 Thread Cyrille Faucheux
Because the extracting process overwrite all the files.
I probably could do it manually, by backuping and replacing some files, but 
I don't want to since I'm sure it will lead to mistakes.

Le jeudi 6 décembre 2012 17:07:09 UTC+1, euromark a écrit :

 why not running it twice? once for the core and once for the app?


 Am Donnerstag, 6. Dezember 2012 09:24:25 UTC+1 schrieb Cyrille Faucheux:

 Hi everyone,

 I'm trying to internationalize an application, and I face some problems 
 with the I18N shell when extracting messages.

 When I run the extract task (cake.bat i18n extract), I'm asked whether I 
 want to extract messages from the Cake core, which is what I want since 
 there is some important messages to translate in the core (for example, the 
 names of the months, in the Form helper).

 But when the extraction of core messages is enabled, the extraction of 
 validation messages from the models is disabled. Of course, I want both...

 I can see some logic behind that, for example, having the translations of 
 the core for one version of Cake which can be shared among several 
 applications, but this is not the case.

 Does someone know why this is working this way, if this is a bug or a 
 feature I'm not using properly ?

 Thanks in advance.

 Cyrille



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Extracting core validation messages for I18N with the cake shell

2012-12-07 Thread lowpass
The only thing you can be sure of is that nothing will get done. Just
make a copy of your Locale directory. Better yet: use version control.

On Fri, Dec 7, 2012 at 5:23 AM, Cyrille Faucheux
cyrille.fauch...@gmail.com wrote:
 Because the extracting process overwrite all the files.
 I probably could do it manually, by backuping and replacing some files, but
 I don't want to since I'm sure it will lead to mistakes.

 Le jeudi 6 décembre 2012 17:07:09 UTC+1, euromark a écrit :

 why not running it twice? once for the core and once for the app?


 Am Donnerstag, 6. Dezember 2012 09:24:25 UTC+1 schrieb Cyrille Faucheux:

 Hi everyone,

 I'm trying to internationalize an application, and I face some problems
 with the I18N shell when extracting messages.

 When I run the extract task (cake.bat i18n extract), I'm asked whether I
 want to extract messages from the Cake core, which is what I want since
 there is some important messages to translate in the core (for example, the
 names of the months, in the Form helper).

 But when the extraction of core messages is enabled, the extraction of
 validation messages from the models is disabled. Of course, I want both...

 I can see some logic behind that, for example, having the translations of
 the core for one version of Cake which can be shared among several
 applications, but this is not the case.

 Does someone know why this is working this way, if this is a bug or a
 feature I'm not using properly ?

 Thanks in advance.

 Cyrille

 --
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP

 ---
 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.
 Visit this group at http://groups.google.com/group/cake-php?hl=en.



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Extracting core validation messages for I18N with the cake shell

2012-12-06 Thread Cyrille Faucheux
Hi everyone,

I'm trying to internationalize an application, and I face some problems 
with the I18N shell when extracting messages.

When I run the extract task (cake.bat i18n extract), I'm asked whether I 
want to extract messages from the Cake core, which is what I want since 
there is some important messages to translate in the core (for example, the 
names of the months, in the Form helper).

But when the extraction of core messages is enabled, the extraction of 
validation messages from the models is disabled. Of course, I want both...

I can see some logic behind that, for example, having the translations of 
the core for one version of Cake which can be shared among several 
applications, but this is not the case.

Does someone know why this is working this way, if this is a bug or a 
feature I'm not using properly ?

Thanks in advance.

Cyrille

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Extracting core validation messages for I18N with the cake shell

2012-12-06 Thread euromark
why not running it twice? once for the core and once for the app?


Am Donnerstag, 6. Dezember 2012 09:24:25 UTC+1 schrieb Cyrille Faucheux:

 Hi everyone,

 I'm trying to internationalize an application, and I face some problems 
 with the I18N shell when extracting messages.

 When I run the extract task (cake.bat i18n extract), I'm asked whether I 
 want to extract messages from the Cake core, which is what I want since 
 there is some important messages to translate in the core (for example, the 
 names of the months, in the Form helper).

 But when the extraction of core messages is enabled, the extraction of 
 validation messages from the models is disabled. Of course, I want both...

 I can see some logic behind that, for example, having the translations of 
 the core for one version of Cake which can be shared among several 
 applications, but this is not the case.

 Does someone know why this is working this way, if this is a bug or a 
 feature I'm not using properly ?

 Thanks in advance.

 Cyrille


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Problem in I18n table

2012-11-28 Thread jatin.bhatt
Hi.
I have model I18n which stores turkish and english language content of 
different fileds.
I have another model called CompetitionAwards which have title fields in 
turky and english language.
The title field is stored in i18n table in both language perfectly.
Now my problem is that when i fetch data from CompetitionAward data it is 
not fetch data from i18n table.
This same thing is work in CompetitionCat model.
i want somithing like :
CompetitionAwards['title']['tur'] = xyz
CompetitionAwards['title']['eng'] = abc

at present i just get
CompetitionAwards['title'] = xyz

tur and eng is coming from i18n table.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Problem with cake i18n extract

2012-11-12 Thread Tommaso
On 8 Nov, 19:54, AD7six andydawso...@gmail.com wrote:
 Looks like you have a file named Model/User.php - which doesn't contain a
 class named User

Fixed!
Thanks
Tom

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Problem with cake i18n extract

2012-11-08 Thread AD7six
Looks like you have a file named Model/User.php - which doesn't contain a 
class named User

AD

On Tuesday, 6 November 2012 11:44:32 UTC+1, Tommaso wrote:

 Hello, 

 I'm trying to use the cake i18n extract shell in cakephp 2.2.2 and 
 2.2.3 but I've got a problem. 

 After answered the questions the process starts with the message: 

 = 
 Extracting... 
 --- 
 Paths: 
/Users/tom/wwwroot/cakephp/app/ 
 Output Directory: /Users/tom/wwwroot/cakephp/app/Locale/ 
 --- 
 Processing /Users/tom/wwwroot/cakephp/app/index.php... 
  (Processing many files) ... 
 Processing /Users/max/wwwroot/cakephp/app/webroot/test.php... 
 Error: Class User does not exist 
 #0 /Users/tom/wwwroot/cakephp/lib/Cake/Console/Command/Task/ 
 ExtractTask.php(446): ReflectionClass-__construct('User') 
 #1 /Users/tom/wwwroot/cakephp/lib/Cake/Console/Command/Task/ 
 ExtractTask.php(281): ExtractTask-_extractValidationMessages() 
 #2 /Users/tom/wwwroot/cakephp/lib/Cake/Console/Command/Task/ 
 ExtractTask.php(232): ExtractTask-_extract() 
 #3 /Users/tom/wwwroot/cakephp/lib/Cake/Console/Shell.php(390): 
 ExtractTask-execute() 
 #4 /Users/tom/wwwroot/cakephp/lib/Cake/Console/Shell.php(387): Shell- 
 runCommand('execute', Array) 
 #5 /Users/tom/wwwroot/cakephp/lib/Cake/Console/ 
 ShellDispatcher.php(201): Shell-runCommand('extract', Array) 
 #6 /Users/tom/wwwroot/cakephp/lib/Cake/Console/ 
 ShellDispatcher.php(69): ShellDispatcher-dispatch() 
 #7 /Users/tom/wwwroot/cakephp/app/Console/cake.php(33): 
 ShellDispatcher::run(Array) 
 #8 {main} 
 = 

 So the process ends without extraction because of the Error: Class 
 User does not exist error. 

 If I try to use the tool in this form: 

 cake i18n extract --plugin Users 
 (so extracting strings from Users plugin) 
 it works perfectly 

 Any hint? 

 Thanks in advance 
 Tom 








-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Problem with cake i18n extract

2012-11-07 Thread Tommaso
Hello,

I'm trying to use the cake i18n extract shell in cakephp 2.2.2 and
2.2.3 but I've got a problem.

After answered the questions the process starts with the message:

=
Extracting...
---
Paths:
   /Users/tom/wwwroot/cakephp/app/
Output Directory: /Users/tom/wwwroot/cakephp/app/Locale/
---
Processing /Users/tom/wwwroot/cakephp/app/index.php...
 (Processing many files) ...
Processing /Users/max/wwwroot/cakephp/app/webroot/test.php...
Error: Class User does not exist
#0 /Users/tom/wwwroot/cakephp/lib/Cake/Console/Command/Task/
ExtractTask.php(446): ReflectionClass-__construct('User')
#1 /Users/tom/wwwroot/cakephp/lib/Cake/Console/Command/Task/
ExtractTask.php(281): ExtractTask-_extractValidationMessages()
#2 /Users/tom/wwwroot/cakephp/lib/Cake/Console/Command/Task/
ExtractTask.php(232): ExtractTask-_extract()
#3 /Users/tom/wwwroot/cakephp/lib/Cake/Console/Shell.php(390):
ExtractTask-execute()
#4 /Users/tom/wwwroot/cakephp/lib/Cake/Console/Shell.php(387): Shell-
runCommand('execute', Array)
#5 /Users/tom/wwwroot/cakephp/lib/Cake/Console/
ShellDispatcher.php(201): Shell-runCommand('extract', Array)
#6 /Users/tom/wwwroot/cakephp/lib/Cake/Console/
ShellDispatcher.php(69): ShellDispatcher-dispatch()
#7 /Users/tom/wwwroot/cakephp/app/Console/cake.php(33):
ShellDispatcher::run(Array)
#8 {main}
=

So the process ends without extraction because of the Error: Class
User does not exist error.

If I try to use the tool in this form:

cake i18n extract --plugin Users
(so extracting strings from Users plugin)
it works perfectly

Any hint?

Thanks in advance
Tom






-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: i18n - no flags

2012-10-02 Thread Dr. Drijk
Update and case closed.

The problem could be in the latest version of cakePHP.(v2.3).
After reinstalling the previous version, everthing went well.

but hej, thank you for searching.

Patrick.

Op dinsdag 25 september 2012 16:46:03 UTC+2 schreef Dr. Drijk het volgende:

 maybe a silly question, but anyway.

 I'm using the i18n plugin, copied into the plugin folder.
 I use an element which creates the heading for each page. In this element 
 i use the switchFlag function of the pluging:
   
 td class=button?php echo 
 $this-Html-image('printer-icoon.gif',array('alt'='print de pagina', 
 'onclick'='window.print()', 'onmouseover'='this.style.border = 1px Solid 
 #EEDDFF 1px', 'onmouseout'='this.style.border =0px Solid #EEDDFF')); 
 ?/td
 td?php echo $this-I18n-flagSwitcher(array('class' = 'languages', 
 'id' = 'language-switcher')); ?/td
  
 The created 'flag' functions quite well, no problem with that, but the 
 pictures themself aren't shown.
 the html-code generated looks like this
 img alt= src=/VR/V6/i18n/img/flags/fr.png/

 I don't know it this is related to it. since I introduced the flags even 
 the results of DebugKit aren't rendered wel.
 All te results are shown at the end of the page and not as a toobar.

 any idea how to solve this?

 Patrick
  



-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: i18n - no flags

2012-10-02 Thread Ivan Rimac
hey patrick, i need something like this on cakephp 1.3. i would like to
extract the pot file from the views folder. The cook book dont say much
about things what to do next, how exactly do I change the language on the
website?
Of course, first I need to edit the po files, but if I have multiple
domains, how exactly do I force cakephp to use certain .po file with
translation? If you can give any sort of advice or guidance, I would be
grateful.



2012/10/2 Dr. Drijk pdr...@gmail.com

 Update and case closed.

 The problem could be in the latest version of cakePHP.(v2.3).
 After reinstalling the previous version, everthing went well.

 but hej, thank you for searching.

 Patrick.

 Op dinsdag 25 september 2012 16:46:03 UTC+2 schreef Dr. Drijk het volgende:

 maybe a silly question, but anyway.

 I'm using the i18n plugin, copied into the plugin folder.
 I use an element which creates the heading for each page. In this element
 i use the switchFlag function of the pluging:

 td class=button?php echo 
 $this-Html-image('printer-**icoon.gif',array('alt'='print
 de pagina', 'onclick'='window.print()', 'onmouseover'='this.style.**border
 = 1px Solid #EEDDFF 1px', 'onmouseout'='this.style.**border =0px
 Solid #EEDDFF')); ?/td
 td?php echo $this-I18n-flagSwitcher(**array('class' = 'languages',
 'id' = 'language-switcher')); ?/td

 The created 'flag' functions quite well, no problem with that, but the
 pictures themself aren't shown.
 the html-code generated looks like this
 img alt= src=/VR/V6/i18n/img/flags/fr.**png/

 I don't know it this is related to it. since I introduced the flags even
 the results of DebugKit aren't rendered wel.
 All te results are shown at the end of the page and not as a toobar.

 any idea how to solve this?

 Patrick


  --
 Like Us on FacekBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP

 ---
 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.
 Visit this group at http://groups.google.com/group/cake-php?hl=en.






-- 
*Ivan Rimac***
mail: ivn...@gmail.com
*tel: +385 95 555 99 66*
*http://ivanrimac.com*

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




i18n extract - not generating pot files

2012-10-01 Thread bberg
Hi, I've used the i18n shell before (with cake 1.3) and it worked for me.
Now on 2.0.4 and 2.0.6 it just won't generate the pot files.
No error messages, no strange logs, nothing. Any ideas? Thanks
ps. also posted this question 
at http://ask.cakephp.org/questions/view/i18n_extract_not_generating_pot_files

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: i18n extract - not generating pot files

2012-10-01 Thread bberg
here's my shell ouput

MachineName:app username$ ./Console/cake i18n extract -v 
--validation-domain validation

Welcome to CakePHP v2.0.4 Console
---
App : app
Path: /Users/username/Sites/project/app/
---
What is the path you would like to extract?
[Q]uit [D]one  
[/Users/username/Sites/project/app/]  

What is the path you would like to extract?
[Q]uit [D]one  
[D]  

What is the path you would like to output?
[Q]uit  
[/Users/username/Sites/project/app/Locale]  

Would you like to merge all domains strings into the default.pot file? 
(y/n) 
[n]  


Extracting...
---
Paths:
   /Users/username/Sites/project/app/
Output Directory: /Users/username/Sites/project/app/Locale/
---
Processing /Users/username/Sites/project/app/index.php...
[there's lots more of these processing lines, listing all my ctp views 
and stuff]

then the command quits as if everything went fine

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




i18n - no flags

2012-09-25 Thread Patrick Drijkoningen
maybe a silly question, but anyway.

I'm using the i18n plugin, copied into the plugin folder.
I use an element which creates the heading for each page. In this element i 
use the switchFlag function of the pluging:
  
td class=button?php echo 
$this-Html-image('printer-icoon.gif',array('alt'='print de pagina', 
'onclick'='window.print()', 'onmouseover'='this.style.border = 1px Solid 
#EEDDFF 1px', 'onmouseout'='this.style.border =0px Solid #EEDDFF')); 
?/td
td?php echo $this-I18n-flagSwitcher(array('class' = 'languages', 'id' 
= 'language-switcher')); ?/td
 
The created 'flag' functions quite well, no problem with that, but the 
pictures themself aren't shown.
the html-code generated looks like this
img alt= src=/VR/V6/i18n/img/flags/fr.png/

I don't know it this is related to it. since I introduced the flags even 
the results of DebugKit aren't rendered wel.
All te results are shown at the end of the page and not as a toobar.

any idea how to solve this?

Patrick
 

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




add 2 records in i18n for a new record

2012-07-04 Thread marcogo
hi
i want to add a multiple lines (ita  eng) in i18n for one record in jewel
so i add a afterSave in model
cause i want to add multiple lines only for a new record and not for a 
modify one

i add this

public function afterSave($created) {
if ($created) {
  if (isset ($this-data['Jewel']['eng'])) {
$this-Jewel-locale = $this-data['Jewel']['eng'];
}
if (!empty($this-data)) {
if ($this-Jewelsave($this-data)) {
$this-flash('Article been saved.', '/articles');
}
}
}
return true;
}


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Data validation in multilingual website (with i18n)

2012-01-23 Thread Anna P
Hello.
I'm building an multilingual website in CakePHP 2.0.5 with the use of
I18n.

My question is: how can I define (in model class) validation rules, so
they apply to specified language version (locale)?

I have an i18n table, languages table (id,code), subpages table
(id,created)

While adding new subpage (or editing a subpage) I want to display
fields for title and content in all the language versions at one form.

The simple view ($langs is the list of languages from languages
table):

?php echo $this-Form-create('Subpage',array('url'='/admin/subpages/
add'))?
table cellspacing=0 cellpadding=0 class=table
?php foreach($langs as $l):?
trtd colspan=2Language: ?php echo $l['Language']['code']?/
td/tr
trtdTitle/td
  td?php echo $this-Form-text('Subpage.title.'.$l['Language']
['code'])?
 ?php echo $this-Form-error('title')?
  /td
/tr
trtdContent/td
  td?php echo $this-Form-textarea('Subpage.content.'.
$l['Language']['code'],array('class'='ckeditor'))?/td/tr
   ?php endforeach;?
/table
?php echo $this-Form-submit('Add
subpage',array('class'='submit','div'=false))?/div
?php echo $this-Form-end();?

The part of code in controller's action:
if($this-request-is('post')) {
if(!empty($this-request-data)) {
$this-Subpage-set($this-request-data);
if($this-Subpage-validates()) {
$this-Subpage-create();
$this-Subpage-save($this-request-data);
}
}
}

It works fine and on add subpage action it entries both translations
to i18n table.
The problem is, I have a validate variable defined for Subpage model
like this:
public $validate = array (
'title' = array(
  'minlength' = array(
'rule' = array('minLength', '1'),
'message' = 'Title cannot be empty',
  ),
  'maxlength' = array(
'rule' = array('maxLength', '40'),
'message' = 'Title cannot be longer than 40 characters',
  ),
  'chars' = array(
'rule' = array('custom', '/^[A-Za-ząĄćĆęĘłŁńŃóÓśŚźŹżŻ0-9\ ]*
$/'),
'message' = 'Title can contain only letters, numers and
spaces ',
  ),
),

If I enter an unaccepted string into the title field in ONE of the
language versions and submit form, both fields (in both languages) are
marked as invalid and for both fields the error is being displayed
(apart from the fact that second field is filled correctly).

Does anyone know how to fix this or what should the $validate var look
like? Thank you in advance for help.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Error saving i18n

2011-12-29 Thread Constantin.FF
also i use
$model-data[$model-alias]['title'] = $title;
to set the title field

On Dec 28, 8:39 pm, Constantin FF constantin...@gmail.com wrote:
 absolutely the same result after adding
         $model-set(array('title' = $title, 'body' = $title));
 at the end of beforeSave

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Error saving i18n

2011-12-28 Thread Constantin.FF
I am using Behavior which beforeSave sets the title of the post. I am
using this for attachments to set title, slug, create thumbs and so
on ..

With the testing till now these are the results: Set title inside:
-Behavior beforeSave - does not save inside i18n table
-Model bofereSave - does not save inside i18n table
-Controller before $this-Attachment-save($this-data) - Working!

What are my options to use only a Behavior to set the title? I guess
that this error appears because storing entry inside i18n table
happens before setting the title in the Behavior. So first it tries to
save record inside i18n, but still there is no title and it does not
save anything. After that saving applying the Behavior, which sets the
title and saves the record in the 'attachments' table.

How to debug and see, what is the data before inserting in the model
and i18n tables? Any ideas for the error?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Error saving i18n

2011-12-28 Thread Tilen Majerle
how do you set data in the behavior ?

do you use $Model-set() or ?

--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2011/12/28 Constantin.FF constantin...@gmail.com

 I am using Behavior which beforeSave sets the title of the post. I am
 using this for attachments to set title, slug, create thumbs and so
 on ..

 With the testing till now these are the results: Set title inside:
 -Behavior beforeSave - does not save inside i18n table
 -Model bofereSave - does not save inside i18n table
 -Controller before $this-Attachment-save($this-data) - Working!

 What are my options to use only a Behavior to set the title? I guess
 that this error appears because storing entry inside i18n table
 happens before setting the title in the Behavior. So first it tries to
 save record inside i18n, but still there is no title and it does not
 save anything. After that saving applying the Behavior, which sets the
 title and saves the record in the 'attachments' table.

 How to debug and see, what is the data before inserting in the model
 and i18n tables? Any ideas for the error?

 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 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


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Error saving i18n

2011-12-28 Thread Constantin FF
var $model = null;

function setup($model, $config = array()){
$this-settings[$model-alias] = array_merge($this-_defaults, 
$config);
$this-model = $model;
}

do i have to add $Model-set() also
On Wed, Dec 28, 2011 at 1:31 PM, Tilen Majerle tilen.maje...@gmail.com wrote:
 how do you set data in the behavior ?

 do you use $Model-set() or ?

 --
 Lep pozdrav, Tilen Majerle
 http://majerle.eu



 2011/12/28 Constantin.FF constantin...@gmail.com

 I am using Behavior which beforeSave sets the title of the post. I am
 using this for attachments to set title, slug, create thumbs and so
 on ..

 With the testing till now these are the results: Set title inside:
 -Behavior beforeSave - does not save inside i18n table
 -Model bofereSave - does not save inside i18n table
 -Controller before $this-Attachment-save($this-data) - Working!

 What are my options to use only a Behavior to set the title? I guess
 that this error appears because storing entry inside i18n table
 happens before setting the title in the Behavior. So first it tries to
 save record inside i18n, but still there is no title and it does not
 save anything. After that saving applying the Behavior, which sets the
 title and saves the record in the 'attachments' table.

 How to debug and see, what is the data before inserting in the model
 and i18n tables? Any ideas for the error?

 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 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


 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Error saving i18n

2011-12-28 Thread Constantin FF
absolutely the same result after adding
$model-set(array('title' = $title, 'body' = $title));
at the end of beforeSave

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


i18n extract in plugins cakephp 2.0

2011-12-19 Thread Cayetano Soriano
Hi i used  the console, for extract .po, from plugin, the problem, is
that I create a directory in my app/Plugins/plugin name/ called
Locale, and copy my .po, but it doesn't work, in app/Locale , it works
perfectly, how i can put that in my plugin/plugin-name directory

Thank's a lot

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: i18n extract in plugins cakephp 2.0

2011-12-19 Thread Miles J
app/Plugin/plugin/Locale/eng/LC_MESSAGES/name.po

On Dec 19, 10:20 am, Cayetano Soriano neoshadyb...@gmail.com wrote:
 Hi i used  the console, for extract .po, from plugin, the problem, is
 that I create a directory in my app/Plugins/plugin name/ called
 Locale, and copy my .po, but it doesn't work, in app/Locale , it works
 perfectly, how i can put that in my plugin/plugin-name directory

 Thank's a lot

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Problem initialising i18n table using UUID in cake console

2011-10-24 Thread André Fischer
I created a database that uses UUIDs exclusively for all id fields.
When I use cake i18n to initialise the table in the database to make
various models translatable, it creates an id fiend as INT instead of
CHAR(36), which breaks the translation behaviour. Am I doing something
wrong, or is this a bug?

I'm using CakePHP 2.0, cloned from git on 2011-10-22, MySQL 5.5.9,
Apache 2.2.21, and PHP 5.3.6 under MAMP PRO 2.0.5, OS X 10.6.8.

I'm keeping this message short, as this is my first post in this
group. I've tried Googling both in this group and elsewhere, and
couldn't find any more information on this issue — please forgive me
if this post is in the wrong format or place. :)

Kind regards,

André Fischer

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Problem initialising i18n table using UUID in cake console

2011-10-24 Thread euromark
my guess:
cake doesnt support uuids for those things on initialize
but you could probably change the field manually to uuid afterwards
then it should work again


On 24 Okt., 09:59, André Fischer amfisc...@gmail.com wrote:
 I created a database that uses UUIDs exclusively for all id fields.
 When I use cake i18n to initialise the table in the database to make
 various models translatable, it creates an id fiend as INT instead of
 CHAR(36), which breaks the translation behaviour. Am I doing something
 wrong, or is this a bug?

 I'm using CakePHP 2.0, cloned from git on 2011-10-22, MySQL 5.5.9,
 Apache 2.2.21, and PHP 5.3.6 under MAMP PRO 2.0.5, OS X 10.6.8.

 I'm keeping this message short, as this is my first post in this
 group. I've tried Googling both in this group and elsewhere, and
 couldn't find any more information on this issue — please forgive me
 if this post is in the wrong format or place. :)

 Kind regards,

 André Fischer

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Problem initialising i18n table using UUID in cake console

2011-10-24 Thread André Fischer
Ah - if that works, that would be great. I'm new to Cake, and was
leery of just diving in and doing things to the database behind Cake's
back, as I've burnt myself in the past doing that to/with other
Frameworks. :)

Apart from that, I'm amazed how brilliant CakePHP2 is, and the more I
dig in, the more I like it.

On Oct 24, 11:26 am, euromark dereurom...@googlemail.com wrote:
 my guess:
 cake doesnt support uuids for those things on initialize
 but you could probably change the field manually to uuid afterwards
 then it should work again

 On 24 Okt., 09:59, André Fischer amfisc...@gmail.com wrote:







  I created a database that uses UUIDs exclusively for all id fields.
  When I use cake i18n to initialise the table in the database to make
  various models translatable, it creates an id fiend as INT instead of
  CHAR(36), which breaks the translation behaviour. Am I doing something
  wrong, or is this a bug?

  I'm using CakePHP 2.0, cloned from git on 2011-10-22, MySQL 5.5.9,
  Apache 2.2.21, and PHP 5.3.6 under MAMP PRO 2.0.5, OS X 10.6.8.

  I'm keeping this message short, as this is my first post in this
  group. I've tried Googling both in this group and elsewhere, and
  couldn't find any more information on this issue — please forgive me
  if this post is in the wrong format or place. :)

  Kind regards,

  André Fischer

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Problems with HABTM Pagnitaion and i18n

2011-10-06 Thread Jörg
Hello all,

i need help.
I had a brand model with $hasAndBelongsToMany = array('Category');
Category is a model with the translation on the field 'name'

Now depending on a category filter in a searchbox I want to identify
which brands are in the search area and which other catgeories are
assigned to these brands.

Exmaple
Search = mp3
-- Brand: apple -- Categories: smartphone, desktop computer, server,
software, mp3

I found a lot of discussions and pages and come to the solution to
%str = array(1,2,3,6); // Example
$this-Brand-recursive = 1;
$this-Brand-bindModel(array('hasOne' = array('BrandCategory')),
false);
$this-Brand-BrandCategory-locale = $this-read_language();
$options = array('fields'
=array('Brand.id','Brand.company','Brand.url'),'contain'=array('BrandCategory.Category.name'),'group'
= 'Brand.id','conditions' = array('BrandCategory.category_id' =
$str));
$this-paginate = $options;
$test2 = $this-paginate();
$this-set('brands',$test2);

The problem now is, that the Category.name is not in the required
language.

Can somebody help me ?

THANKS Jörg

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: i18n script ans default.po file

2011-09-14 Thread Sean Dong
avairet:

*Have you solved the problem? I am having the same thing here. The 
translation is not show up. Only the original string...*

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


implementing i18n in a non cakephp app

2011-09-02 Thread dole doug
hi there

I have an old webapp on which i have to add i18n support. At this
moment I've added a __() around my messages which i need to be
translated and changed in my interface.

I don't have great experience with cake or programming in OO but I'll
like to know the logic by which cakephp can offer i18n. I can do a
parser to extract all the strings which have to be translated(those
with __()).

What do I have to do from that point?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: implementing i18n in a non cakephp app

2011-09-02 Thread Miles J
__() wont work in a non-cake app, it's cake functionality.

__() is just a custom function cake wrote that extends their i18n
class. The i18n class deals with the loading of .po files and the
extraction of message strings using gettext (I believe).

On Aug 30, 1:09 pm, dole doug dole.cakegr...@gmail.com wrote:
 hi there

 I have an old webapp on which i have to add i18n support. At this
 moment I've added a __() around my messages which i need to be
 translated and changed in my interface.

 I don't have great experience with cake or programming in OO but I'll
 like to know the logic by which cakephp can offer i18n. I can do a
 parser to extract all the strings which have to be translated(those
 with __()).

 What do I have to do from that point?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


i18n and continuous integration

2011-07-27 Thread wiseguysonly
Hi All,

I successfully use Hudson along with SimpleTest on all of my CakePHP
projects without issue. However, for the first time I decided to have
a play with actsAs Translate.

Whilst all my SimpleTest cases work perfectly at /test.php my Hudson
set up always fails with the following trace:

+ rm -rf junit.xml
+ cakerunner --cakephp-app-path=app --log-junit=junit.xml -R app/tests


PHP Fatal error:  Call to undefined method I18n::translate() in /var/
lib/hudson/jobs/Zumo CMS/workspace/cake/basics.php on line 668
PHP Stack trace:
PHP   1. {main}() /usr/bin/cakerunner:0
PHP   2. Stagehand_CLIController-run() /usr/bin/cakerunner:69
PHP   3. Stagehand_TestRunner_TestRunnerCLIController-doRun() /usr/
share/php/Stagehand/CLIController.php:101
PHP   4. Stagehand_TestRunner_TestRunnerCLIController-runTests() /usr/
share/php/Stagehand/TestRunner/TestRunnerCLIController.php:182
PHP   5. Stagehand_TestRunner_TestRunner-run() /usr/share/php/
Stagehand/TestRunner/TestRunnerCLIController.php:400
PHP   6. Stagehand_TestRunner_Runner_SimpleTestRunner-run() /usr/
share/php/Stagehand/TestRunner/TestRunner.php:70
PHP   7. TestSuite-run() /usr/share/php/Stagehand/TestRunner/Runner/
SimpleTestRunner.php:90
PHP   8. SimpleTestCase-run() /var/lib/hudson/jobs/Zumo CMS/workspace/
app/vendors/simpletest/test_case.php:598
PHP   9. SimpleExceptionTrappingInvoker-invoke() /var/lib/hudson/jobs/
Zumo CMS/workspace/app/vendors/simpletest/test_case.php:143
PHP  10. SimpleInvokerDecorator-invoke() /var/lib/hudson/jobs/Zumo
CMS/workspace/app/vendors/simpletest/exceptions.php:43
PHP  11. SimpleErrorTrappingInvoker-invoke() /var/lib/hudson/jobs/
Zumo CMS/workspace/app/vendors/simpletest/invoker.php:126
PHP  12. SimpleInvokerDecorator-invoke() /var/lib/hudson/jobs/Zumo
CMS/workspace/app/vendors/simpletest/errors.php:49
PHP  13. SimpleInvoker-invoke() /var/lib/hudson/jobs/Zumo CMS/
workspace/app/vendors/simpletest/invoker.php:126
PHP  14. PageRevisionTestCase-startCase() /var/lib/hudson/jobs/Zumo
CMS/workspace/app/vendors/simpletest/invoker.php:68
PHP  15. ClassRegistry-init() /var/lib/hudson/jobs/Zumo CMS/workspace/
app/tests/cases/models/page_revision.test.php:9
PHP  16. Model-__construct() /var/lib/hudson/jobs/Zumo CMS/workspace/
cake/libs/class_registry.php:142
PHP  17. Model-__createLinks() /var/lib/hudson/jobs/Zumo CMS/
workspace/cake/libs/model/model.php:482
PHP  18. Model-__constructLinkedModel() /var/lib/hudson/jobs/Zumo CMS/
workspace/cake/libs/model/model.php:629
PHP  19. ClassRegistry-init() /var/lib/hudson/jobs/Zumo CMS/workspace/
cake/libs/model/model.php:658
PHP  20. Model-__construct() /var/lib/hudson/jobs/Zumo CMS/workspace/
cake/libs/class_registry.php:142
PHP  21. Model-setSource() /var/lib/hudson/jobs/Zumo CMS/workspace/
cake/libs/model/model.php:474
PHP  22. Object-cakeError() /var/lib/hudson/jobs/Zumo CMS/workspace/
cake/libs/model/model.php:774
PHP  23. ErrorHandler-__construct() /var/lib/hudson/jobs/Zumo CMS/
workspace/cake/libs/object.php:201
PHP  24. call_user_func_array() /var/lib/hudson/jobs/Zumo CMS/
workspace/cake/console/error.php:54
PHP  25. ErrorHandler-missingTable() /var/lib/hudson/jobs/Zumo CMS/
workspace/cake/console/error.php:0
PHP  26. __() /var/lib/hudson/jobs/Zumo CMS/workspace/cake/console/
error.php:130
The test suite generated by Stagehand_TestRunner

Fatal error: Call to undefined method I18n::translate() in /var/lib/
hudson/jobs/Zumo CMS/workspace/cake/basics.php on line 668

Call Stack:
0.0005 326276   1. {main}() /usr/bin/cakerunner:0
0.0143 784688   2. Stagehand_CLIController-run() /usr/bin/
cakerunner:69
0.0178 808936   3.
Stagehand_TestRunner_TestRunnerCLIController-doRun() /usr/share/php/
Stagehand/CLIController.php:101
0.0178 808936   4.
Stagehand_TestRunner_TestRunnerCLIController-runTests() /usr/share/
php/Stagehand/TestRunner/TestRunnerCLIController.php:182
0.0187 827136   5. Stagehand_TestRunner_TestRunner-run() /usr/
share/php/Stagehand/TestRunner/TestRunnerCLIController.php:400
0.3675   10704216   6.
Stagehand_TestRunner_Runner_SimpleTestRunner-run() /usr/share/php/
Stagehand/TestRunner/TestRunner.php:70
0.3747   10944796   7. TestSuite-run() /usr/share/php/Stagehand/
TestRunner/Runner/SimpleTestRunner.php:90
0.7450   13286628   8. SimpleTestCase-run() /var/lib/hudson/jobs/
Zumo CMS/workspace/app/vendors/simpletest/test_case.php:598
0.8265   13350716   9. SimpleExceptionTrappingInvoker-invoke() /
var/lib/hudson/jobs/Zumo CMS/workspace/app/vendors/simpletest/
test_case.php:143
0.8266   13350964  10. SimpleInvokerDecorator-invoke() /var/lib/
hudson/jobs/Zumo CMS/workspace/app/vendors/simpletest/exceptions.php:
43
0.8266   13350964  11. SimpleErrorTrappingInvoker-invoke() /var/
lib/hudson/jobs/Zumo CMS/workspace/app/vendors/simpletest/invoker.php:
126
0.8267   13351040  12. SimpleInvokerDecorator-invoke() /var/lib/
hudson/jobs/Zumo CMS/workspace/app/vendors/simpletest/errors.php:49
0.8267   13351040  13

Missing i18n string in PHP 5.2

2011-07-22 Thread Simon Males
Hi,

I have a new i18n string: time_zone_abbreviation. Debugging
I18n::getInstance() show's all my strings but not the latest edition.
It feels like some level caching I am missing. Though I have restarted
Apache and cleared the cache many a time.

The error appears on a CentOS 5 server is PHP 5.2.14.

I don't have a problem on Ubuntu 11.04 PHP 5.3.5

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: i18n

2011-07-06 Thread Johan
You can use a third-party tool such as POEdit to scan your sources for i18n
strings. You can define which files to scan and what functions to search.

Cheers,
- Johan

On Tue, Jul 5, 2011 at 5:57 PM, Carlos Eduardo Sotelo Pinto 
carlos.sotelo.pi...@gmail.com wrote:

 Hi people

 When I use cakephp i18n, I must wite the sentences as

 ?php __('Una cadena'); ?
 ?php $this-Form-input('name', array(__('Un nombre', true))); ?

 Then, I must do the next lines for extract the tranlate words

 $ cake i18n
 e

 Now, I am working with a template engine, dwoo, the main idea is avoid
 using ?php ? on views. For get this functionality on my views, I
 have create a helper

 class I18nHelper extends AppHelper {

function get_text($string, $flag = FALSE) {
return $string;
}

 }

 And the sentences will be on this way, using teh helper

 {$i18n-get_text('Una Cadena')}
 {$form-input('name', array($i18n-get_text('Un Nombre')))}

 Also I have edit the file

 /cake/libs/tasks/extract.php

 fo adding the line

 $this-__parse('get_text', array('singular'));

 on the method

 function _extractTokens() // línea 220

 and then, after do

 $ cake i18n
 e

 I couldnt get anythingf of my tranlated lines. I have notiec that the
 extract.php file use the php funciotn tokens_get_all, then I can
 supouse that my dwoo tags {} are not readed by this funcions and my
 i18n wont work.

 My question is find a solution to this issue and get the best way for
 work with i18n using {} instead of ?php ?

 Thanks

 Carlos

 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 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


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


i18n

2011-07-05 Thread Carlos Eduardo Sotelo Pinto
Hi people

When I use cakephp i18n, I must wite the sentences as 

?php __('Una cadena'); ?
?php $this-Form-input('name', array(__('Un nombre', true))); ?

Then, I must do the next lines for extract the tranlate words

$ cake i18n
e

Now, I am working with a template engine, dwoo, the main idea is avoid
using ?php ? on views. For get this functionality on my views, I
have create a helper

class I18nHelper extends AppHelper {

function get_text($string, $flag = FALSE) {
return $string;
}

}

And the sentences will be on this way, using teh helper

{$i18n-get_text('Una Cadena')}
{$form-input('name', array($i18n-get_text('Un Nombre')))}

Also I have edit the file

/cake/libs/tasks/extract.php

fo adding the line

$this-__parse('get_text', array('singular'));

on the method

function _extractTokens() // línea 220

and then, after do

$ cake i18n
e

I couldnt get anythingf of my tranlated lines. I have notiec that the
extract.php file use the php funciotn tokens_get_all, then I can
supouse that my dwoo tags {} are not readed by this funcions and my
i18n wont work.

My question is find a solution to this issue and get the best way for
work with i18n using {} instead of ?php ?

Thanks

Carlos

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Extract .po file from my app with i18n extract console command

2011-07-02 Thread Glauco
Hi there, I am trying extract a .po file from my application using the
command i18n extract.

When I type the command, I get a message like this (but the extracting dont
start =/):

Welcome to CakePHP v.1.3.8 Console
__
App: app
Path: c:\wamp\www\myproject\app
__

I am on Windows 7, and like you saw above my app is on C: (but I have
executed the prompt of command like administrator).

I have tried with the below code's:

c:\wamp\bin\php\php5.3.0\php.exe
c:\wamp\www\myproject\app\cake\console\cake.php i18n extract

c:\wamp\bin\php\php5.3.0\php.exe -f
c:\wamp\www\myproject\app\cake\console\cake.php i18n extract

c:\wamp\bin\php\php5.3.0\php.exe -f
c:\wamp\www\myproject\app\cake\console\cake.php i18n extract -output
c:\wamp\www\myproject\app\locale

If you could help me...

Regards. 

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Extract-po-file-from-my-app-with-i18n-extract-console-command-tp4542889p4542889.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Extract .po file from my app with i18n extract console command

2011-07-02 Thread euromark
you could have it way easier on windows
http://www.dereuromark.de/2010/10/03/console-for-cakephp/

then you only need to navigate to your app folder and enter cake i18n
extract etc
thats all! no path stuff


On 1 Jul., 19:57, Glauco glauco.custo...@gmail.com wrote:
 Hi there, I am trying extract a .po file from my application using the
 command i18n extract.

 When I type the command, I get a message like this (but the extracting dont
 start =/):

 Welcome to CakePHP v.1.3.8 Console
 __
 App: app
 Path: c:\wamp\www\myproject\app
 __

 I am on Windows 7, and like you saw above my app is on C: (but I have
 executed the prompt of command like administrator).

 I have tried with the below code's:

 c:\wamp\bin\php\php5.3.0\php.exe
 c:\wamp\www\myproject\app\cake\console\cake.php i18n extract

 c:\wamp\bin\php\php5.3.0\php.exe -f
 c:\wamp\www\myproject\app\cake\console\cake.php i18n extract

 c:\wamp\bin\php\php5.3.0\php.exe -f
 c:\wamp\www\myproject\app\cake\console\cake.php i18n extract -output
 c:\wamp\www\myproject\app\locale

 If you could help me...

 Regards.

 --
 View this message in 
 context:http://cakephp.1045679.n5.nabble.com/Extract-po-file-from-my-app-with...
 Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Extract .po file from my app with i18n extract console command

2011-07-02 Thread Glauco
Thank you Euromark, It's working now.

But now I have other trouble...

I wanna use the Translate behavior in a model... Already create the i18n
table using the console.

I added the below code at model:

public $actAs = array(
'Translate' = array('name' ='tName',
 'clean_name' 
= 'tClean_name',
 'description' 
= 'tDescription',
 'video_id' = 
'tVideo_id')
);

and this in controller (before $this-Article-save()):

$this-Article-locale = 'pol';


But when I create a record in the articles table, CakePHP does not generate
the respective recrod in i18n table.

Have I to setup anything else?

Thank you.

Regards

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Extract-po-file-from-my-app-with-i18n-extract-console-command-tp4542889p4545125.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: App_controller function to obtain default.pot file ( i18n extract )

2011-06-18 Thread krisspnet
Well, we have different persons in charge of the translations.
However, those persons don't know what is a terminal actually.
Because we often add new functions and views in our website, we all also add
new _('to be translated',true) tags in the code.

We just want it to be easy, with a simple 'button' on the website, the
persons who translate can have the last items that need to be translated
without asking us every time.
In this context, they feel free to translate the last version of the
website, when they want.

I asked this question because we use the 
http://book.cakephp.org/view/647/An-Automated-tool-for-creating-ACOs
build_acl  function, which was first a shell command.

Might it be possible to run the i18n extract command in a background
terminal?

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/App-controller-function-to-obtain-default-pot-file-i18n-extract-tp4495820p4501699.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: App_controller function to obtain default.pot file ( i18n extract )

2011-06-18 Thread Miles J
Yeah you can easily set it up using a cron job. Just use the same
command you use in the CLI in the cron.

On Jun 18, 10:14 am, krisspnet christophe.pou...@gmail.com wrote:
 Well, we have different persons in charge of the translations.
 However, those persons don't know what is a terminal actually.
 Because we often add new functions and views in our website, we all also add
 new _('to be translated',true) tags in the code.

 We just want it to be easy, with a simple 'button' on the website, the
 persons who translate can have the last items that need to be translated
 without asking us every time.
 In this context, they feel free to translate the last version of the
 website, when they want.

 I asked this question because we use 
 thehttp://book.cakephp.org/view/647/An-Automated-tool-for-creating-ACOs
 build_acl  function, which was first a shell command.

 Might it be possible to run the i18n extract command in a background
 terminal?

 --
 View this message in 
 context:http://cakephp.1045679.n5.nabble.com/App-controller-function-to-obtai...
 Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: App_controller function to obtain default.pot file ( i18n extract )

2011-06-18 Thread Ryan Schmidt

On Jun 18, 2011, at 12:14, krisspnet wrote:

 Well, we have different persons in charge of the translations.
 However, those persons don't know what is a terminal actually.
 Because we often add new functions and views in our website, we all also add
 new _('to be translated',true) tags in the code.
 
 We just want it to be easy, with a simple 'button' on the website, the
 persons who translate can have the last items that need to be translated
 without asking us every time.
 In this context, they feel free to translate the last version of the
 website, when they want.

You have a process for publishing the latest version of your web site to your 
production server, don't you? Include in that process running the extraction, 
and publishing the default.pot along with the rest of the web site. Then the 
translator doesn't need to generate anything; they just download the 
already-generated file.



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: App_controller function to obtain default.pot file ( i18n extract )

2011-06-18 Thread krisspnet
Thank you very much.
I will try it !


--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/App-controller-function-to-obtain-default-pot-file-i18n-extract-tp4495820p4502127.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: App_controller function to obtain default.pot file ( i18n extract )

2011-06-18 Thread krisspnet
Thank you very much ;)

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/App-controller-function-to-obtain-default-pot-file-i18n-extract-tp4495820p4502131.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


App_controller function to obtain default.pot file ( i18n extract )

2011-06-17 Thread krisspnet
Hi everyone, 

I am a new user of the cakephp framework and I find it really amazing for
those who have few knowledge of website construction.

My colleagues and I are working on a project that has to be shown each month
into different languages.
Therefore, we have started to build a multilingual interface with cake i18n
extract shell command.

Thanks to this page : 
http://cakephp.1045679.n5.nabble.com/create-po-file-from-database-table-multilingual-l10n-I18n-td1328082.html
create-po-file-from-database-table-multilingual-l10n-I18n  , we have build a
simple interface to facilitate the life of our translators.

However, our website is changing month after month, with the need to
translate the new __('text to be translated',true).

Hence, we have to re-construct the default.pot file each time.

My question :

Is there an App_controller function that can do the shell command : cake
i18n extract shell
If not, does anyone have an idea of how should it be written ?

Thanks in advance.

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/App-controller-function-to-obtain-default-pot-file-i18n-extract-tp4495820p4495820.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: App_controller function to obtain default.pot file ( i18n extract )

2011-06-17 Thread Miles J
It should be done in the command line as attempting to do it in the
browser will be really slow and most likely consume a lot of memory.

Any specific reason you want it in the AppController?

On Jun 16, 9:35 am, krisspnet christophe.pou...@gmail.com wrote:
 Hi everyone,

 I am a new user of the cakephp framework and I find it really amazing for
 those who have few knowledge of website construction.

 My colleagues and I are working on a project that has to be shown each month
 into different languages.
 Therefore, we have started to build a multilingual interface with cake i18n
 extract shell command.

 Thanks to this page 
 :http://cakephp.1045679.n5.nabble.com/create-po-file-from-database-tab...
 create-po-file-from-database-table-multilingual-l10n-I18n  , we have build a
 simple interface to facilitate the life of our translators.

 However, our website is changing month after month, with the need to
 translate the new __('text to be translated',true).

 Hence, we have to re-construct the default.pot file each time.

 My question :

 Is there an App_controller function that can do the shell command : cake
 i18n extract shell
 If not, does anyone have an idea of how should it be written ?

 Thanks in advance.

 --
 View this message in 
 context:http://cakephp.1045679.n5.nabble.com/App-controller-function-to-obtai...
 Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


URL-based language switching for i18n and l10n

2011-04-23 Thread acl68
Hello,

I try to setup a multilanguge site with CakePHP and followed this tutorial. 

http://nuts-and-bolts-of-cakephp.com/2008/11/28/cakephp-url-based-language-
switching-for-i18n-and-l10n-internationalization-and-localization/

I use Cake 1.3 and it doesn't work. I guess it might crash with other features 
of my application, but I have no idea where to look.

What happens is: 
http://localhost/cigar/eng/addresses/suche
gives me the identical German output as 
http://localhost/cigar/ger/addresses/suche
( I used for testing German and English language. Both po files exist and sit 
in the usual directories.)


The debug output of my session cookie looks like this: 
Array
(
[Config] = Array
(
[userAgent] = ef7661414bbc83a00b99603c50cbc224
[time] = 1303605745
[timeout] = 10
[language] = ger
)

)

ger is what I defined in the core.php. 
So far so good, but I cannot switch the language to English by clicking on the 
link the tutorial mentiones. Also the cookie value stays the same, even after 
deleting the cookie and relloading 
http://localhost/cigar/eng/addresses/suche

Even when I set 
Configure::write('Config.language', 'eng'); 
and delete the cookie and reload everything still stays German.


Any idea what might have gone wrong? 


Thanks in advance for any help

Anja

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: i18n and Google Indexing Problem - Google only indexes default language

2011-03-22 Thread AD7six


On Mar 22, 1:45 pm, DigitalDude e.blumsten...@googlemail.com wrote:
 Hey,

 I ran into a really bad problem today with one of my multilingual apps
 and I have absolutely NO clue how to solve this!

 First, a slight overview of how my app is structured:

 The app runs with i18n for 4 different languages. I set the language
 per Session. First, the session language is determined by checking the
 browsers language. if no matching language is found, the default
 language (english) is chosen and set for the session, and all of the
 content will be displayed in this lanuage. If the language switch is
 triggered, the content will be displayed in the chosen language, so
 everything is fine with that.

 So as I don't know how the Google Robot works and I also think the
 Robot can't start a session, I'm wondering how I could tell the google
 bot that there is other content in other languages that has to be
 indexed, too!

 Does anyone of you have any idea how to setup a cake app for
 multilangual content that is ready for correct indexing by Google? I
 would really appreciate any help on this one...

You mean like book.cakephp.org? (that's a hint)

AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


i18n and Google Indexing Problem - Google only indexes default language

2011-03-22 Thread DigitalDude
Hey,

I ran into a really bad problem today with one of my multilingual apps
and I have absolutely NO clue how to solve this!

First, a slight overview of how my app is structured:

The app runs with i18n for 4 different languages. I set the language
per Session. First, the session language is determined by checking the
browsers language. if no matching language is found, the default
language (english) is chosen and set for the session, and all of the
content will be displayed in this lanuage. If the language switch is
triggered, the content will be displayed in the chosen language, so
everything is fine with that.

So as I don't know how the Google Robot works and I also think the
Robot can't start a session, I'm wondering how I could tell the google
bot that there is other content in other languages that has to be
indexed, too!

Does anyone of you have any idea how to setup a cake app for
multilangual content that is ready for correct indexing by Google? I
would really appreciate any help on this one...

Regards,

DD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: i18n and Google Indexing Problem - Google only indexes default language

2011-03-22 Thread DigitalDude
Hey,


yeah I know the articles around i18n and the internal structure for
this is correct in my app i think, I can't find anything on how to
setup an application for correct indexing when having multiple
languages.

But maybe you know something I don't, so maybe you could give me a Tag
I should look for to find some useful information? :)

Regards,

DD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: i18n and Google Indexing Problem - Google only indexes default language

2011-03-22 Thread Ryan Schmidt
On Mar 22, 2011, at 07:49, AD7six wrote:
 On Mar 22, 1:45 pm, DigitalDude wrote:
 The app runs with i18n for 4 different languages. I set the language
 per Session. First, the session language is determined by checking the
 browsers language. if no matching language is found, the default
 language (english) is chosen and set for the session, and all of the
 content will be displayed in this lanuage. If the language switch is
 triggered, the content will be displayed in the chosen language, so
 everything is fine with that.
 
 So as I don't know how the Google Robot works and I also think the
 Robot can't start a session, I'm wondering how I could tell the google
 bot that there is other content in other languages that has to be
 indexed, too!
 
 Does anyone of you have any idea how to setup a cake app for
 multilangual content that is ready for correct indexing by Google? I
 would really appreciate any help on this one...
 
 You mean like book.cakephp.org? (that's a hint)

Right. Each language's content should have a distinct URL, e.g. with the 
language code at the start of the path. If the user requests a URL that doesn't 
have a language code (e.g. from their bookmarks, or previous Google search 
results), redirect (permanently) them to corresponding the URL with the 
language code. How you choose which language to send them to is up to you -- 
based on a saved language preference for the logged in user, the browser's 
AcceptLanguage header, the country of the user's IP address, etc., or a 
combination of these.


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: i18n and Google Indexing Problem - Google only indexes default language

2011-03-22 Thread DigitalDude
Hey Ryan,


half an hour ago I implemented a redirect to a link with the language
code based on the session language when no language code is given by
the url. So instead of displaying the view for www.domain.com, I check
in the controller if a language is given by a passed-argument and if
not, I redirect them to www.domain.com/it for the italian version.

But I don't think this can solve the problem. When the Google Bit
cannot start a session there will always be english as the default
language, and so even now he would be redirected to www.domain.com/en
and no other languages will be checked.

Am I missing something here? Does the URL language code (like www.domain.com/it)
ALWAYS have to set the session language to this specific language? Or
is it ok when I tell google to check for www.domain.com/it, which
would set the language to italian, and other links like it/controller/
action/param would not? The Bot maybe only needs a start url which
sets the language, I could even use the action called for this route
to write to the Configure::write('Language.default') and then the Bot
would get the correct locale?

I know this is a bit much but I hope you get a little idea of how my
system works so you can understand what I'm concerned of.

Regards,

DD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: i18n and Google Indexing Problem - Google only indexes default language

2011-03-22 Thread Ryan Schmidt
On Mar 22, 2011, at 08:16, DigitalDude wrote:
 half an hour ago I implemented a redirect to a link with the language
 code based on the session language when no language code is given by
 the url. So instead of displaying the view for www.domain.com, I check
 in the controller if a language is given by a passed-argument and if
 not, I redirect them to www.domain.com/it for the italian version.
 
 But I don't think this can solve the problem. When the Google Bit
 cannot start a session there will always be english as the default
 language, and so even now he would be redirected to www.domain.com/en
 and no other languages will be checked.

So the problem is how to get Google to realize that URLs with other language 
codes (like www.domain.com/it) exist. The obvious thing to do would be to have 
links on each page, linking to the same page in each other available language. 
For example on the page www.domain.com/en/somepage you might have:

ul class=language-menu
lia href=/en/somepageEnglish/a/li
lia href=/de/somepageGerman/a/li
lia href=/it/somepageItalian/a/li
/ul

These links would be generated by the usual CakePHP array method.


Another option would be to create a sitemap, and on the sitemap, have links to 
each language's homepage, then make sure your sitemap is linked from your 
site's footer, or at least inform Google of your sitemap so it can crawl it.



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: i18n and Google Indexing Problem - Google only indexes default language

2011-03-22 Thread DigitalDude
Hey,


ok for now I did the following:

when entering the url www.domain.com/it, the default language and all
other language depending variables are set to italian. when entering
www.domain.com/es you'll have the same behaviour for spanish. Maybe
that will help the Google Bot indexing all other languages now?

I hope the Bot is able to read PHP Apps that use Gettexts and relies
on the default language for the app, otherwise I have no clue how to
make the content available for other languages as the source code
language is english, although it's all gettext and the po-files
(languagecatalogues) are right in place... It's all depening on how
smart the Google Bot is and how it works with PHP Frameworks...

Any other suggestions?

Regards,

DD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: i18n and Google Indexing Problem - Google only indexes default language

2011-03-22 Thread Ryan Schmidt

On Mar 22, 2011, at 09:02, DigitalDude wrote:

 when entering the url www.domain.com/it, the default language and all
 other language depending variables are set to italian. when entering
 www.domain.com/es you'll have the same behaviour for spanish. Maybe
 that will help the Google Bot indexing all other languages now?
 
 I hope the Bot is able to read PHP Apps that use Gettexts and relies
 on the default language for the app, otherwise I have no clue how to
 make the content available for other languages as the source code
 language is english, although it's all gettext and the po-files
 (languagecatalogues) are right in place... It's all depening on how
 smart the Google Bot is and how it works with PHP Frameworks...

Turn off cookies in your browser (so that the session cannot be used). View 
www.domain.com/it. Verify it appears in Italian. If not, fix your code.

If there is a language code in the URL, that is the language your app should 
display in; ignore anything in the session or user preferences at that point. 
The only time you'd need to look in the session or user preferences to see what 
language to use is if no language code is in the URL already (in which case, 
you'll do a 301 Moved Permanent redirect to the same URL including the language 
code).



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: i18n and Google Indexing Problem - Google only indexes default language

2011-03-22 Thread DigitalDude
Hey,


yeah I did exactly this, the language code will set the default
language of the app to the given code. So when poniting Google to
www.domain.com/it it should find the whole app in the italian locale
and index its content correctly. Now I'll have to wait until the Robot
comes back around to index the page again I think... :(

Thanks at this point for all the information, I'll get back to this
thread when I have any news in the subject ;) !

Regards,

DD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Shell/CronJob - How to set locale for gettext() and i18n?

2011-02-19 Thread DigitalDude
Hey,

this actually works! It's pretty cool because I store the preferred
user language for the app in a database-field for the user and now I
can send everyone a report email with a cronjob and everyone gets the
email in the preferred language!
Now I only need to check if I have all the variables I set in the
app_controller globally for the whole app accessible in the cron
email, that would also be very very nice!

THX to you guys, that one works like a charm :)

Regards,

DD



On 17 Feb., 23:45, Ryan Schmidt google-2...@ryandesign.com wrote:
 Right, you:

 Configure::write('Config.language', 'whatever');

 Your current code uses the session in some way when deciding what language to 
 write? Fine for when your code is running as a web site where there is a 
 session, but for cases when you're running without a session, like in a shell 
 script, you'll want to have a different method for selecting what language to 
 write into the config.

 On Feb 17, 2011, at 15:21, John Andersen wrote:

  Use the Configure statement as specified in the CakePHP book at:
 http://book.cakephp.org/#!/view/1230/Localization-in-CakePHP

  Enjoy,
    John

  On Feb 17, 6:44 pm, DigitalDude e.blumsten...@googlemail.com wrote:
  Hey,

  I ran into a problem the other day, and I don't know what to do right
  now.

  I have a shell which is run as a cronjob, and this shell/cronjob sends
  weekly status reports about a users work-environment. In these emails,
  there is text as gettext and sometimes even i18n models with specific
  language-depending content.

  My problem is: How can I set a Session Language or a locale for the
  content? In a shell I don't have a Session and I've never seen
  anything like this before. So does anyone have a clue what's best
  practice for this kind of stuff?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Shell/CronJob - How to set locale for gettext() and i18n?

2011-02-17 Thread DigitalDude
Hey,

I ran into a problem the other day, and I don't know what to do right
now.

I have a shell which is run as a cronjob, and this shell/cronjob sends
weekly status reports about a users work-environment. In these emails,
there is text as gettext and sometimes even i18n models with specific
language-depending content.

My problem is: How can I set a Session Language or a locale for the
content? In a shell I don't have a Session and I've never seen
anything like this before. So does anyone have a clue what's best
practice for this kind of stuff?

Regards,

DD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Shell/CronJob - How to set locale for gettext() and i18n?

2011-02-17 Thread John Andersen
Use the Configure statement as specified in the CakePHP book at:
http://book.cakephp.org/#!/view/1230/Localization-in-CakePHP

Enjoy,
   John

On Feb 17, 6:44 pm, DigitalDude e.blumsten...@googlemail.com wrote:
 Hey,

 I ran into a problem the other day, and I don't know what to do right
 now.

 I have a shell which is run as a cronjob, and this shell/cronjob sends
 weekly status reports about a users work-environment. In these emails,
 there is text as gettext and sometimes even i18n models with specific
 language-depending content.

 My problem is: How can I set a Session Language or a locale for the
 content? In a shell I don't have a Session and I've never seen
 anything like this before. So does anyone have a clue what's best
 practice for this kind of stuff?

 Regards,

 DD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Shell/CronJob - How to set locale for gettext() and i18n?

2011-02-17 Thread Ryan Schmidt
Right, you:

Configure::write('Config.language', 'whatever');

Your current code uses the session in some way when deciding what language to 
write? Fine for when your code is running as a web site where there is a 
session, but for cases when you're running without a session, like in a shell 
script, you'll want to have a different method for selecting what language to 
write into the config.

On Feb 17, 2011, at 15:21, John Andersen wrote:

 Use the Configure statement as specified in the CakePHP book at:
 http://book.cakephp.org/#!/view/1230/Localization-in-CakePHP
 
 Enjoy,
   John
 
 On Feb 17, 6:44 pm, DigitalDude e.blumsten...@googlemail.com wrote:
 Hey,
 
 I ran into a problem the other day, and I don't know what to do right
 now.
 
 I have a shell which is run as a cronjob, and this shell/cronjob sends
 weekly status reports about a users work-environment. In these emails,
 there is text as gettext and sometimes even i18n models with specific
 language-depending content.
 
 My problem is: How can I set a Session Language or a locale for the
 content? In a shell I don't have a Session and I've never seen
 anything like this before. So does anyone have a clue what's best
 practice for this kind of stuff?




-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


CakePHP + i18n + MongoDB

2011-01-23 Thread Salines
CakePHP + i18n + MongoDB

I want to hear your experience. Example code?

How to set up? Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: DB field i18n - where I wrong?

2010-11-21 Thread Amit Badkas
Hi,

Your model definition looks fine. What does the SQL query output?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Nov 18, 2010 at 11:44 PM, Mariano C. mariano.calan...@gmail.comwrote:

 I have a table called supports, with two fields: id and name.

 1 single_s
 2 double_s
 ...

 Support model is:
 ?php
 class Support extends AppModel
 {
var $name = 'Support';
var $hasMany = 'BooksUser';
var $actsAs = array('Translate' = array('name'));

function getAll()
{
$this-unbindModel(array('hasMany' = array('BooksUser')));
$options = array
(
'fields' = array(
'Support.id',
'Support.name'
));

return $this-find('all', $options);
}
 }
 ?

 I've created via shell the i18n table and filled with:
 1   eng Support 1   nameSingle support
 2   eng Support 2   nameDouble support
 3   ita Support 1   nameSupporto singolo
 4   ita Support 2   nameSupporto doppio

 I use the Config.language session to change locale, matter of fact all
 static string will be changed when session is switched to the new
 value.
 Db string never change and always eng locale is returned if I exec the
 getAll(). Why?

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


i18n slug

2010-11-20 Thread Salines
Hello bakers,

I developing a web page that uses three languages, one primary
(croatian) and two secondary(english  german). In my db tables
(categories) I have a field 'slug' with the corresponding data . Slug
be also translated from croatian to english  german (deutch) and
stored in i18ns table.

example i18ns url in
- Croatian:  .../categories/moj-naziv
- English:   .../categories/my-name
- German:  .../categories/mein-name

Now i have problem when i want access to data.

here its code:
_

Router::connect('/:controller/:action/:slug', array('controller' =
'categories', 'action' = 'view'),array('pass'=array('slug')));


?php echo $this-Html-link(__('View', true), array('action' =
'view','slug'= $category['Category']['slug'])); ?

-

function view($slug = null) {
if (!$slug) {
$this-Session-setFlash(__('Invalid category', true));
$this-redirect(array('action' = 'index'));
}
// example locale
$this-Category-locale = 'Eng';
$this-set('category', $this-Category-findBySlug($slug));
}



findBySlug($slug)  locking for data in categories table, but
translated slug is stored in category_i18ns table...

How can I solve this? My mind is glowing:)

Thanks.


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: i18n slug

2010-11-20 Thread Tilen Majerle
i think...you will need to check first for slug, typed in categories_i18ns
and then, if exists this slug in some language, then get his foreign_key (id
for post) and with this id get post from posts table (your posts table)

i hope u understand what i mean
--
Tilen Majerle
http://majerle.eu



2010/11/20 Salines nikola.parad...@gmail.com

 Hello bakers,

 I developing a web page that uses three languages, one primary
 (croatian) and two secondary(english  german). In my db tables
 (categories) I have a field 'slug' with the corresponding data . Slug
 be also translated from croatian to english  german (deutch) and
 stored in i18ns table.

 example i18ns url in
 - Croatian:  .../categories/moj-naziv
 - English:   .../categories/my-name
 - German:  .../categories/mein-name

 Now i have problem when i want access to data.

 here its code:
 _

 Router::connect('/:controller/:action/:slug', array('controller' =
 'categories', 'action' = 'view'),array('pass'=array('slug')));
 

 ?php echo $this-Html-link(__('View', true), array('action' =
 'view','slug'= $category['Category']['slug'])); ?

 -

 function view($slug = null) {
if (!$slug) {
$this-Session-setFlash(__('Invalid category', true));
$this-redirect(array('action' = 'index'));
}
// example locale
$this-Category-locale = 'Eng';
$this-set('category', $this-Category-findBySlug($slug));
}
 


 findBySlug($slug)  locking for data in categories table, but
 translated slug is stored in category_i18ns table...

 How can I solve this? My mind is glowing:)

 Thanks.


 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: i18n slug

2010-11-20 Thread Salines
Yes, I had the same idea, but I'm looking for a way without extra
queries, for example, using condition for findbyslug? Is such that if
possible ..

Pozdrav u sloveniju :)

On Nov 20, 12:59 pm, Tilen Majerle tilen.maje...@gmail.com wrote:
 i think...you will need to check first for slug, typed in categories_i18ns
 and then, if exists this slug in some language, then get his foreign_key (id
 for post) and with this id get post from posts table (your posts table)

 i hope u understand what i mean
 --
 Tilen Majerlehttp://majerle.eu

 2010/11/20 Salines nikola.parad...@gmail.com

  Hello bakers,

  I developing a web page that uses three languages, one primary
  (croatian) and two secondary(english  german). In my db tables
  (categories) I have a field 'slug' with the corresponding data . Slug
  be also translated from croatian to english  german (deutch) and
  stored in i18ns table.

  example i18ns url in
  - Croatian:  .../categories/moj-naziv
  - English:   .../categories/my-name
  - German:  .../categories/mein-name

  Now i have problem when i want access to data.

  here its code:
  _

  Router::connect('/:controller/:action/:slug', array('controller' =
  'categories', 'action' = 'view'),array('pass'=array('slug')));
  

  ?php echo $this-Html-link(__('View', true), array('action' =
  'view','slug'= $category['Category']['slug'])); ?

  -

  function view($slug = null) {
         if (!$slug) {
             $this-Session-setFlash(__('Invalid category', true));
             $this-redirect(array('action' = 'index'));
         }
         // example locale
         $this-Category-locale = 'Eng';
         $this-set('category', $this-Category-findBySlug($slug));
     }
  

  findBySlug($slug)  locking for data in categories table, but
  translated slug is stored in category_i18ns table...

  How can I solve this? My mind is glowing:)

  Thanks.

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
  with their CakePHP related questions.

  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.comcake-php%2bunsubscr...@googlegroups.comFor
   more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en



Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: i18n slug

2010-11-20 Thread Tilen Majerle
yes, u want to create a fast script, but findBySlug will need to check
theree too...so its the same shit how u use :D

Pozdrav i tebi :D
--
Tilen Majerle
http://majerle.eu



2010/11/20 Salines nikola.parad...@gmail.com

 Yes, I had the same idea, but I'm looking for a way without extra
 queries, for example, using condition for findbyslug? Is such that if
 possible ..

 Pozdrav u sloveniju :)

 On Nov 20, 12:59 pm, Tilen Majerle tilen.maje...@gmail.com wrote:
  i think...you will need to check first for slug, typed in
 categories_i18ns
  and then, if exists this slug in some language, then get his foreign_key
 (id
  for post) and with this id get post from posts table (your posts table)
 
  i hope u understand what i mean
  --
  Tilen Majerlehttp://majerle.eu
 
  2010/11/20 Salines nikola.parad...@gmail.com
 
   Hello bakers,
 
   I developing a web page that uses three languages, one primary
   (croatian) and two secondary(english  german). In my db tables
   (categories) I have a field 'slug' with the corresponding data . Slug
   be also translated from croatian to english  german (deutch) and
   stored in i18ns table.
 
   example i18ns url in
   - Croatian:  .../categories/moj-naziv
   - English:   .../categories/my-name
   - German:  .../categories/mein-name
 
   Now i have problem when i want access to data.
 
   here its code:
   _
 
   Router::connect('/:controller/:action/:slug', array('controller' =
   'categories', 'action' = 'view'),array('pass'=array('slug')));
   
 
   ?php echo $this-Html-link(__('View', true), array('action' =
   'view','slug'= $category['Category']['slug'])); ?
 
   -
 
   function view($slug = null) {
  if (!$slug) {
  $this-Session-setFlash(__('Invalid category', true));
  $this-redirect(array('action' = 'index'));
  }
  // example locale
  $this-Category-locale = 'Eng';
  $this-set('category', $this-Category-findBySlug($slug));
  }
   
 
   findBySlug($slug)  locking for data in categories table, but
   translated slug is stored in category_i18ns table...
 
   How can I solve this? My mind is glowing:)
 
   Thanks.
 
   Check out the new CakePHP Questions sitehttp://cakeqs.organd help
 others
   with their CakePHP related questions.
 
   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.comcake-php%2bunsubscr...@googlegroups.com
 cake-php%2bunsubscr...@googlegroups.comcake-php%252bunsubscr...@googlegroups.comFor
 more options, visit this group at
  http://groups.google.com/group/cake-php?hl=en
 
 

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: i18n slug

2010-11-20 Thread Salines

I found a solution ;)

1. extra condition

function view($slug = null) {
if (!$slug) {
$this-Session-setFlash(__('Invalid category', true));
$this-redirect(array('action' = 'index'));
}
$this-Category-locale = 'eng';
$this-Category-recursive = 1;
$this-set('category', $this-Category-
find('first',array('conditions'=array('I18n__slug.content'=
$slug),'limit'='1')));
}

OR

2.  sub-query
function view($slug = null){
$this-Category-locale = 'eng';
//$this-set('controller_name', __('Categories',true));
//$this-set('action_name', __('Untranslated Posts',true));
 $dbo = $this-Category-getDataSource();
$subQuery = $dbo-buildStatement(
array(
'fields' = array('foreign_key'),
'table' = 'category_i18ns',
'alias' = 'CategoryI18n',
'limit' = null,
'offset' = null,
'joins' = array(),
'conditions' = array('CategoryI18n.content'=$slug),
'order' = null,
'group' = null
),
$this-Category
   );
  $subQuery = 'Category.id IN (' . $subQuery . ') ';
  $subQueryExpression = $dbo-expression($subQuery);
  $conditions[] = $subQueryExpression;
  $categories = $this-Category-find('all',
compact('conditions'));
  $this-set('category',$categories);
}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


DB field i18n - where I wrong?

2010-11-18 Thread Mariano C.
I have a table called supports, with two fields: id and name.

1 single_s
2 double_s
...

Support model is:
?php
class Support extends AppModel
{
var $name = 'Support';
var $hasMany = 'BooksUser';
var $actsAs = array('Translate' = array('name'));

function getAll()
{
$this-unbindModel(array('hasMany' = array('BooksUser')));
$options = array
(
'fields' = array(
'Support.id',
'Support.name'
));

return $this-find('all', $options);
}
}
?

I've created via shell the i18n table and filled with:
1   eng Support 1   nameSingle support
2   eng Support 2   nameDouble support
3   ita Support 1   nameSupporto singolo
4   ita Support 2   nameSupporto doppio

I use the Config.language session to change locale, matter of fact all
static string will be changed when session is switched to the new
value.
Db string never change and always eng locale is returned if I exec the
getAll(). Why?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


  1   2   3   4   5   >