Skip to content

Commit

Permalink
feat: Introduce language modules
Browse files Browse the repository at this point in the history
- add LanguageToolLanguageManager: Language plugins should register LT language with LanguageToolLanguageManager.registerLTLanguage for supporting module

Signed-off-by: Hiroshi Miura <[email protected]>
  • Loading branch information
miurahr committed Jul 25, 2024
1 parent 378d9d2 commit 5877f5c
Show file tree
Hide file tree
Showing 41 changed files with 1,523 additions and 63 deletions.
10 changes: 4 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ dependencies {
// Temporary exclusion; see https://sourceforge.net/p/omegat/bugs/814/
exclude module: 'lucene-gosen'
}
testImplementation "org.omegat.lucene:lucene-gosen:5.5.1:ipadic"
testImplementation("org.omegat.lucene:lucene-gosen:5.5.1:ipadic")
testRuntimeOnly(libs.slf4j.jdk14)

// JAXB codegen only
Expand Down Expand Up @@ -714,11 +714,9 @@ distributions {
into 'lib'
}
// system core plugins into modules
from('releases/modules-specific') {
into 'modules'
}
from(subprojects.collect {it.tasks.withType(Jar)}) {
into 'modules'
into('modules') {
from(subprojects.collect {it.tasks.withType(Jar)})
from('releases/modules-specific')
}
eachFile {
// Move main JAR up one level from lib.
Expand Down
12 changes: 9 additions & 3 deletions languagetools/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'java'
}
repositories {
mavenLocal()
mavenCentral()
}

Expand Down Expand Up @@ -40,11 +41,14 @@ def plugins = [

def pluginPackage = 'org.omegat.languagetool.language'
def languageToolVersion = libs.versions.languagetool.get()
def languageToolGroup = libs.languagetool.core.get().group
plugins.forEach { args ->
def name = args.get('code')
def pluginClass = "${pluginPackage}." + args.get('className')
def lang = args.get('lang')
sourceSets.create(name)
dependencies.add("${name}CompileOnly", project.rootProject)
dependencies.add("${name}CompileOnly", libs.languagetool.core)
if (name.equals("ja")) {
dependencies.add("jaImplementation", libs.languagetool.ja.get()) {
// Temporary exclusion; see https://sourceforge.net/p/omegat/bugs/814/
Expand All @@ -53,11 +57,11 @@ plugins.forEach { args ->
}
dependencies.add("jaImplementation", 'org.omegat.lucene:lucene-gosen:5.5.1:ipadic')
} else {
dependencies.add("${name}Implementation", "org.languagetool:language-${name}:${languageToolVersion}") {
dependencies.add("${name}Implementation", "${languageToolGroup}:language-${name}:${languageToolVersion}") {
exclude module: 'languagetool-core'
}
}
configurations.getByName("${name}RuntimeClasspath").exclude(group: 'org.languagetool', module: 'languagetool-core')
configurations.getByName("${name}RuntimeClasspath").exclude(group: languageToolGroup, module: 'languagetool-core')
tasks.getByName("${name}Classes") {
group = 'languagetool'
}
Expand All @@ -77,7 +81,9 @@ plugins.forEach { args ->
'Plugin-Author': 'OmegaT team',
'Plugin-Link': 'https://omegat.org',
'Plugin-Description': "Provide ${lang} Languagetool library",
'Plugin-Version': "${languageToolVersion}")
'Plugin-Category': 'language',
'Plugin-Version': "${languageToolVersion}"
)
}
group = 'languagetool'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* OmegaT - Computer Assisted Translation (CAT) tool
* with fuzzy matching, translation memory, keyword search,
* glossaries, and translation leveraging into updated projects.
*
* Copyright (C) 2023 Hiroshi Miura
* Home page: https://www.omegat.org/
* Support center: https://omegat.org/support
*
* This file is part of OmegaT.
*
* OmegaT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OmegaT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.omegat.languagetool.language;

public class ArabicPlugin {

public static void loadPlugins() {
}

public static void unloadPlugins() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* OmegaT - Computer Assisted Translation (CAT) tool
* with fuzzy matching, translation memory, keyword search,
* glossaries, and translation leveraging into updated projects.
*
* Copyright (C) 2023 Hiroshi Miura
* Home page: https://www.omegat.org/
* Support center: https://omegat.org/support
*
* This file is part of OmegaT.
*
* OmegaT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OmegaT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.omegat.languagetool.language;

public class AsturianPlugin {

public static void loadPlugins() {
}

public static void unloadPlugins() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* OmegaT - Computer Assisted Translation (CAT) tool
* with fuzzy matching, translation memory, keyword search,
* glossaries, and translation leveraging into updated projects.
*
* Copyright (C) 2023 Hiroshi Miura
* Home page: https://www.omegat.org/
* Support center: https://omegat.org/support
*
* This file is part of OmegaT.
*
* OmegaT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OmegaT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.omegat.languagetool.language;

import org.languagetool.language.Belarusian;

import org.omegat.languagetools.LanguageToolLanguageManager;

public class BelarusianPlugin {

@SuppressWarnings("deprecation")
public static void loadPlugins() {
LanguageToolLanguageManager.registerLTLanguage(new Belarusian());
}

public static void unloadPlugins() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* OmegaT - Computer Assisted Translation (CAT) tool
* with fuzzy matching, translation memory, keyword search,
* glossaries, and translation leveraging into updated projects.
*
* Copyright (C) 2023 Hiroshi Miura
* Home page: https://www.omegat.org/
* Support center: https://omegat.org/support
*
* This file is part of OmegaT.
*
* OmegaT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OmegaT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.omegat.languagetool.language;

public class BretonPlugin {

public static void loadPlugins() {
}

public static void unloadPlugins() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* OmegaT - Computer Assisted Translation (CAT) tool
* with fuzzy matching, translation memory, keyword search,
* glossaries, and translation leveraging into updated projects.
*
* Copyright (C) 2023 Hiroshi Miura
* Home page: https://www.omegat.org/
* Support center: https://omegat.org/support
*
* This file is part of OmegaT.
*
* OmegaT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OmegaT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.omegat.languagetool.language;

public class CatalanPlugin {

public static void loadPlugins() {
}

public static void unloadPlugins() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* OmegaT - Computer Assisted Translation (CAT) tool
* with fuzzy matching, translation memory, keyword search,
* glossaries, and translation leveraging into updated projects.
*
* Copyright (C) 2023 Hiroshi Miura
* Home page: https://www.omegat.org/
* Support center: https://omegat.org/support
*
* This file is part of OmegaT.
*
* OmegaT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OmegaT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.omegat.languagetool.language;

public class DanishPlugin {

public static void loadPlugins() {
}

public static void unloadPlugins() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* OmegaT - Computer Assisted Translation (CAT) tool
* with fuzzy matching, translation memory, keyword search,
* glossaries, and translation leveraging into updated projects.
*
* Copyright (C) 2023 Hiroshi Miura
* Home page: https://www.omegat.org/
* Support center: https://omegat.org/support
*
* This file is part of OmegaT.
*
* OmegaT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OmegaT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.omegat.languagetool.language;

import org.languagetool.language.AustrianGerman;
import org.languagetool.language.GermanyGerman;
import org.languagetool.language.SwissGerman;

import org.omegat.languagetools.LanguageToolLanguageManager;

public class GermanPlugin {

public static void loadPlugins() {
LanguageToolLanguageManager.registerLTLanguage(new AustrianGerman());
LanguageToolLanguageManager.registerLTLanguage(new GermanyGerman());
LanguageToolLanguageManager.registerLTLanguage(new SwissGerman());
}

public static void unloadPlugins() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* OmegaT - Computer Assisted Translation (CAT) tool
* with fuzzy matching, translation memory, keyword search,
* glossaries, and translation leveraging into updated projects.
*
* Copyright (C) 2023 Hiroshi Miura
* Home page: https://www.omegat.org/
* Support center: https://omegat.org/support
*
* This file is part of OmegaT.
*
* OmegaT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OmegaT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.omegat.languagetool.language;

public class GreekPlugin {

public static void loadPlugins() {
}

public static void unloadPlugins() {
}

}
Loading

0 comments on commit 5877f5c

Please sign in to comment.