refs #4253 YAML format for translations
gitea/php-vn-lib/pipeline/head This commit looks good
Details
gitea/php-vn-lib/pipeline/head This commit looks good
Details
This commit is contained in:
parent
3a04e1fa62
commit
c8a95ecaa6
|
@ -1,4 +1,4 @@
|
|||
php-vn-lib (2.1.15) stable; urgency=low
|
||||
php-vn-lib (2.1.16) stable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ Vcs-Git: https://gitverdnatura.es/php-vn-lib
|
|||
|
||||
Package: php-vn-lib
|
||||
Architecture: all
|
||||
Depends: php-mysql
|
||||
Depends: php-mysql, php-yaml
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Description: PHP libraries
|
||||
|
|
|
@ -61,9 +61,9 @@ namespace Vn\Lib {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds a path where a JSON file with translations is located.
|
||||
* Adds a path where a YAML file with translations is located.
|
||||
*
|
||||
* @param string $path The JSON file path
|
||||
* @param string $path The YAML file path
|
||||
*/
|
||||
static function addPath($path) {
|
||||
self::$paths[$path] = TRUE;
|
||||
|
@ -73,17 +73,16 @@ namespace Vn\Lib {
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads translations from a JSON file.
|
||||
* Loads translations from a YAML file.
|
||||
*
|
||||
* @param string $path The JSON file path
|
||||
* @param string $path The YAML file path
|
||||
*/
|
||||
static function loadFile($path) {
|
||||
$locale = self::$locale;
|
||||
$file = stream_resolve_include_path("$path/locale/$locale.json");
|
||||
$file = stream_resolve_include_path("$path/locale/$locale.yml");
|
||||
|
||||
if (file_exists($file)
|
||||
&&($jsonString = file_get_contents($file)))
|
||||
self::addTranslations(json_decode($jsonString, TRUE));
|
||||
if (file_exists($file))
|
||||
self::addTranslations(\yaml_parse_file($file));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue