1
votes

To create default pot file for CakePHP 2.3 i18n, in windows I created a bat file like this.

CD F:\mywork\app\View
F:\mywork\lib\Cake\Console\cake.bat i18n extract

But I get this error:

Your database configuration was not found. Take a moment to create one.
---------------------------------------------------------------
Database Configuration:
---------------------------------------------------------------
Name:
[default] >

But inside app\Config\database.php file I have database configurations and they work well. So I removed extract argument.

I created a new bat file like this.

CD F:\mywork\app\View
F:\mywork\lib\Cake\Console\cake.bat i18n

When I run bat file, I get this:

[E]xtract POT file from sources
[I]nitialize i18n database table
[H]elp
[Q]uit
What would you like to do? (E/I/H/Q)

I select E. I get this:

Current paths: None
What is the path you would like to extract?
[Q]uit [D]one
[F:\mywork\app\View\] >

I press Enter. I get this:

Current paths: F:\mywork\app\View\
What is the path you would like to extract?
[Q]uit [D]one
[D] >

I press Enter. I get this:

Would you like to extract the messages from the CakePHP core? (y/n)
[n] >

I press Enter. I get this:

What is the path you would like to output?
[Q]uit
[F:\mywork\app\View\Locale] >

I paste this: F:\mywork\app\Locale\eng\LC_MESSAGES. Than I get this:

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

I press Enter. cake starts to process all View files. Creates pot file. Then I get this:

[E]xtract POT file from sources
[I]nitialize i18n database table
[H]elp
[Q]uit
What would you like to do? (E/I/H/Q)

I press Q and program ends.

Is it possible to automatize this process ? Setting paths beforehand and not selecting options by hand ?

1

1 Answers

5
votes

Just working on the same issue. You need to start

cake.bat i18n extract

from the /app path and not from the view path. The process can be automated for comma-seperated list of files:

cake i18n extract --files %ListOfFiles% --ignore-model-validation --output .\Locale\eng\LC_MESSAGES\ --paths .\View  --overwrite no --extract-core no --merge no

Should also work without a list of files:

cake i18n extract --ignore-model-validation --output .\Locale\eng\LC_MESSAGES --paths .\View  --overwrite no --extract-core no --merge no