Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Toby Ashley
While this discussion is going on, I thought I'd raise / ask something...

In a recent project, I needed to make it easy for administrators to be able
to edit the text used throughout the site. The site itself runs in 12
languages, and as a result I have 12 *.po files, one per territory. The
administrators for each language are fairly non-technical, and so the system
needed to be easy.

I built a simple system which would do the following:

-- Provide a 'download existing website text' button to the administrator -
the controller action would then read through the appropriate *.po file and
generate a CSV with two columns, the identifier (i'm also using descriptive
slugs, as mentioned by Miles) and the current string for that identifier

-- The administrator can then make the necessary amendments before
re-importing the CSV. When re-importing, the system backs up the existing
*.po file and creates a new one, manually writing the msgid and msgstr
values from the data in the CSV. Finally, when this is done, the system
removes any relevant cache files and  hey presto - the website text is
updated.

-- There's also tools to revert to previous backup, in case they make an
almighty mess of everything.

This system worked fine for the project, and the administrators of the site
are maintaining the different languages with success, but I'm wondering if
there's a better / simpler / more recommend way of achieving the same
functionality. I guess it's kind of like a friendly, web-based interface for
editing these *.po files

Any suggestions?

Cheers,
toby



On Wed, Oct 14, 2009 at 2:05 AM, Larry E. Masters aka PhpNut 
php...@gmail.com wrote:

 Cool, let me know if you have any questions.
 --
 /**
 * @author Larry E. Masters
 * @var string $userName
 * @param string $realName
 * @returns string aka PhpNut
 * @access  public
 */

 On Tue, Oct 13, 2009 at 7:46 PM, Miles J mileswjohn...@gmail.com wrote:


 Well see now a lot of it makes sense. The guide is pretty vague on
 i18n/l10n and how it works / is used.

 Will give this a try.

 On Oct 13, 5:39 pm, Larry E. Masters aka PhpNut php...@gmail.com
 wrote:
  Incorrect, the file that is created using the i18n extract creates a
 .pot
  file which is a template file and can be opened in any po editor or text
  editor. The template is not language specific. There is no reason to
 create
  these files by hand. Write your code and output using the sentences you
  would normally use just wrap the string in __() function. Run the
 extractor
  and you are done.
  Easiest tool to edit translations I have recently found is
 poedit.www.poedit.net
 
  I uploaded current core extracted pot file.
 
  http://cake-php.googlegroups.com/web/default.pot
 
  Download it and open in poedit.
 
  The nice thing about these pot file is you can create a new version with
  changes in your application, reopen the template in poedit, and it will
  merge changes highlighting the strings that have changed.
 
  Not sure if you are aware how the other translation functions work in
 the
  core, but when it comes to handling plurals in a sentence, your slugs
 will
  become more confusing.
 
  for($number = 0; $i  100; $number++) {
  sprintf(__n('There is %d apple in the fruit bowl', 'There are %d apples
 in
  the fruit bowl', $number), $number);
 
  }
 
  msgid There is %d apple in the fruit bowl
  msgid_plural There are %d apples in the fruit bowl
  msgstr[0] 
  msgstr[1] 
  msgstr[2] 
  msgstr[3] 
  msgstr[4] 
  msgstr[5] 
  msgstr[6] 
 
  There are 16 plural rules that range from 1 form of plural to 6 forms of
  plural depending on the value of $number. It all depends and the
 language
  the content is being translated to. The above example be based on the
 header
  in the po file, which poedit allows you to set based on the language you
 are
  using.
 
  Only 1 form of plural.
  Plural-Forms: nplurals=1; plural=0;\n
 
  6 forms of plural.
  Plural-Forms: nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n==0 || (n=3 
  n=10) ? 2 : 3;\n
 
  14 other forms or plural are available. These will be added to the
  translation site I had online for the project before. This will be
 coming
  back online in the next few weeks. They will also be added to the book,
 with
  corrections on the proper use of these functions soon. If you need the
  correct plural form before then, let me know and I can reply with it.
 
  --
  /**
  * @author Larry E. Masters
  * @var string $userName
  * @param string $realName
  * @returns string aka PhpNut
  * @access  public
  */
 
  On Tue, Oct 13, 2009 at 6:50 PM, Miles J mileswjohn...@gmail.com
 wrote:
 
   But you would need to make the english po file anyways if you are
   going to distribute it and have it translated.
 
   On Oct 13, 12:58 pm, Larry E. Masters aka PhpNut php...@gmail.com
   wrote:
So you are basically using these as defines?
--
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
  

Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Miles J

Additionally on the subject of PhpNut's suggestion. What if we change
the text string in the view (english one) and then the translated ones
wont match anymore because the msgid has changed. And if we generate
new po files then we would have to translate them all over again.
Thats primarily my reason for using slugs.

On Oct 14, 7:15 am, Toby Ashley lowpi...@gmail.com wrote:
 While this discussion is going on, I thought I'd raise / ask something...

 In a recent project, I needed to make it easy for administrators to be able
 to edit the text used throughout the site. The site itself runs in 12
 languages, and as a result I have 12 *.po files, one per territory. The
 administrators for each language are fairly non-technical, and so the system
 needed to be easy.

 I built a simple system which would do the following:

 -- Provide a 'download existing website text' button to the administrator -
 the controller action would then read through the appropriate *.po file and
 generate a CSV with two columns, the identifier (i'm also using descriptive
 slugs, as mentioned by Miles) and the current string for that identifier

 -- The administrator can then make the necessary amendments before
 re-importing the CSV. When re-importing, the system backs up the existing
 *.po file and creates a new one, manually writing the msgid and msgstr
 values from the data in the CSV. Finally, when this is done, the system
 removes any relevant cache files and  hey presto - the website text is
 updated.

 -- There's also tools to revert to previous backup, in case they make an
 almighty mess of everything.

 This system worked fine for the project, and the administrators of the site
 are maintaining the different languages with success, but I'm wondering if
 there's a better / simpler / more recommend way of achieving the same
 functionality. I guess it's kind of like a friendly, web-based interface for
 editing these *.po files

 Any suggestions?

 Cheers,
 toby

 On Wed, Oct 14, 2009 at 2:05 AM, Larry E. Masters aka PhpNut 

 php...@gmail.com wrote:
  Cool, let me know if you have any questions.
  --
  /**
  * @author Larry E. Masters
  * @var string $userName
  * @param string $realName
  * @returns string aka PhpNut
  * @access  public
  */

  On Tue, Oct 13, 2009 at 7:46 PM, Miles J mileswjohn...@gmail.com wrote:

  Well see now a lot of it makes sense. The guide is pretty vague on
  i18n/l10n and how it works / is used.

  Will give this a try.

  On Oct 13, 5:39 pm, Larry E. Masters aka PhpNut php...@gmail.com
  wrote:
   Incorrect, the file that is created using the i18n extract creates a
  .pot
   file which is a template file and can be opened in any po editor or text
   editor. The template is not language specific. There is no reason to
  create
   these files by hand. Write your code and output using the sentences you
   would normally use just wrap the string in __() function. Run the
  extractor
   and you are done.
   Easiest tool to edit translations I have recently found is
  poedit.www.poedit.net

   I uploaded current core extracted pot file.

  http://cake-php.googlegroups.com/web/default.pot

   Download it and open in poedit.

   The nice thing about these pot file is you can create a new version with
   changes in your application, reopen the template in poedit, and it will
   merge changes highlighting the strings that have changed.

   Not sure if you are aware how the other translation functions work in
  the
   core, but when it comes to handling plurals in a sentence, your slugs
  will
   become more confusing.

   for($number = 0; $i  100; $number++) {
   sprintf(__n('There is %d apple in the fruit bowl', 'There are %d apples
  in
   the fruit bowl', $number), $number);

   }

   msgid There is %d apple in the fruit bowl
   msgid_plural There are %d apples in the fruit bowl
   msgstr[0] 
   msgstr[1] 
   msgstr[2] 
   msgstr[3] 
   msgstr[4] 
   msgstr[5] 
   msgstr[6] 

   There are 16 plural rules that range from 1 form of plural to 6 forms of
   plural depending on the value of $number. It all depends and the
  language
   the content is being translated to. The above example be based on the
  header
   in the po file, which poedit allows you to set based on the language you
  are
   using.

   Only 1 form of plural.
   Plural-Forms: nplurals=1; plural=0;\n

   6 forms of plural.
   Plural-Forms: nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n==0 || (n=3 
   n=10) ? 2 : 3;\n

   14 other forms or plural are available. These will be added to the
   translation site I had online for the project before. This will be
  coming
   back online in the next few weeks. They will also be added to the book,
  with
   corrections on the proper use of these functions soon. If you need the
   correct plural form before then, let me know and I can reply with it.

   --
   /**
   * @author Larry E. Masters
   * @var string $userName
   * @param string $realName
   * @returns string aka PhpNut
   * @access  public
   

Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Larry E. Masters aka PhpNut
Toby,
It sounds like you are trying to use translations as a way to also change
text.

Examples (forgive me in advance if google did not translate these properly):

Welcome to the home page of CakePHP the best PHP framework for rapidly
building applications.

Translated to German this would be:

Willkommen auf der Homepage von CakePHP den besten Rahmen für PHP schnell
die Erstellung von Anwendungen.

Anything else would not be a translation:

Example:

Herzlich Willkommen auf meiner Homepage der Anwendungen habe ich mit Hilfe
meiner CakePHP Rahmen der Wahl.

Which means:

Welcome to my home page of the applications I have built using CakePHP my
framework of choice.

This is not translating text, and it not what I18n is to be used for.

-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

On Wed, Oct 14, 2009 at 9:15 AM, Toby Ashley lowpi...@gmail.com wrote:

 While this discussion is going on, I thought I'd raise / ask something...

 In a recent project, I needed to make it easy for administrators to be able
 to edit the text used throughout the site. The site itself runs in 12
 languages, and as a result I have 12 *.po files, one per territory. The
 administrators for each language are fairly non-technical, and so the system
 needed to be easy.

 I built a simple system which would do the following:

 -- Provide a 'download existing website text' button to the administrator -
 the controller action would then read through the appropriate *.po file and
 generate a CSV with two columns, the identifier (i'm also using descriptive
 slugs, as mentioned by Miles) and the current string for that identifier

 -- The administrator can then make the necessary amendments before
 re-importing the CSV. When re-importing, the system backs up the existing
 *.po file and creates a new one, manually writing the msgid and msgstr
 values from the data in the CSV. Finally, when this is done, the system
 removes any relevant cache files and  hey presto - the website text is
 updated.

 -- There's also tools to revert to previous backup, in case they make an
 almighty mess of everything.

 This system worked fine for the project, and the administrators of the site
 are maintaining the different languages with success, but I'm wondering if
 there's a better / simpler / more recommend way of achieving the same
 functionality. I guess it's kind of like a friendly, web-based interface for
 editing these *.po files

 Any suggestions?

 Cheers,
 toby




 On Wed, Oct 14, 2009 at 2:05 AM, Larry E. Masters aka PhpNut 
 php...@gmail.com wrote:

 Cool, let me know if you have any questions.
 --
 /**
 * @author Larry E. Masters
 * @var string $userName
 * @param string $realName
 * @returns string aka PhpNut
 * @access  public
 */

 On Tue, Oct 13, 2009 at 7:46 PM, Miles J mileswjohn...@gmail.com wrote:


 Well see now a lot of it makes sense. The guide is pretty vague on
 i18n/l10n and how it works / is used.

 Will give this a try.

 On Oct 13, 5:39 pm, Larry E. Masters aka PhpNut php...@gmail.com
 wrote:
  Incorrect, the file that is created using the i18n extract creates a
 .pot
  file which is a template file and can be opened in any po editor or
 text
  editor. The template is not language specific. There is no reason to
 create
  these files by hand. Write your code and output using the sentences you
  would normally use just wrap the string in __() function. Run the
 extractor
  and you are done.
  Easiest tool to edit translations I have recently found is
 poedit.www.poedit.net
 
  I uploaded current core extracted pot file.
 
  http://cake-php.googlegroups.com/web/default.pot
 
  Download it and open in poedit.
 
  The nice thing about these pot file is you can create a new version
 with
  changes in your application, reopen the template in poedit, and it will
  merge changes highlighting the strings that have changed.
 
  Not sure if you are aware how the other translation functions work in
 the
  core, but when it comes to handling plurals in a sentence, your slugs
 will
  become more confusing.
 
  for($number = 0; $i  100; $number++) {
  sprintf(__n('There is %d apple in the fruit bowl', 'There are %d apples
 in
  the fruit bowl', $number), $number);
 
  }
 
  msgid There is %d apple in the fruit bowl
  msgid_plural There are %d apples in the fruit bowl
  msgstr[0] 
  msgstr[1] 
  msgstr[2] 
  msgstr[3] 
  msgstr[4] 
  msgstr[5] 
  msgstr[6] 
 
  There are 16 plural rules that range from 1 form of plural to 6 forms
 of
  plural depending on the value of $number. It all depends and the
 language
  the content is being translated to. The above example be based on the
 header
  in the po file, which poedit allows you to set based on the language
 you are
  using.
 
  Only 1 form of plural.
  Plural-Forms: nplurals=1; plural=0;\n
 
  6 forms of plural.
  Plural-Forms: nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n==0 || (n=3
 
  n=10) ? 2 : 3;\n
 
  

Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Larry E. Masters aka PhpNut
Miles,

It is not a suggestion it is the correct way the code should be used.

As I stated in the previous email the pot file is reopened, using poedit for
example, and you merge the changes from your code. Your .po and .mo files
will have the correct msgid and your translators will be able to open the
file and know that it has been altered because the fields are marked as
fuzzy translation.

When I originally wrote this code I used gettext, which is a commonly used
implementation, as a model to build it for CakePHP.

http://en.wikipedia.org/wiki/GNU_gettext
http://www.gnu.org/software/gettext/
http://gnuwin32.sourceforge.net/packages/gettext.htm

There are many other examples you can find on the internet showing proper
way to use gettext.

Look at the site setup for translating GNU and other projects:
http://translationproject.org/

I doubt you will find a project out of the 160+ on that site using slugs
like you suggest.

You can use the code however you like though.

-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

On Wed, Oct 14, 2009 at 11:21 AM, Miles J mileswjohn...@gmail.com wrote:


 Additionally on the subject of PhpNut's suggestion. What if we change
 the text string in the view (english one) and then the translated ones
 wont match anymore because the msgid has changed. And if we generate
 new po files then we would have to translate them all over again.
 Thats primarily my reason for using slugs.

 On Oct 14, 7:15 am, Toby Ashley lowpi...@gmail.com wrote:
  While this discussion is going on, I thought I'd raise / ask something...
 
  In a recent project, I needed to make it easy for administrators to be
 able
  to edit the text used throughout the site. The site itself runs in 12
  languages, and as a result I have 12 *.po files, one per territory. The
  administrators for each language are fairly non-technical, and so the
 system
  needed to be easy.
 
  I built a simple system which would do the following:
 
  -- Provide a 'download existing website text' button to the administrator
 -
  the controller action would then read through the appropriate *.po file
 and
  generate a CSV with two columns, the identifier (i'm also using
 descriptive
  slugs, as mentioned by Miles) and the current string for that identifier
 
  -- The administrator can then make the necessary amendments before
  re-importing the CSV. When re-importing, the system backs up the existing
  *.po file and creates a new one, manually writing the msgid and msgstr
  values from the data in the CSV. Finally, when this is done, the system
  removes any relevant cache files and  hey presto - the website text is
  updated.
 
  -- There's also tools to revert to previous backup, in case they make an
  almighty mess of everything.
 
  This system worked fine for the project, and the administrators of the
 site
  are maintaining the different languages with success, but I'm wondering
 if
  there's a better / simpler / more recommend way of achieving the same
  functionality. I guess it's kind of like a friendly, web-based interface
 for
  editing these *.po files
 
  Any suggestions?
 
  Cheers,
  toby
 
  On Wed, Oct 14, 2009 at 2:05 AM, Larry E. Masters aka PhpNut 
 
  php...@gmail.com wrote:
   Cool, let me know if you have any questions.
   --
   /**
   * @author Larry E. Masters
   * @var string $userName
   * @param string $realName
   * @returns string aka PhpNut
   * @access  public
   */
 
   On Tue, Oct 13, 2009 at 7:46 PM, Miles J mileswjohn...@gmail.com
 wrote:
 
   Well see now a lot of it makes sense. The guide is pretty vague on
   i18n/l10n and how it works / is used.
 
   Will give this a try.
 
   On Oct 13, 5:39 pm, Larry E. Masters aka PhpNut php...@gmail.com
   wrote:
Incorrect, the file that is created using the i18n extract creates a
   .pot
file which is a template file and can be opened in any po editor or
 text
editor. The template is not language specific. There is no reason to
   create
these files by hand. Write your code and output using the sentences
 you
would normally use just wrap the string in __() function. Run the
   extractor
and you are done.
Easiest tool to edit translations I have recently found is
   poedit.www.poedit.net
 
I uploaded current core extracted pot file.
 
   http://cake-php.googlegroups.com/web/default.pot
 
Download it and open in poedit.
 
The nice thing about these pot file is you can create a new version
 with
changes in your application, reopen the template in poedit, and it
 will
merge changes highlighting the strings that have changed.
 
Not sure if you are aware how the other translation functions work
 in
   the
core, but when it comes to handling plurals in a sentence, your
 slugs
   will
become more confusing.
 
for($number = 0; $i  100; $number++) {
sprintf(__n('There is %d apple in the fruit bowl', 'There are %d

Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Pablo Viojo
We are using slugs for translations in our site, and our site is quite
big... :)


Pablo Viojo
pvi...@gmail.com

http://needish.com



On Wed, Oct 14, 2009 at 1:59 PM, Larry E. Masters aka PhpNut 
php...@gmail.com wrote:

 Miles,

 It is not a suggestion it is the correct way the code should be used.

 As I stated in the previous email the pot file is reopened, using poedit
 for example, and you merge the changes from your code. Your .po and .mo
 files will have the correct msgid and your translators will be able to open
 the file and know that it has been altered because the fields are marked
 as fuzzy translation.

 When I originally wrote this code I used gettext, which is a commonly used
 implementation, as a model to build it for CakePHP.

 http://en.wikipedia.org/wiki/GNU_gettext
 http://www.gnu.org/software/gettext/
 http://gnuwin32.sourceforge.net/packages/gettext.htm

 There are many other examples you can find on the internet showing proper
 way to use gettext.

 Look at the site setup for translating GNU and other projects:
 http://translationproject.org/

 I doubt you will find a project out of the 160+ on that site using slugs
 like you suggest.

 You can use the code however you like though.

 --
 /**
 * @author Larry E. Masters
 * @var string $userName
 * @param string $realName
 * @returns string aka PhpNut
 * @access  public
 */

 On Wed, Oct 14, 2009 at 11:21 AM, Miles J mileswjohn...@gmail.com wrote:


 Additionally on the subject of PhpNut's suggestion. What if we change
 the text string in the view (english one) and then the translated ones
 wont match anymore because the msgid has changed. And if we generate
 new po files then we would have to translate them all over again.
 Thats primarily my reason for using slugs.

 On Oct 14, 7:15 am, Toby Ashley lowpi...@gmail.com wrote:
  While this discussion is going on, I thought I'd raise / ask
 something...
 
  In a recent project, I needed to make it easy for administrators to be
 able
  to edit the text used throughout the site. The site itself runs in 12
  languages, and as a result I have 12 *.po files, one per territory. The
  administrators for each language are fairly non-technical, and so the
 system
  needed to be easy.
 
  I built a simple system which would do the following:
 
  -- Provide a 'download existing website text' button to the
 administrator -
  the controller action would then read through the appropriate *.po file
 and
  generate a CSV with two columns, the identifier (i'm also using
 descriptive
  slugs, as mentioned by Miles) and the current string for that identifier
 
  -- The administrator can then make the necessary amendments before
  re-importing the CSV. When re-importing, the system backs up the
 existing
  *.po file and creates a new one, manually writing the msgid and msgstr
  values from the data in the CSV. Finally, when this is done, the system
  removes any relevant cache files and  hey presto - the website text is
  updated.
 
  -- There's also tools to revert to previous backup, in case they make an
  almighty mess of everything.
 
  This system worked fine for the project, and the administrators of the
 site
  are maintaining the different languages with success, but I'm wondering
 if
  there's a better / simpler / more recommend way of achieving the same
  functionality. I guess it's kind of like a friendly, web-based interface
 for
  editing these *.po files
 
  Any suggestions?
 
  Cheers,
  toby
 
  On Wed, Oct 14, 2009 at 2:05 AM, Larry E. Masters aka PhpNut 
 
  php...@gmail.com wrote:
   Cool, let me know if you have any questions.
   --
   /**
   * @author Larry E. Masters
   * @var string $userName
   * @param string $realName
   * @returns string aka PhpNut
   * @access  public
   */
 
   On Tue, Oct 13, 2009 at 7:46 PM, Miles J mileswjohn...@gmail.com
 wrote:
 
   Well see now a lot of it makes sense. The guide is pretty vague on
   i18n/l10n and how it works / is used.
 
   Will give this a try.
 
   On Oct 13, 5:39 pm, Larry E. Masters aka PhpNut php...@gmail.com
   wrote:
Incorrect, the file that is created using the i18n extract creates
 a
   .pot
file which is a template file and can be opened in any po editor or
 text
editor. The template is not language specific. There is no reason
 to
   create
these files by hand. Write your code and output using the sentences
 you
would normally use just wrap the string in __() function. Run the
   extractor
and you are done.
Easiest tool to edit translations I have recently found is
   poedit.www.poedit.net
 
I uploaded current core extracted pot file.
 
   http://cake-php.googlegroups.com/web/default.pot
 
Download it and open in poedit.
 
The nice thing about these pot file is you can create a new version
 with
changes in your application, reopen the template in poedit, and it
 will
merge changes highlighting the strings that have changed.
 
Not sure if you are aware how the other 

Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Toby Ashley
I am using this system mainly for translations, yes. The site runs in 12
languages, and currently contains over 250 ctp files.

However, an added benefit of the l18n system for me is that the
administrator can also make adjustments to the text on the English site, not
just the translated languages. It's far more convenient for me to create a
string with msgid registrationCompleteMessage and allow them to edit that
message themselves in *all* languages, not just the non-English languages.
As we all know, it's a pain when a client endlessly sends through text
amends, and this system allows them to have full control of the content of
their own site.

However, my question wasn't concerning the use of slugs vs full strings - I
can see the pros and cons for each method. My question was about a system
for enabling these translations to be managed through an administration area
of a site, and what methods people are using to do that? My admin users
can't be trusted to have direct access to the *.po files, so I created the
CSV export / import system to allow them to edit the translations safely,
giving me time to validate their translations without ever giving them
direct access to the locales directory. This all works great for my needs,
but I'm wondering if there are any other recommended approaches for this?

Cheers,
toby


On Wed, Oct 14, 2009 at 5:56 PM, Larry E. Masters aka PhpNut 
php...@gmail.com wrote:

 Toby,
 It sounds like you are trying to use translations as a way to also change
 text.

 Examples (forgive me in advance if google did not translate these
 properly):

 Welcome to the home page of CakePHP the best PHP framework for rapidly
 building applications.

 Translated to German this would be:

 Willkommen auf der Homepage von CakePHP den besten Rahmen für PHP schnell
 die Erstellung von Anwendungen.

 Anything else would not be a translation:

 Example:

 Herzlich Willkommen auf meiner Homepage der Anwendungen habe ich mit Hilfe
 meiner CakePHP Rahmen der Wahl.

 Which means:

 Welcome to my home page of the applications I have built using CakePHP my
 framework of choice.

 This is not translating text, and it not what I18n is to be used for.

 --
 /**
 * @author Larry E. Masters
 * @var string $userName
 * @param string $realName
 * @returns string aka PhpNut
 * @access  public
 */

 On Wed, Oct 14, 2009 at 9:15 AM, Toby Ashley lowpi...@gmail.com wrote:

 While this discussion is going on, I thought I'd raise / ask something...

 In a recent project, I needed to make it easy for administrators to be
 able to edit the text used throughout the site. The site itself runs in 12
 languages, and as a result I have 12 *.po files, one per territory. The
 administrators for each language are fairly non-technical, and so the system
 needed to be easy.

 I built a simple system which would do the following:

 -- Provide a 'download existing website text' button to the administrator
 - the controller action would then read through the appropriate *.po file
 and generate a CSV with two columns, the identifier (i'm also using
 descriptive slugs, as mentioned by Miles) and the current string for that
 identifier

 -- The administrator can then make the necessary amendments before
 re-importing the CSV. When re-importing, the system backs up the existing
 *.po file and creates a new one, manually writing the msgid and msgstr
 values from the data in the CSV. Finally, when this is done, the system
 removes any relevant cache files and  hey presto - the website text is
 updated.

 -- There's also tools to revert to previous backup, in case they make an
 almighty mess of everything.

 This system worked fine for the project, and the administrators of the
 site are maintaining the different languages with success, but I'm wondering
 if there's a better / simpler / more recommend way of achieving the same
 functionality. I guess it's kind of like a friendly, web-based interface for
 editing these *.po files

 Any suggestions?

 Cheers,
 toby




 On Wed, Oct 14, 2009 at 2:05 AM, Larry E. Masters aka PhpNut 
 php...@gmail.com wrote:

 Cool, let me know if you have any questions.
 --
 /**
 * @author Larry E. Masters
 * @var string $userName
 * @param string $realName
 * @returns string aka PhpNut
 * @access  public
 */

 On Tue, Oct 13, 2009 at 7:46 PM, Miles J mileswjohn...@gmail.comwrote:


 Well see now a lot of it makes sense. The guide is pretty vague on
 i18n/l10n and how it works / is used.

 Will give this a try.

 On Oct 13, 5:39 pm, Larry E. Masters aka PhpNut php...@gmail.com
 wrote:
  Incorrect, the file that is created using the i18n extract creates a
 .pot
  file which is a template file and can be opened in any po editor or
 text
  editor. The template is not language specific. There is no reason to
 create
  these files by hand. Write your code and output using the sentences
 you
  would normally use just wrap the string in __() function. Run the
 extractor
  and you are done.
  Easiest tool to edit 

Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Rob

as always helpfull ;) thanks guys.
i use full sentences, idd way easier.

shell script works like charm.
i guess it gets compressed/cached by cake anyway (on debug 0), right?

--~--~-~--~~~---~--~~
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: find __() function parameters in /app and update *.po - automated

2009-10-13 Thread Larry E. Masters aka PhpNut
There is a shell script to do this. If the cake console is in your
environment path, this command will work.
cake i18n extract


-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

On Tue, Oct 13, 2009 at 9:13 AM, Rob rob...@catchit.pl wrote:


 Any1 thought about creating little snippet which could speed up
 hardcoded localization process.
 Here is the simple scenerio:
 1) find strings within __('...') __('...',true) string patterns in /
 app folder
 2) build arrays from default locale *.po files containing locale keys
 3) append to end of these files missing id keys in form:
 msgid _register_disclaimer
 msgstr TOODOO


 i create many multilang apps and i believe it could be major speed
 boost for ppl like me.
 we dont need to update these files manually every time we use __(). we
 just run script when app is ready or changed and just update TOODOO
 strings or send them to translators.

 If some1 came up with idea how this could be easly done i would
 apreciate this.

 regular expressions? if so, how to build fault free one?
 


--~--~-~--~~~---~--~~
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: find __() function parameters in /app and update *.po - automated

2009-10-13 Thread Larry E. Masters aka PhpNut
Another thing I forgot to mention. You should be using full strings you want
translated for the msgid.Example:

msgid By registering on this web site you are...

This is the way the core was designed to handle translations. You will also
find it much easier for people to translate your application if they have
everything they need in the 1 .po file vs looking for the text related to a
place holder.

-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

On Tue, Oct 13, 2009 at 9:13 AM, Rob rob...@catchit.pl wrote:


 Any1 thought about creating little snippet which could speed up
 hardcoded localization process.
 Here is the simple scenerio:
 1) find strings within __('...') __('...',true) string patterns in /
 app folder
 2) build arrays from default locale *.po files containing locale keys
 3) append to end of these files missing id keys in form:
 msgid _register_disclaimer
 msgstr TOODOO


 i create many multilang apps and i believe it could be major speed
 boost for ppl like me.
 we dont need to update these files manually every time we use __(). we
 just run script when app is ready or changed and just update TOODOO
 strings or send them to translators.

 If some1 came up with idea how this could be easly done i would
 apreciate this.

 regular expressions? if so, how to build fault free one?
 


--~--~-~--~~~---~--~~
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: find __() function parameters in /app and update *.po - automated

2009-10-13 Thread Miles J

I am personal extremely against naming your ids the full sentence,
what purpose does that serve? Its longer in both the .po and .ctp file
and its a lot easier to reference slugs. To each his own I guess.

On Oct 13, 7:42 am, Larry E. Masters aka PhpNut php...@gmail.com
wrote:
 Another thing I forgot to mention. You should be using full strings you want
 translated for the msgid.Example:

 msgid By registering on this web site you are...

 This is the way the core was designed to handle translations. You will also
 find it much easier for people to translate your application if they have
 everything they need in the 1 .po file vs looking for the text related to a
 place holder.

 --
 /**
 * @author Larry E. Masters
 * @var string $userName
 * @param string $realName
 * @returns string aka PhpNut
 * @access  public
 */

 On Tue, Oct 13, 2009 at 9:13 AM, Rob rob...@catchit.pl wrote:

  Any1 thought about creating little snippet which could speed up
  hardcoded localization process.
  Here is the simple scenerio:
  1) find strings within __('...') __('...',true) string patterns in /
  app folder
  2) build arrays from default locale *.po files containing locale keys
  3) append to end of these files missing id keys in form:
  msgid _register_disclaimer
  msgstr TOODOO

  i create many multilang apps and i believe it could be major speed
  boost for ppl like me.
  we dont need to update these files manually every time we use __(). we
  just run script when app is ready or changed and just update TOODOO
  strings or send them to translators.

  If some1 came up with idea how this could be easly done i would
  apreciate this.

  regular expressions? if so, how to build fault free one?
--~--~-~--~~~---~--~~
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: find __() function parameters in /app and update *.po - automated

2009-10-13 Thread euromark (munich)

i agree with miles

they should be slugged, short and precise
and explained in both the english and foreign .po file

like

regMessageSuccess
and
You have been successfully registered
Sie sind nun erfolgreich angemeldet


or
valErrorRecordNameExists
for
A record with this name already exists

this way you can easily change the original language text (here:
english) without having to change all the x places in the script as
well

maybe it is now supposed to be
You cannot have two records with the same name


but the short slugged term has still the same basic meaning and
therefore remains the same


On 13 Okt., 18:12, Miles J mileswjohn...@gmail.com wrote:
 I am personal extremely against naming your ids the full sentence,
 what purpose does that serve? Its longer in both the .po and .ctp file
 and its a lot easier to reference slugs. To each his own I guess.

 On Oct 13, 7:42 am, Larry E. Masters aka PhpNut php...@gmail.com
 wrote:

  Another thing I forgot to mention. You should be using full strings you want
  translated for the msgid.Example:

  msgid By registering on this web site you are...

  This is the way the core was designed to handle translations. You will also
  find it much easier for people to translate your application if they have
  everything they need in the 1 .po file vs looking for the text related to a
  place holder.

  --
  /**
  * @author Larry E. Masters
  * @var string $userName
  * @param string $realName
  * @returns string aka PhpNut
  * @access  public
  */

  On Tue, Oct 13, 2009 at 9:13 AM, Rob rob...@catchit.pl wrote:

   Any1 thought about creating little snippet which could speed up
   hardcoded localization process.
   Here is the simple scenerio:
   1) find strings within __('...') __('...',true) string patterns in /
   app folder
   2) build arrays from default locale *.po files containing locale keys
   3) append to end of these files missing id keys in form:
   msgid _register_disclaimer
   msgstr TOODOO

   i create many multilang apps and i believe it could be major speed
   boost for ppl like me.
   we dont need to update these files manually every time we use __(). we
   just run script when app is ready or changed and just update TOODOO
   strings or send them to translators.

   If some1 came up with idea how this could be easly done i would
   apreciate this.

   regular expressions? if so, how to build fault free one?
--~--~-~--~~~---~--~~
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: find __() function parameters in /app and update *.po - automated

2009-10-13 Thread Larry E. Masters aka PhpNut
What does the length of the sentences have to do with the way it should be
used? You are duplicating your effort by creating a slug to represent a full
sentence. Keep in mind the .po file is only needed for translations not the
default language.

So in English this:

__('Why duplicate your effort');

would not even have a po file.

But in German you would have a po file with (Used google to translate this):

msgid Why duplicate your effort
msgid Warum doppelte Ihre Bemühungen

Just advising you on the way I wrote the code to work. You can use it anyway
you like I guess, but from a maintenance side distributing your .po files to
a group of translators where they can open them in the editor and see the
exact string that needs to be translated vs trying to find the meaning of
your slug is a plus.

-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

On Tue, Oct 13, 2009 at 11:12 AM, Miles J mileswjohn...@gmail.com wrote:


 I am personal extremely against naming your ids the full sentence,
 what purpose does that serve? Its longer in both the .po and .ctp file
 and its a lot easier to reference slugs. To each his own I guess.

 On Oct 13, 7:42 am, Larry E. Masters aka PhpNut php...@gmail.com
 wrote:
  Another thing I forgot to mention. You should be using full strings you
 want
  translated for the msgid.Example:
 
  msgid By registering on this web site you are...
 
  This is the way the core was designed to handle translations. You will
 also
  find it much easier for people to translate your application if they have
  everything they need in the 1 .po file vs looking for the text related to
 a
  place holder.
 
  --
  /**
  * @author Larry E. Masters
  * @var string $userName
  * @param string $realName
  * @returns string aka PhpNut
  * @access  public
  */
 
  On Tue, Oct 13, 2009 at 9:13 AM, Rob rob...@catchit.pl wrote:
 
   Any1 thought about creating little snippet which could speed up
   hardcoded localization process.
   Here is the simple scenerio:
   1) find strings within __('...') __('...',true) string patterns in /
   app folder
   2) build arrays from default locale *.po files containing locale keys
   3) append to end of these files missing id keys in form:
   msgid _register_disclaimer
   msgstr TOODOO
 
   i create many multilang apps and i believe it could be major speed
   boost for ppl like me.
   we dont need to update these files manually every time we use __(). we
   just run script when app is ready or changed and just update TOODOO
   strings or send them to translators.
 
   If some1 came up with idea how this could be easly done i would
   apreciate this.
 
   regular expressions? if so, how to build fault free one?
 


--~--~-~--~~~---~--~~
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: find __() function parameters in /app and update *.po - automated

2009-10-13 Thread Larry E. Masters aka PhpNut
So you are basically using these as defines?
-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

On Tue, Oct 13, 2009 at 2:19 PM, euromark (munich) 
dereurom...@googlemail.com wrote:


 i agree with miles

 they should be slugged, short and precise
 and explained in both the english and foreign .po file

 like

 regMessageSuccess
 and
 You have been successfully registered
 Sie sind nun erfolgreich angemeldet


 or
 valErrorRecordNameExists
 for
 A record with this name already exists

 this way you can easily change the original language text (here:
 english) without having to change all the x places in the script as
 well

 maybe it is now supposed to be
 You cannot have two records with the same name


 but the short slugged term has still the same basic meaning and
 therefore remains the same


 On 13 Okt., 18:12, Miles J mileswjohn...@gmail.com wrote:
  I am personal extremely against naming your ids the full sentence,
  what purpose does that serve? Its longer in both the .po and .ctp file
  and its a lot easier to reference slugs. To each his own I guess.
 
  On Oct 13, 7:42 am, Larry E. Masters aka PhpNut php...@gmail.com
  wrote:
 
   Another thing I forgot to mention. You should be using full strings you
 want
   translated for the msgid.Example:
 
   msgid By registering on this web site you are...
 
   This is the way the core was designed to handle translations. You will
 also
   find it much easier for people to translate your application if they
 have
   everything they need in the 1 .po file vs looking for the text related
 to a
   place holder.
 
   --
   /**
   * @author Larry E. Masters
   * @var string $userName
   * @param string $realName
   * @returns string aka PhpNut
   * @access  public
   */
 
   On Tue, Oct 13, 2009 at 9:13 AM, Rob rob...@catchit.pl wrote:
 
Any1 thought about creating little snippet which could speed up
hardcoded localization process.
Here is the simple scenerio:
1) find strings within __('...') __('...',true) string patterns in /
app folder
2) build arrays from default locale *.po files containing locale keys
3) append to end of these files missing id keys in form:
msgid _register_disclaimer
msgstr TOODOO
 
i create many multilang apps and i believe it could be major speed
boost for ppl like me.
we dont need to update these files manually every time we use __().
 we
just run script when app is ready or changed and just update TOODOO
strings or send them to translators.
 
If some1 came up with idea how this could be easly done i would
apreciate this.
 
regular expressions? if so, how to build fault free one?
 


--~--~-~--~~~---~--~~
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: find __() function parameters in /app and update *.po - automated

2009-10-13 Thread Miles J

But you would need to make the english po file anyways if you are
going to distribute it and have it translated.

On Oct 13, 12:58 pm, Larry E. Masters aka PhpNut php...@gmail.com
wrote:
 So you are basically using these as defines?
 --
 /**
 * @author Larry E. Masters
 * @var string $userName
 * @param string $realName
 * @returns string aka PhpNut
 * @access  public
 */

 On Tue, Oct 13, 2009 at 2:19 PM, euromark (munich) 

 dereurom...@googlemail.com wrote:

  i agree with miles

  they should be slugged, short and precise
  and explained in both the english and foreign .po file

  like

  regMessageSuccess
  and
  You have been successfully registered
  Sie sind nun erfolgreich angemeldet

  or
  valErrorRecordNameExists
  for
  A record with this name already exists

  this way you can easily change the original language text (here:
  english) without having to change all the x places in the script as
  well

  maybe it is now supposed to be
  You cannot have two records with the same name

  but the short slugged term has still the same basic meaning and
  therefore remains the same

  On 13 Okt., 18:12, Miles J mileswjohn...@gmail.com wrote:
   I am personal extremely against naming your ids the full sentence,
   what purpose does that serve? Its longer in both the .po and .ctp file
   and its a lot easier to reference slugs. To each his own I guess.

   On Oct 13, 7:42 am, Larry E. Masters aka PhpNut php...@gmail.com
   wrote:

Another thing I forgot to mention. You should be using full strings you
  want
translated for the msgid.Example:

msgid By registering on this web site you are...

This is the way the core was designed to handle translations. You will
  also
find it much easier for people to translate your application if they
  have
everything they need in the 1 .po file vs looking for the text related
  to a
place holder.

--
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

On Tue, Oct 13, 2009 at 9:13 AM, Rob rob...@catchit.pl wrote:

 Any1 thought about creating little snippet which could speed up
 hardcoded localization process.
 Here is the simple scenerio:
 1) find strings within __('...') __('...',true) string patterns in /
 app folder
 2) build arrays from default locale *.po files containing locale keys
 3) append to end of these files missing id keys in form:
 msgid _register_disclaimer
 msgstr TOODOO

 i create many multilang apps and i believe it could be major speed
 boost for ppl like me.
 we dont need to update these files manually every time we use __().
  we
 just run script when app is ready or changed and just update TOODOO
 strings or send them to translators.

 If some1 came up with idea how this could be easly done i would
 apreciate this.

 regular expressions? if so, how to build fault free one?
--~--~-~--~~~---~--~~
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: find __() function parameters in /app and update *.po - automated

2009-10-13 Thread Larry E. Masters aka PhpNut
Incorrect, the file that is created using the i18n extract creates a .pot
file which is a template file and can be opened in any po editor or text
editor. The template is not language specific. There is no reason to create
these files by hand. Write your code and output using the sentences you
would normally use just wrap the string in __() function. Run the extractor
and you are done.
Easiest tool to edit translations I have recently found is poedit.
www.poedit.net

I uploaded current core extracted pot file.

http://cake-php.googlegroups.com/web/default.pot

Download it and open in poedit.

The nice thing about these pot file is you can create a new version with
changes in your application, reopen the template in poedit, and it will
merge changes highlighting the strings that have changed.

Not sure if you are aware how the other translation functions work in the
core, but when it comes to handling plurals in a sentence, your slugs will
become more confusing.

for($number = 0; $i  100; $number++) {
sprintf(__n('There is %d apple in the fruit bowl', 'There are %d apples in
the fruit bowl', $number), $number);
}

msgid There is %d apple in the fruit bowl
msgid_plural There are %d apples in the fruit bowl
msgstr[0] 
msgstr[1] 
msgstr[2] 
msgstr[3] 
msgstr[4] 
msgstr[5] 
msgstr[6] 

There are 16 plural rules that range from 1 form of plural to 6 forms of
plural depending on the value of $number. It all depends and the language
the content is being translated to. The above example be based on the header
in the po file, which poedit allows you to set based on the language you are
using.

Only 1 form of plural.
Plural-Forms: nplurals=1; plural=0;\n

6 forms of plural.
Plural-Forms: nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n==0 || (n=3 
n=10) ? 2 : 3;\n

14 other forms or plural are available. These will be added to the
translation site I had online for the project before. This will be coming
back online in the next few weeks. They will also be added to the book, with
corrections on the proper use of these functions soon. If you need the
correct plural form before then, let me know and I can reply with it.

-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

On Tue, Oct 13, 2009 at 6:50 PM, Miles J mileswjohn...@gmail.com wrote:


 But you would need to make the english po file anyways if you are
 going to distribute it and have it translated.

 On Oct 13, 12:58 pm, Larry E. Masters aka PhpNut php...@gmail.com
 wrote:
  So you are basically using these as defines?
  --
  /**
  * @author Larry E. Masters
  * @var string $userName
  * @param string $realName
  * @returns string aka PhpNut
  * @access  public
  */
 
  On Tue, Oct 13, 2009 at 2:19 PM, euromark (munich) 
 
  dereurom...@googlemail.com wrote:
 
   i agree with miles
 
   they should be slugged, short and precise
   and explained in both the english and foreign .po file
 
   like
 
   regMessageSuccess
   and
   You have been successfully registered
   Sie sind nun erfolgreich angemeldet
 
   or
   valErrorRecordNameExists
   for
   A record with this name already exists
 
   this way you can easily change the original language text (here:
   english) without having to change all the x places in the script as
   well
 
   maybe it is now supposed to be
   You cannot have two records with the same name
 
   but the short slugged term has still the same basic meaning and
   therefore remains the same
 
   On 13 Okt., 18:12, Miles J mileswjohn...@gmail.com wrote:
I am personal extremely against naming your ids the full sentence,
what purpose does that serve? Its longer in both the .po and .ctp
 file
and its a lot easier to reference slugs. To each his own I guess.
 
On Oct 13, 7:42 am, Larry E. Masters aka PhpNut php...@gmail.com
wrote:
 
 Another thing I forgot to mention. You should be using full strings
 you
   want
 translated for the msgid.Example:
 
 msgid By registering on this web site you are...
 
 This is the way the core was designed to handle translations. You
 will
   also
 find it much easier for people to translate your application if
 they
   have
 everything they need in the 1 .po file vs looking for the text
 related
   to a
 place holder.
 
 --
 /**
 * @author Larry E. Masters
 * @var string $userName
 * @param string $realName
 * @returns string aka PhpNut
 * @access  public
 */
 
 On Tue, Oct 13, 2009 at 9:13 AM, Rob rob...@catchit.pl wrote:
 
  Any1 thought about creating little snippet which could speed up
  hardcoded localization process.
  Here is the simple scenerio:
  1) find strings within __('...') __('...',true) string patterns
 in /
  app folder
  2) build arrays from default locale *.po files containing locale
 keys
  3) append to end of these files missing id keys in form:
  msgid _register_disclaimer
  msgstr TOODOO
 
   

Re: find __() function parameters in /app and update *.po - automated

2009-10-13 Thread Miles J

Well see now a lot of it makes sense. The guide is pretty vague on
i18n/l10n and how it works / is used.

Will give this a try.

On Oct 13, 5:39 pm, Larry E. Masters aka PhpNut php...@gmail.com
wrote:
 Incorrect, the file that is created using the i18n extract creates a .pot
 file which is a template file and can be opened in any po editor or text
 editor. The template is not language specific. There is no reason to create
 these files by hand. Write your code and output using the sentences you
 would normally use just wrap the string in __() function. Run the extractor
 and you are done.
 Easiest tool to edit translations I have recently found is 
 poedit.www.poedit.net

 I uploaded current core extracted pot file.

 http://cake-php.googlegroups.com/web/default.pot

 Download it and open in poedit.

 The nice thing about these pot file is you can create a new version with
 changes in your application, reopen the template in poedit, and it will
 merge changes highlighting the strings that have changed.

 Not sure if you are aware how the other translation functions work in the
 core, but when it comes to handling plurals in a sentence, your slugs will
 become more confusing.

 for($number = 0; $i  100; $number++) {
 sprintf(__n('There is %d apple in the fruit bowl', 'There are %d apples in
 the fruit bowl', $number), $number);

 }

 msgid There is %d apple in the fruit bowl
 msgid_plural There are %d apples in the fruit bowl
 msgstr[0] 
 msgstr[1] 
 msgstr[2] 
 msgstr[3] 
 msgstr[4] 
 msgstr[5] 
 msgstr[6] 

 There are 16 plural rules that range from 1 form of plural to 6 forms of
 plural depending on the value of $number. It all depends and the language
 the content is being translated to. The above example be based on the header
 in the po file, which poedit allows you to set based on the language you are
 using.

 Only 1 form of plural.
 Plural-Forms: nplurals=1; plural=0;\n

 6 forms of plural.
 Plural-Forms: nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n==0 || (n=3 
 n=10) ? 2 : 3;\n

 14 other forms or plural are available. These will be added to the
 translation site I had online for the project before. This will be coming
 back online in the next few weeks. They will also be added to the book, with
 corrections on the proper use of these functions soon. If you need the
 correct plural form before then, let me know and I can reply with it.

 --
 /**
 * @author Larry E. Masters
 * @var string $userName
 * @param string $realName
 * @returns string aka PhpNut
 * @access  public
 */

 On Tue, Oct 13, 2009 at 6:50 PM, Miles J mileswjohn...@gmail.com wrote:

  But you would need to make the english po file anyways if you are
  going to distribute it and have it translated.

  On Oct 13, 12:58 pm, Larry E. Masters aka PhpNut php...@gmail.com
  wrote:
   So you are basically using these as defines?
   --
   /**
   * @author Larry E. Masters
   * @var string $userName
   * @param string $realName
   * @returns string aka PhpNut
   * @access  public
   */

   On Tue, Oct 13, 2009 at 2:19 PM, euromark (munich) 

   dereurom...@googlemail.com wrote:

i agree with miles

they should be slugged, short and precise
and explained in both the english and foreign .po file

like

regMessageSuccess
and
You have been successfully registered
Sie sind nun erfolgreich angemeldet

or
valErrorRecordNameExists
for
A record with this name already exists

this way you can easily change the original language text (here:
english) without having to change all the x places in the script as
well

maybe it is now supposed to be
You cannot have two records with the same name

but the short slugged term has still the same basic meaning and
therefore remains the same

On 13 Okt., 18:12, Miles J mileswjohn...@gmail.com wrote:
 I am personal extremely against naming your ids the full sentence,
 what purpose does that serve? Its longer in both the .po and .ctp
  file
 and its a lot easier to reference slugs. To each his own I guess.

 On Oct 13, 7:42 am, Larry E. Masters aka PhpNut php...@gmail.com
 wrote:

  Another thing I forgot to mention. You should be using full strings
  you
want
  translated for the msgid.Example:

  msgid By registering on this web site you are...

  This is the way the core was designed to handle translations. You
  will
also
  find it much easier for people to translate your application if
  they
have
  everything they need in the 1 .po file vs looking for the text
  related
to a
  place holder.

  --
  /**
  * @author Larry E. Masters
  * @var string $userName
  * @param string $realName
  * @returns string aka PhpNut
  * @access  public
  */

  On Tue, Oct 13, 2009 at 9:13 AM, Rob rob...@catchit.pl wrote:

   Any1 thought about creating little snippet which could speed up
   hardcoded localization process.
   Here is the 

Re: find __() function parameters in /app and update *.po - automated

2009-10-13 Thread Larry E. Masters aka PhpNut
Cool, let me know if you have any questions.
-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

On Tue, Oct 13, 2009 at 7:46 PM, Miles J mileswjohn...@gmail.com wrote:


 Well see now a lot of it makes sense. The guide is pretty vague on
 i18n/l10n and how it works / is used.

 Will give this a try.

 On Oct 13, 5:39 pm, Larry E. Masters aka PhpNut php...@gmail.com
 wrote:
  Incorrect, the file that is created using the i18n extract creates a .pot
  file which is a template file and can be opened in any po editor or text
  editor. The template is not language specific. There is no reason to
 create
  these files by hand. Write your code and output using the sentences you
  would normally use just wrap the string in __() function. Run the
 extractor
  and you are done.
  Easiest tool to edit translations I have recently found is
 poedit.www.poedit.net
 
  I uploaded current core extracted pot file.
 
  http://cake-php.googlegroups.com/web/default.pot
 
  Download it and open in poedit.
 
  The nice thing about these pot file is you can create a new version with
  changes in your application, reopen the template in poedit, and it will
  merge changes highlighting the strings that have changed.
 
  Not sure if you are aware how the other translation functions work in the
  core, but when it comes to handling plurals in a sentence, your slugs
 will
  become more confusing.
 
  for($number = 0; $i  100; $number++) {
  sprintf(__n('There is %d apple in the fruit bowl', 'There are %d apples
 in
  the fruit bowl', $number), $number);
 
  }
 
  msgid There is %d apple in the fruit bowl
  msgid_plural There are %d apples in the fruit bowl
  msgstr[0] 
  msgstr[1] 
  msgstr[2] 
  msgstr[3] 
  msgstr[4] 
  msgstr[5] 
  msgstr[6] 
 
  There are 16 plural rules that range from 1 form of plural to 6 forms of
  plural depending on the value of $number. It all depends and the language
  the content is being translated to. The above example be based on the
 header
  in the po file, which poedit allows you to set based on the language you
 are
  using.
 
  Only 1 form of plural.
  Plural-Forms: nplurals=1; plural=0;\n
 
  6 forms of plural.
  Plural-Forms: nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n==0 || (n=3 
  n=10) ? 2 : 3;\n
 
  14 other forms or plural are available. These will be added to the
  translation site I had online for the project before. This will be coming
  back online in the next few weeks. They will also be added to the book,
 with
  corrections on the proper use of these functions soon. If you need the
  correct plural form before then, let me know and I can reply with it.
 
  --
  /**
  * @author Larry E. Masters
  * @var string $userName
  * @param string $realName
  * @returns string aka PhpNut
  * @access  public
  */
 
  On Tue, Oct 13, 2009 at 6:50 PM, Miles J mileswjohn...@gmail.com
 wrote:
 
   But you would need to make the english po file anyways if you are
   going to distribute it and have it translated.
 
   On Oct 13, 12:58 pm, Larry E. Masters aka PhpNut php...@gmail.com
   wrote:
So you are basically using these as defines?
--
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/
 
On Tue, Oct 13, 2009 at 2:19 PM, euromark (munich) 
 
dereurom...@googlemail.com wrote:
 
 i agree with miles
 
 they should be slugged, short and precise
 and explained in both the english and foreign .po file
 
 like
 
 regMessageSuccess
 and
 You have been successfully registered
 Sie sind nun erfolgreich angemeldet
 
 or
 valErrorRecordNameExists
 for
 A record with this name already exists
 
 this way you can easily change the original language text (here:
 english) without having to change all the x places in the script as
 well
 
 maybe it is now supposed to be
 You cannot have two records with the same name
 
 but the short slugged term has still the same basic meaning and
 therefore remains the same
 
 On 13 Okt., 18:12, Miles J mileswjohn...@gmail.com wrote:
  I am personal extremely against naming your ids the full
 sentence,
  what purpose does that serve? Its longer in both the .po and .ctp
   file
  and its a lot easier to reference slugs. To each his own I guess.
 
  On Oct 13, 7:42 am, Larry E. Masters aka PhpNut 
 php...@gmail.com
  wrote:
 
   Another thing I forgot to mention. You should be using full
 strings
   you
 want
   translated for the msgid.Example:
 
   msgid By registering on this web site you are...
 
   This is the way the core was designed to handle translations.
 You
   will
 also
   find it much easier for people to translate your application if
   they
 have
   everything they need in the 1 .po file vs looking for the text
   related