Skip to content

Translations are not loaded from composer repository #2120

Closed
@yol

Description

@yol

Describe the bug
The documentation says that when using composer and requiring codeigniter4/translations, the translations should be automatically picked up and that there is no need to copy them to the app directory.
This does not currently work unfortunately.

CodeIgniter 4 version
4.0.0-beta4

Affected module(s)
language, autoloader

Expected behavior, and steps to reproduce if appropriate

  • Make new composer installation and require codeigniter4/translations
  • Set default locale to anything other than English
  • In the demo controller, try for example var_dump(lang('Validation.noRuleSets'))
  • It will display the English message.

The cause is that the Language module tries to look up the file Language/{$locale}/{$file}.php, but the translations composer repository registers the Translations namespace as the Language directory, which means that codeigniter will try to look for Translations/Language/{$locale}/{$file}.php in the package. The correct file would be Translations/{$locale}{$file}.php. Adjusting the path that is looked up to {$locale}/${file}.php does allow it to work, but it breaks the look-up inside the application and is of course not the real solution (no idea how to solve this cleanly).

Context

  • OS: Linux
  • Web server lighttpd 1.4.54
  • PHP version 7.3.6

Activity

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

Metadata

Metadata

Assignees

Labels

bugVerified issues on the current code behavior or pull requests that will fix themwaiting for infoIssues or pull requests that need further clarification from the author

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions