WIP: [IMPR] Language handling for Components#11421
Open
chfsx wants to merge 1 commit intoILIAS-eLearning:trunkfrom
Open
WIP: [IMPR] Language handling for Components#11421chfsx wants to merge 1 commit intoILIAS-eLearning:trunkfrom
chfsx wants to merge 1 commit intoILIAS-eLearning:trunkfrom
Conversation
chfsx
commented
Apr 13, 2026
| array | \ArrayAccess &$internal, | ||
| ): void { | ||
| $define[] = \ILIAS\Language\Language::class; | ||
| $contribute[LanguageFileDirectory::class] = static fn()=> new MainLanguageFileDirectory(); |
Member
Author
There was a problem hiding this comment.
The current directory /lang is provided here. Only one instance of MainLanguageFileDirectory can be provided.
chfsx
commented
Apr 13, 2026
| $pull[Factory::class] | ||
| ); | ||
|
|
||
| $contribute[LanguageFileDirectory::class] = fn(): LanguageFileDirectory => new ComponentLanguageFileDirectory( |
Member
Author
There was a problem hiding this comment.
This is an example of how a component provides it's own lang-directory. Since the ComponentLanguageFileDirectory must provide the prefix (to avoid collisions), the prefixes can be removed in the language files
chfsx
commented
Apr 13, 2026
| if ($scope === "local") { | ||
| $path = $this->cust_lang_path; | ||
| } | ||
| foreach ($this->language_file_directory_manager->getDirectories() as $directory) { |
Member
Author
There was a problem hiding this comment.
Most of the magic starts here. Instead of just reading files in /lang, we iterate all provided directories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As mentioned in today’s JF, components (e.g. third-party ones) are not yet able to manage language files.
This PR at least restores the behaviour whereby components can also provide language files, just as plugins have done up to now.
However, this is merely a workaround; in my opinion, the Language component should be structured much more effectively. At present, one needs a great deal of technical knowledge regarding the component’s inner workings for the translation to function. But to continue contributing translations as a (plugin) component, at least for the time being, this would be one way forward.
The interface
\ILIAS\Language\ComponentTranslation\LanguageFileDirectorycould then be deprecated at a later date once a new mechanism is in place, thereby supporting both types during a transitional period.As an example, I’ve rewritten the File component so that it has its own language files. However, whether or not to do this would definitely be a separate decision.
@alex40724 | @mjansenDatabay FYI since you were involved in todays discussion
I marked this PR as WIP since I will remove the part for the fileobject if accepted.