markdown 制作* .pot文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 制作* .pot文件相关的知识,希望对你有一定的参考价值。

#!/bin/bash

if [ ! -d "$WP_I18N_LIB" ]; then
	WP_I18N_LIB="/usr/lib/wpi18n";
fi

if [ -z "$1" ]; then
	projectType="wp-plugin"
else
	projectType="$1"
fi

if [ -z "$2" ]; then
	textdomain=""
else
	textdomain=$2
fi

if [ -z "$3" ]; then
	projectDir=`pwd`
else
	projectDir="$3"
fi

pluginBasename=$(basename "$projectDir")

if [[ ! $textdomain ]]; then
	textdomain="$pluginBasename"
fi

if [ -d "$projectDir/languages" ]; then
	php "$WP_I18N_LIB/makepot.php" $projectType $projectDir "$projectDir/languages/$textdomain.pot"
elif [ -d "$projectDir/lang" ]; then
	php "$WP_I18N_LIB/makepot.php" $projectType $projectDir "$projectDir/lang/$textdomain.pot"
else
	php "$WP_I18N_LIB/makepot.php" $projectType $projectDir "$textdomain.pot"
fi
Installation
===

To install, you need to have the [WordPress i18n library on your](http://i18n.svn.wordpress.org/tools/trunk/) computer. Check it out using SVN:

    sudo svn co http://i18n.svn.wordpress.org/tools/trunk/ /usr/lib/wpi18n

You don't have to put the library in `/usr/lib/wpi18n`, but if you don't put it there, make sure to set the `$WP_I18N_LIB` environment variable in your `.bashrc` or `.bash_profile` file (with no trailing slash):

    export WP_I18N_LIB="/path/to/i18n/lib"

Put `makepot.sh` anywhere in your path (I put mine in `/usr/local/bin`) and rename it to `makepot`. Make it executable by running

    chmod +x makepot

Use
===

To use the script, simply go to the plugin's directory and run

    makepot

It will use the project type `wp-plugin` by default, you may change this by specifying a different project type as an argument.

    makepot wp-theme

You can also specify the text-domain as optional second argument

    makepot wp-theme textdomain


And finally you may specify the plugin or theme directory as optional third argument

    makepot wp-plugin textdomain path/to/plugin

The script will use the name of the plugin directory as the `.pot` file's name, unless a textdomain is given. In that case the file will be called `textdomain.pot`. It will look first for a directory called `languages`, then for `lang` and put the file in whichever it finds. If neither of those directories exists, it will put the `.pot` file in the base plugin directory.

License
===

[GPLv2 or Later](http://www.gnu.org/licenses/gpl-2.0.html)

Copyright (C) 2012  Avendi Media, Inc.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

以上是关于markdown 制作* .pot文件的主要内容,如果未能解决你的问题,请参考以下文章

为啥 weblate 不能识别我的 pot 文件?

如何使用新生成的 .pot 文件更新现有的 .po 文件?

使用 Poedit 创建 POT 文件

Hexo之旅:文章编写技巧

markdown 用于制作有效README文件的模板

markdown 用于制作有效README文件的模板