jelix/locales-tools

Jelix应用程序管理或转换区域设置的命令行工具。

1.1.0 2023-01-07 09:11 UTC

This package is auto-updated.

Last update: 2024-09-07 12:51:09 UTC


README

Jelix应用程序管理区域设置的命令行工具。

  • 从属性格式转换为PO或POT格式
  • 从PO格式转换为属性格式

安装

您可以使用Composer安装它。在您的项目中

composer require "jelix/locales-tools"

配置

在包含Jelix模块和一些区域设置的您的项目中,您应该在项目中放置一个.jelixlocales.ini文件。

以下是其内容

; the path of a jelix application or '.4 if you have only modules into your project 
applicationPath=.

; a project id : can be a name with the version of your project
projectId=jelix 1.6.33

; header to add into each generated properties files
propertiesFileHeader="Please don't modify this file."

; default value for all modules. You can specify specifics values in sections
; of modules
[default]
; main locale used to translate from
mainLocale=en_US

; where translations should be stored. See below.
translationLocation=@module

; a section for each modules, having this name : "module:<name of the module>".
[module:jelix]
; path to the module, relative to the applicationPath path
path=jelix/core-modules/jelix/

; list of properties files to not translate.
excludePropertiesFiles=format.UTF-8.properties
;translationLocation=@module
;mainLocale=en_US

translationLocation应该是一个路径,相对于.jelixlocales.ini的路径,或一个绝对路径(不推荐)。它可以包含关键字:locale:module,它们将分别替换为区域和模块名称。如果您想要一个相对于应用程序路径的路径,请在路径前缀中添加@app:

示例

translationLocation=somewhere/:locale/:module/
; or
translationLocation=@app:var/locales/:locale/:module/

通常,您可能希望将翻译存储在Jelix可识别的位置。您可以使用一些特定的关键字,这些关键字将被替换为实际路径

  • @module,相当于<module path>/locales/:locale/
  • @app-overloads,相当于<application path>/app/overloads/:module/locales/:locale/
  • @app-locales,相当于<application path>/locales/:locale/:module/
  • @var-overloads,相当于<application path>/var/overloads/:module/locales/:locale/
  • @var-locales,相当于<application path>/var/locales/:locale/:module/

命令

运行vendor/bin/jelixlocales以获取帮助和可能的命令列表。