Re: How to extract the pots files?
On Oct 27, 7:51 pm, santos wrote: > Resolved! :) > Thanks! > > My solution: > I create /vendors/shells/myextract.php : > > class MyextractShell extends Shell { > var $tasks = array('Extract', 'Myextract'); > > function main() { > $this->Myextract->execute(); > } > > } > > I create vendors/shells/tasks/myextract.php : > > class MyextractTask extends ExtractTask { > > function __extractTokens() { > foreach ($this->__files as $file) { > $this->__file = $file; > $this->out(sprintf(__('Processing %s...', true), > $file)); > > $code = file_get_contents($file); > $allTokens = token_get_all($code); > $this->__tokens = array(); > $lineNumber = 1; > > foreach ($allTokens as $token) { > if ((!is_array($token)) || (($token[0] != > T_WHITESPACE) && ($token[0] != > T_INLINE_HTML))) { > if (is_array($token)) { > $token[] = $lineNumber; > } > $this->__tokens[] = $token; > } > > if (is_array($token)) { > $lineNumber += count(explode("\n", > $token[1])) - 1; > } else { > $lineNumber += count(explode("\n", > $token)) - 1; > } > } > unset($allTokens); > $this->__parse('__', array('singular')); > $this->__parse('__n', array('singular', 'plural')); > $this->__parse('__d', array('domain', 'singular')); > $this->__parse('__c', array('singular')); > $this->__parse('__dc', array('domain', 'singular')); > $this->__parse('__dn', array('domain', 'singular', > 'plural')); > $this->__parse('__dcn', array('domain', 'singular', > 'plural')); > > $this->__parse('__myd', array('domain', 'singular')); > $this->__parse('__mydn', array('domain', 'singular', > 'plural')); > } > } > > } > > and execute in terminal: cake myextract Well done :) 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
Re: How to extract the pots files?
Resolved! :) Thanks! My solution: I create /vendors/shells/myextract.php : class MyextractShell extends Shell { var $tasks = array('Extract', 'Myextract'); function main() { $this->Myextract->execute(); } } I create vendors/shells/tasks/myextract.php : class MyextractTask extends ExtractTask { function __extractTokens() { foreach ($this->__files as $file) { $this->__file = $file; $this->out(sprintf(__('Processing %s...', true), $file)); $code = file_get_contents($file); $allTokens = token_get_all($code); $this->__tokens = array(); $lineNumber = 1; foreach ($allTokens as $token) { if ((!is_array($token)) || (($token[0] != T_WHITESPACE) && ($token[0] != T_INLINE_HTML))) { if (is_array($token)) { $token[] = $lineNumber; } $this->__tokens[] = $token; } if (is_array($token)) { $lineNumber += count(explode("\n", $token[1])) - 1; } else { $lineNumber += count(explode("\n", $token)) - 1; } } unset($allTokens); $this->__parse('__', array('singular')); $this->__parse('__n', array('singular', 'plural')); $this->__parse('__d', array('domain', 'singular')); $this->__parse('__c', array('singular')); $this->__parse('__dc', array('domain', 'singular')); $this->__parse('__dn', array('domain', 'singular', 'plural')); $this->__parse('__dcn', array('domain', 'singular', 'plural')); $this->__parse('__myd', array('domain', 'singular')); $this->__parse('__mydn', array('domain', 'singular', 'plural')); } } } and execute in terminal: cake myextract Thanks! -- View this message in context: http://cakephp.1045679.n5.nabble.com/How-can-I-extract-the-pots-files-tp4939833p4943728.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: How to extract the pots files?
On Oct 27, 2:34 pm, santos wrote: > I don't know how to do this. > Can you explain? Give me a example. > if you don't know and won't investigate how to create a shell command (it's not hard) - just do it with poEdit (no I'm not going to put that answer on a plate either) 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
Re: How to extract the pots files?
I don't know how to do this. Can you explain? Give me a example. I need to create a new file? in which folder I put in the file? On Oct 27, 7:28 am, AD7six wrote: > On Oct 26, 3:53 pm, santos wrote: > > > > > > > > > > > Hi > > > I had to make my own function __d and put in bootstrap file, like this: > > > function __myd($domain, $msg, $return = false) { > > $str = __d($domain, $msg, true); > > $var = array('translation' => $str, 'md5'=> md5($str)); > > $count = count(Configure::read('var')) + 1; > > Configure::write("speaklike.$count", $var); > > return __d($domain, $msg, $return); > > > } > > > In the views I use: > > __myd('public', 'Hello world'); > > > I tried to extract the pots files using 'cake i18n extract' in terminal, but > > didnt work... because I created my own function to translate. How can i > > extract the pots files? > > Well you'll need to write your own extract task, extending the core > extract task and call > > $this->_parse('__myd', array('domain', 'singular')); > > in it. > > 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
Re: How to extract the pots files?
On Oct 26, 3:53 pm, santos wrote: > Hi > > I had to make my own function __d and put in bootstrap file, like this: > > function __myd($domain, $msg, $return = false) { > $str = __d($domain, $msg, true); > $var = array('translation' => $str, 'md5'=> md5($str)); > $count = count(Configure::read('var')) + 1; > Configure::write("speaklike.$count", $var); > return __d($domain, $msg, $return); > > } > > In the views I use: > __myd('public', 'Hello world'); > > I tried to extract the pots files using 'cake i18n extract' in terminal, but > didnt work... because I created my own function to translate. How can i > extract the pots files? Well you'll need to write your own extract task, extending the core extract task and call $this->_parse('__myd', array('domain', 'singular')); in it. 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
Re: How to extract the pots files?
On Oct 27, 12:21 am, santos wrote: > Preciso que no final da pagina antes do colocar em um array > javascript todas as frases que foram traduzidas na pagina que esta sendo > mostrada! > > Eu consegui resolver a parte de colocar as frases no array javascript > criando a minha propria funcao __d() criei a funcao __myd() e coloquei > no bootstrap... > Porem assim nao consegui mais gerar os pot =\ > > Infelizmente não serve a opção de ler os arquivos pots e escrever eles! ja > que so tenho que mostrar as frases traduzidas da corrente pagina! You've accidentally replied in not-English instead of posting to the pt group. 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
Re: How to extract the pots files?
Preciso que no final da pagina antes do colocar em um array javascript todas as frases que foram traduzidas na pagina que esta sendo mostrada! Eu consegui resolver a parte de colocar as frases no array javascript criando a minha propria funcao __d() criei a funcao __myd() e coloquei no bootstrap... Porem assim nao consegui mais gerar os pot =\ Infelizmente não serve a opção de ler os arquivos pots e escrever eles! ja que so tenho que mostrar as frases traduzidas da corrente pagina! . -- View this message in context: http://cakephp.1045679.n5.nabble.com/How-can-I-extract-the-pots-files-tp4939833p4941428.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: How to extract the pots files?
Because I need to put in the bottom of the page only the messages that were translated in the current page. Thanks. -- View this message in context: http://cakephp.1045679.n5.nabble.com/How-can-I-extract-the-pots-files-tp4939833p4939945.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: How to extract the pots files?
And why don't you just use the default translation functions and then you read the .pot files with a PHP lib? Regards, -- ***Thiago Belem* Desenvolvedor Rio de Janeiro - RJ - Brasil +55 (21) 8865.9250 thiagobelem.net cont...@thiagobelem.net *Skype / gTalk **»* thiago.belem.web *LinkedIn* *»* br.linkedin.com/in/thiagobelem/pt* Assando Sites*, curso de CakePHP *»* assando-sites.com.br On Wed, Oct 26, 2011 at 12:24, santos wrote: > I need to put all messages who is translated with __d() and __dn() in array > to use in the botton of the page to use in 'SpeakLike Review Bar'. > > 'SpeakLike Review Bar is a widget that makes it easy to provide translation > feedback for a website' > > > so I had to make my own function __myd , __mydn and put in bootstrap > file,... > > The only problem is when i try to extract the pots files > > -- > View this message in context: > http://cakephp.1045679.n5.nabble.com/How-can-I-extract-the-pots-files-tp4939833p4939911.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 > -- 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: How to extract the pots files?
I need to put all messages who is translated with __d() and __dn() in array to use in the botton of the page to use in 'SpeakLike Review Bar'. 'SpeakLike Review Bar is a widget that makes it easy to provide translation feedback for a website' so I had to make my own function __myd , __mydn and put in bootstrap file,... The only problem is when i try to extract the pots files -- View this message in context: http://cakephp.1045679.n5.nabble.com/How-can-I-extract-the-pots-files-tp4939833p4939911.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: How to extract the pots files?
So.. again: Why did you create your own translation function? The i18n defaults aren't enough? -- ***Thiago Belem* Desenvolvedor Rio de Janeiro - RJ - Brasil +55 (21) 8865.9250 thiagobelem.net cont...@thiagobelem.net *Skype / gTalk **»* thiago.belem.web *LinkedIn* *»* br.linkedin.com/in/thiagobelem/pt* Assando Sites*, curso de CakePHP *»* assando-sites.com.br On Wed, Oct 26, 2011 at 11:53, santos wrote: > Hi > > I had to make my own function __d and put in bootstrap file, like this: > > function __myd($domain, $msg, $return = false) { >$str = __d($domain, $msg, true); >$var = array('translation' => $str, 'md5'=> md5($str)); >$count = count(Configure::read('var')) + 1; >Configure::write("speaklike.$count", $var); >return __d($domain, $msg, $return); > } > > In the views I use: > __myd('public', 'Hello world'); > > > > I tried to extract the pots files using 'cake i18n extract' in terminal, > but > didnt work... because I created my own function to translate. How can i > extract the pots files? > > > -- > View this message in context: > http://cakephp.1045679.n5.nabble.com/How-to-extract-the-pots-files-tp4939833p4939833.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 > -- 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
How to extract the pots files?
Hi I had to make my own function __d and put in bootstrap file, like this: function __myd($domain, $msg, $return = false) { $str = __d($domain, $msg, true); $var = array('translation' => $str, 'md5'=> md5($str)); $count = count(Configure::read('var')) + 1; Configure::write("speaklike.$count", $var); return __d($domain, $msg, $return); } In the views I use: __myd('public', 'Hello world'); I tried to extract the pots files using 'cake i18n extract' in terminal, but didnt work... because I created my own function to translate. How can i extract the pots files? -- View this message in context: http://cakephp.1045679.n5.nabble.com/How-to-extract-the-pots-files-tp4939833p4939833.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