要为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
文件中我有数据库配置,它们运行良好。所以我删除了extract参数。
我创建了一个像这样的新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 ,程序结束。
是否可以自动化此过程?事先设置路径而不是手动选择选项?
答案 0 :(得分:5)
正在处理同样的问题。你需要开始
cake.bat i18n extract
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