mirror of
https://github.com/typecho/typecho.git
synced 2025-04-16 15:53:11 +02:00
生成pot文件
This commit is contained in:
parent
6997bb1b8e
commit
81b017a118
@ -2,8 +2,6 @@
|
||||
|
||||
#define root directory
|
||||
DIR=../
|
||||
TINYMCE=3_2_2
|
||||
|
||||
|
||||
#update subversion
|
||||
update:
|
||||
@ -11,8 +9,8 @@ update:
|
||||
rm -Rf build/
|
||||
git clone https://github.com/typecho/typecho-replica.git build
|
||||
rm -Rf build/.git
|
||||
rm -Rf build/.gitignore
|
||||
rm -Rf build/.gitattributes
|
||||
rm -f build/.gitignore
|
||||
rm -f build/.gitattributes
|
||||
for i in `find build/ -name '*.css'`; do echo $$i && java -Xmx32m -jar yuicompressor-2.4.2.jar $$i --charset UTF-8 -o $$i; done;
|
||||
for i in `find build/admin/js/ -name '*.js'`; do echo $$i && java -Xmx32m -jar yuicompressor-2.4.2.jar $$i --charset UTF-8 -o $$i; done;
|
||||
for i in `find build/ -name '*.php'`; do php -l $$i; done;
|
||||
@ -21,10 +19,10 @@ update:
|
||||
package:
|
||||
@echo 'package'
|
||||
rm -Rf build/tools/
|
||||
rm -Rf build/todo.txt
|
||||
rm -Rf build/changelog.txt
|
||||
rm -Rf build/.travis.yml
|
||||
rm -Rf build/README.md
|
||||
rm -f build/todo.txt
|
||||
rm -f build/changelog.txt
|
||||
rm -f build/.travis.yml
|
||||
rm -f build/README.md
|
||||
rm -Rf build/admin/scss
|
||||
rm -Rf build/admin/img/editor
|
||||
rm -Rf build/admin/img/icons
|
||||
@ -59,10 +57,10 @@ theme:
|
||||
install:
|
||||
make update
|
||||
rm -Rf build/tools/
|
||||
rm -Rf build/todo.txt
|
||||
rm -Rf build/changelog.txt
|
||||
rm -Rf build/.travis.yml
|
||||
rm -Rf build/README.md
|
||||
rm -f build/todo.txt
|
||||
rm -f build/changelog.txt
|
||||
rm -f build/.travis.yml
|
||||
rm -f build/README.md
|
||||
rm -Rf build/admin/scss
|
||||
rm -Rf build/admin/img/editor
|
||||
rm -Rf build/admin/img/icons
|
||||
@ -73,6 +71,12 @@ install:
|
||||
make clear
|
||||
|
||||
|
||||
pot:
|
||||
cd ../ && php tools/list.php ./ > tools/files.txt
|
||||
cd ../ && xgettext --files-from=tools/files.txt -Lphp --from-code=UTF-8 --keyword=_t --keyword=_e --keyword=_n:1,2 --no-location --copyright-holder=Typecho --package-name=Typecho --package-version=`grep -E "VERSION = '(.*)'" ./var/Typecho/Common.php | cut -d "'" -f 2` --no-wrap --output=tools/messages.pot
|
||||
rm -f files.txt
|
||||
|
||||
|
||||
all:
|
||||
make update
|
||||
make package
|
||||
|
@ -6,68 +6,31 @@ if (!isset($argv[1])) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//获取一个目录下的文件
|
||||
function mgGetFile($inpath, $trim = false,$stamp = NULL)
|
||||
{
|
||||
$file = array();
|
||||
/**
|
||||
* 获取所有文件
|
||||
*
|
||||
* @param string $dir
|
||||
* @param string $pattern
|
||||
* @return array
|
||||
*/
|
||||
function all_files($dir, $pattern = '*') {
|
||||
$result = array();
|
||||
|
||||
if(!is_dir($inpath))
|
||||
{
|
||||
return $file;
|
||||
}
|
||||
$items = glob($dir . '/' . $pattern, GLOB_BRACE);
|
||||
foreach ($items as $item) {
|
||||
if (is_file($item)) {
|
||||
$result[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
$handle=opendir($inpath);
|
||||
if(NULL != $stamp)
|
||||
{
|
||||
$stamp = explode("|",$stamp);
|
||||
}
|
||||
|
||||
while ($tmp = readdir($handle))
|
||||
{
|
||||
if(file_exists($inpath."/".$tmp) && eregi("^([_@0-9a-zA-Z\x80-\xff\^\.\%-]{0,})[\.]([0-9a-zA-Z]{1,})$",$tmp,$file_name))
|
||||
{
|
||||
if($stamp != NULL && in_array($file_name[2],$stamp))
|
||||
{
|
||||
$file[] = $trim ? $file_name[0] : $file_name[1];
|
||||
}
|
||||
else if($stamp == NULL)
|
||||
{
|
||||
$file[] = $trim ? $file_name[0] : $file_name[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
return $file;
|
||||
}
|
||||
|
||||
//获取一个目录下的目录
|
||||
function mgGetDir($inpath)
|
||||
{
|
||||
$handle=opendir($inpath);
|
||||
$dir = array();
|
||||
while ($tmp = readdir($handle))
|
||||
{
|
||||
if(is_dir($inpath."/".$tmp) && $tmp != ".." && $tmp != "." && 0 !== stripos($tmp,'.'))
|
||||
{
|
||||
$dir[] = $tmp;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
return $dir;
|
||||
}
|
||||
|
||||
function listFile($inpath, $stamp)
|
||||
{
|
||||
$files = mgGetFile($inpath, true, $stamp);
|
||||
$dirs = mgGetDir($inpath);
|
||||
|
||||
if ($dirs) {
|
||||
foreach ($dirs as $dir) {
|
||||
$files = array_merge($files, listFile($dir, $stamp));
|
||||
$items = glob($dir . '/*', GLOB_ONLYDIR);
|
||||
foreach ($items as $item) {
|
||||
if (is_dir($item)) {
|
||||
$result = array_merge($result, all_files($item, $pattern));
|
||||
}
|
||||
}
|
||||
|
||||
return $files;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
echo implode("\n", listFile($argv[1], 'php'));
|
||||
echo implode("\n", all_files($argv[1], '*.php'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user