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

feat: allow loading language-* module as plugins in application #9447

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

miurahr
Copy link
Contributor

@miurahr miurahr commented Oct 7, 2023

There are many language modules LanguageTool project provided. It is benefitical that langaugetool allow language-* module to be loaded dynimically before calling languagetool core functions.

Currently language list is built in static initialization context.
This is a proposal that the creation of languages list is happened when requested. This allows applications to load language-* modules after a launch of the application, aka. classLoader load them after static initialization.

There are many language modules LanguageTool project provided.
It is benefitical that langaugetool allow language-* module to be loaded dynimically before calling languagetool core functions.

Currently language list is built in static context.
This is proposal that the creation of languages list is happended when requested.
This allows application to load language-* modules after its launch.

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
@miurahr miurahr marked this pull request as ready for review October 7, 2023 07:41
@miurahr miurahr marked this pull request as draft October 7, 2023 08:54
@miurahr miurahr marked this pull request as ready for review October 8, 2023 07:25
@miurahr
Copy link
Contributor Author

miurahr commented Nov 19, 2023

An enhancement is requested in application, OmegaT project https://sourceforge.net/p/omegat/feature-requests/1714/

…nguage-modules

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
@miurahr miurahr force-pushed the topic/miurahr/allow-dynamic-loadings-of-language-modules branch from bcb07d0 to d94b567 Compare November 20, 2023 00:01
@miurahr miurahr marked this pull request as draft November 20, 2023 00:02
@@ -283,7 +285,7 @@ public static Language getLanguageForLocale(Locale locale) {
return firstFallbackLanguage;
}
}
for (Language aLanguage : languages) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why getLanguageForLocale(Locale locale) exclude dynamic language module?

@@ -42,11 +42,8 @@ public final class Languages {
private static final String PROPERTIES_KEY = "languageClasses";
private static final Language NOOP_LANGUAGE = new NoopLanguage();

private static final List<Language> languages = getAllLanguages();
private static final List<Language> dynLanguages = new ArrayList<>();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dynLanguages updated but never read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant