Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locale from common library across extensions cannot be translated by language packs #33

Open
SychO9 opened this issue Oct 2, 2021 · 1 comment

Comments

@SychO9
Copy link
Member

SychO9 commented Oct 2, 2021

Feature Request

Is your feature request related to a problem? Please describe.
As I plan on creating multiple themes under Afrux, I have a common library that contains changes which will be reused across those themes for easier maintenance and less repetitive code. All of which works well, except for locales.

Language packs include a wide range of translations for multiple extensions, and the corresponding extension locale files are loaded by checking the enabled extension IDs and matching that with those files. Which doesn't apply to such a library, so its translated locale file is never loaded from the language pack.

Describe the solution you'd like
One solution could be to provide a key for that library in the composer info of the extension, that key can be checked by the LanguagePack extender when deciding to load a locale file or not, and match its name to that key.

Justify why this feature belongs in Flarum's core, rather than in a third-party extension
While it might be possible to implement a solution in the extension itself to make it so that the locale file from the language pack that translates the library's locale is loaded, it'd only be a hack and not practical, this also sounds like a valid use case.

Describe alternatives you've considered
Hack some code on the extension's side.

Ref: afrux/asirem#5

@rob006
Copy link

rob006 commented Oct 5, 2021

I would rather introduce another type of package, some kind of "extension-dependency" with its own bootstrap.php that will be included if package is required by any enabled extension (they could be displayed in admin panel in separate section). It should be more flexible than focusing only on problem with locales, and it should be easier to understand than this.

@askvortsov1 askvortsov1 transferred this issue from flarum/framework Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants