flarum / issue-archive

0 stars 0 forks source link

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

Open SychO9 opened 2 years ago

SychO9 commented 2 years ago

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 commented 2 years ago

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.