Skip to content

Commit bba9227

Browse files
committed
migrate translation services API
1 parent b7905ba commit bba9227

File tree

6 files changed

+20
-21
lines changed

6 files changed

+20
-21
lines changed

.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<attribute name="maven.pomderived" value="true"/>
1313
</attributes>
1414
</classpathentry>
15-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
15+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
1616
<attributes>
1717
<attribute name="maven.pomderived" value="true"/>
1818
</attributes>

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tongues - Translation plugin for Bukkit MC server
1+
#Tongues - Translation plugin for Bukkit/Spigot MC server
22

3-
Tongues implements real time translation support for messages between players and extends the basic chat services to include other useful features. Currently only the Bing translation API as the translation service.
3+
Tongues implements real time translation support for messages between players and extends the basic chat services to include other useful features. Currently uses the Azure cognitive services text translation API.
44

55
This is quite a stable version, any issues or feature requests are welcome!
66

@@ -158,6 +158,9 @@ The config.yml file can configure the following for chat logging:
158158

159159
##Latest Changes
160160

161+
Since 1.5:
162+
- Migrated translation services to the new Azure cognitive text translation API. This is a beaking change and the comfiguration must change to include a valid subscription key for the new translation services.
163+
161164
Since 1.4:
162165
- Groups administration commands partially implemented (missing list, save, reload commands)
163166

pom.xml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>org.gamesforpeace</groupId>
66
<artifactId>TonguesPlugin</artifactId>
7-
<version>1.4</version>
7+
<version>1.5</version>
88
<packaging>jar</packaging>
99

1010
<name>TonguesPlugin</name>
@@ -33,10 +33,9 @@
3333
<version>1.7.9-R0.2</version>
3434
</dependency>
3535
<dependency>
36-
<groupId>com.memetix</groupId>
37-
<artifactId>microsoft-translator-java-api</artifactId>
38-
<version>0.6.2</version>
39-
<type>jar</type>
36+
<groupId>io.github.firemaples</groupId>
37+
<artifactId>microsoft-translator-java-api</artifactId>
38+
<version>0.8.3</version>
4039
</dependency>
4140
<dependency>
4241
<groupId>org.mockito</groupId>
@@ -71,7 +70,7 @@
7170
<minimizeJar>true</minimizeJar>
7271
<artifactSet>
7372
<includes>
74-
<include>com.memetix:microsoft-translator-java-api</include>
73+
<include>io.github.firemaples:microsoft-translator-java-api</include>
7574
<include>com.google.code.gson:gson</include>
7675
<include>com.logentries:logentries-appender</include>
7776
</includes>
@@ -86,8 +85,8 @@
8685
<configuration>
8786
<relocations>
8887
<relocation>
89-
<pattern>com.memetix</pattern>
90-
<shadedPattern>org.gamesforpeace.memetix</shadedPattern>
88+
<pattern>io.github.firemaples</pattern>
89+
<shadedPattern>org.gamesforpeace.firemaples</shadedPattern>
9190
</relocation>
9291
<relocation>
9392
<pattern>com.google.code.gson</pattern>

src/main/java/org/gamesforpeace/tongues/TonguesPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void onEnable(){
4343
saveDefaultConfig();
4444

4545
//getLogger().fine("Using Bing Translation authentication values -> ClientID:" + getConfig().getString("bingTranslation.clientID") + " SecretKey:" + getConfig().getString("bingTranslation.secretKey"));
46-
Translator translator = new BingTranslator(getConfig().getString("bingTranslation.clientID"), getConfig().getString("bingTranslation.secretKey"));
46+
Translator translator = new BingTranslator(getConfig().getString("bingTranslation.subscriptionKey"));
4747

4848
langStore = new ConcurrentPlayerLanguageStore(translator.getSupportedLanguages(), translator.getDefaultLanguage());
4949

src/main/java/org/gamesforpeace/tongues/translation/BingTranslator.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,19 @@
55

66
import org.apache.commons.lang.Validate;
77

8-
import com.memetix.mst.language.Language;
9-
import com.memetix.mst.translate.Translate;
8+
import io.github.firemaples.language.Language;
9+
import io.github.firemaples.translate.Translate;
1010

1111
public class BingTranslator implements Translator{
1212

1313
private final HashSet<String> supportedLanguages;
1414

15-
public BingTranslator(String clientID, String secretKey) {
15+
public BingTranslator(String subscriptionKey) {
1616

17-
Validate.notEmpty(clientID);
18-
Validate.notEmpty(secretKey);
17+
Validate.notEmpty(subscriptionKey);
1918

2019
// Setup the translator service.
21-
Translate.setClientId(clientID);
22-
Translate.setClientSecret(secretKey);
20+
Translate.setSubscriptionKey(subscriptionKey);
2321

2422
// Populate supported languages list
2523
supportedLanguages = new HashSet<String>();

src/main/resources/config.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
bingTranslation:
2-
clientID: replace_with_your_client_id
3-
secretKey: replace_with_your_secret_key
2+
subscriptionKey: replace_with_your_client_id
43
chatLogging:
54
file:
65
enabled: true

0 commit comments

Comments
 (0)