1

为了为 CakePHP 2.3 i18n 创建默认的 pot 文件,我在 windows 中创建了一个像这样的 bat 文件。

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

但我得到这个错误:

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

但是在app\Config\database.php文件里面我有数据库配置,它们运行良好。所以我删除了提取参数。

我像这样创建了一个新的 bat 文件。

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

当我运行 bat 文件时,我得到了这个:

[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)

我选择E。我明白了:

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

我按Enter。我明白了:

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

我按Enter。我明白了:

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

我按Enter。我明白了:

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

我贴这个:F:\mywork\app\Locale\eng\LC_MESSAGES。比我得到这个:

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

我按Enter。cake 开始处理所有 View 文件。创建pot文件。然后我得到这个:

[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)

我按Q,程序结束。

是否有可能使这个过程自动化?预先设置路径而不是手动选择选项?

4

1 回答 1

5

只是在处理同样的问题。你需要开始

cake.bat i18n extract

来自 /app 路径,而不是来自视图路径。对于逗号分隔的文件列表,该过程可以自动化:

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

也应该在没有文件列表的情况下工作:

cake i18n extract --ignore-model-validation --output .\Locale\eng\LC_MESSAGES --paths .\View  --overwrite no --extract-core no --merge no
于 2013-05-16T14:25:26.133 回答