citrus-soft/encoding-converter

提供比特里克斯语言文件的透明转换。当比特里克斯安装和包具有不同的编码时非常有用

安装: 35

依赖者: 0

建议者: 0

安全性: 0

星标: 0

关注者: 1

分支: 2

类型:composer-plugin

0.1.3 2021-04-30 08:24 UTC

This package is auto-updated.

Last update: 2024-09-29 06:25:42 UTC


README

比特里克斯的包可能使用不同的编码(如utf-8windows-1251)。这个插件可以帮助在具有任意编码的比特里克斯网站上使用这些包:在安装或更新包时,它将自动将其转换成网站的指定编码。

如何使用?

假设网站使用utf-8编码,而我们需要使用的包citrus/iblock.element.form使用的是windows-1251编码。

citrus-soft/encoding-converter添加为依赖项,并在extra.encoding-convert键中指定包的名称和需要转换成的编码

{
    "require": {
        "php": ">=5.3",
        "citrus/iblock.element.form": "0.*",
        "citrus-soft/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)