Skip to content

Nested JSON/YAML/PHP language files fail to load; fixtures suggest nesting is supported #1371

Closed

Description

@asika32764

The test/fixtures folder contains nested fixtures for three formats, but Language::load() only accepts a flat key => string map. Nested files fail:

$lang = new Language('en-GB', 'en-GB');
$lang->load('test/fixtures/json/en-GB.json', 'json', 'en-GB');
// TypeError: Language::addString(): Argument #2 ($string) must be of type string, array given

The same error occurs for php/en-GB.php (WINDWALKER => [TEST => [SAKURA => ...]]). YAML (yaml/en-GB.yml) also fails for a different reason: Class "Symfony\Component\Yaml\Yaml" not found. symfony/yaml is not required by windwalker/language, and it is not installed in a default setup.
Only the INI fixtures are used by tests (test/LanguageTest.php:32-33, 324). The JSON, PHP, and YAML fixtures are not referenced by any test.
Questions to resolve:
1.
Is nested key flattening intended? If so, Language::load() or addStrings() must flatten arrays into dot-separated keys, and this is currently missing. If not, the nested fixtures are stale and should be removed or converted to flat form.
2.
If YAML is supported, symfony/yaml should be declared in suggest (or require) of packages/language/composer.json, and the YAML fixture should be tested only when present.
Expected behavior for the decision: nested windwalker.language-test.sakura in JSON should resolve to windwalker.language.test.sakura, matching the INI fixture key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions