nook-ru / encoding-converter
0.1.2
2018-06-02 07:20 UTC
Requires
- composer-plugin-api: ^1.0
- ddeboer/transcoder: ^1.0
Requires (Dev)
- composer/composer: ^1.2@dev
This package is auto-updated.
Last update: 2021-04-30 11:06:40 UTC
README
比特里克斯的软件包可能使用不同的编码(如 utf-8
或 windows-1251
)。在比特里克斯网站上使用任意编码时,这个插件可以帮助:在安装或更新软件包时,它会自动将其转换为网站的指定编码。
如何使用?
假设网站使用 utf-8
编码,而我们需要使用的软件包 citrus/iblock.element.form
编写为 windows-1251
。
将 nook-ru/encoding-converter
添加为依赖项,并在 extra.encoding-convert
键中指定包名和需要转换的编码。
{
"require": {
"php": ">=5.3",
"citrus/iblock.element.form": "0.*",
"nook-ru/encoding-converter": "^0.1"
},
"extra": {
"encoding-convert": {
"citrus/iblock.element.form": "utf-8"
}
}
}
额外功能
安装插件后,可以用于从命令行转换模块、模板或组件的 lang-
文件: composer encoding:convert [options] [--] <path> <to> [<from>]
~
$ composer help encoding:convert
Usage:
encoding:convert [options] [--] <path> <to> [<from>]
Arguments:
path Directory in which to perform conversion (i.e. path to component, template or module)
to Target encoding
from Source encoding (if ommited, conversion performed between utf-8 and windows-1251)
Options:
-l, --lang[=LANG] Language to convert (for bitrix lang files) (default is ru)
-a, --all[=ALL] Process all php files (not ony bitrix lang files)
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--profile Display timing and memory usage information
--no-plugins Whether to disable plugins.
-d, --working-dir=WORKING-DIR If specified, use the given directory as working directory.
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Convert encoding of bitrix lang files (*.php in lang/<lang_code>/ subfolders)