citrus-soft/encoding-converter

Provides transparent transcoding of bitrix language files. Useful when bitrix installation and packages have different encodings


Keywords
encoding, helper, lang, bitrix, language files
License
MIT

Documentation

Плагин composer для ΠΊΠΎΠ½Π²Π΅Ρ€Ρ‚Π°Ρ†ΠΈΠΈ ΠΏΠ°ΠΊΠ΅Ρ‚ΠΎΠ² Π² ΠΊΠΎΠ΄ΠΈΡ€ΠΎΠ²ΠΊΡƒ сайта

ΠŸΠ°ΠΊΠ΅Ρ‚Ρ‹ для битрикса ΠΌΠΎΠ³ΡƒΡ‚ Π±Ρ‹Ρ‚ΡŒ написаны Π² Ρ€Π°Π·Π½Ρ‹Ρ… ΠΊΠΎΠ΄ΠΈΡ€ΠΎΠ²ΠΊΠ°Ρ… (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)