Skip to content

Commit 20cc566

Browse files
committed
Merge branch 'dev'
2 parents 7e65629 + 25004ec commit 20cc566

78 files changed

Lines changed: 30387 additions & 876 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
File renamed without changes.

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Babylon
22

3-
## Tool to automate Java property file translation.
3+
## Tool to automate translation files.
44

55
### Description and usage
66

7-
Babylon is a tool to gather messages, and their translations from property files. It performs a round-trip consisting of
7+
Babylon is a tool to gather messages, and their translations from translation files. It performs a round-trip consisting of
88
two phases: *export* phase and *import* phase.
99

1010
In the export phase the messages are written to a [Google Sheets](https://www.google.com/sheets/about/) spreadsheet.
1111
A translator will then fill in the missing translations.
1212

1313
In the import phase, the spreadsheet (with the missing translations filled out by a translator) is examined, and the
14-
newly translated messages are used to update the respective translation property files. Also, the state of the translation,
14+
newly translated messages are used to update the respective translation files. Also, the state of the translation,
1515
*snapshot*, is written out to a disk in the form of JSON file.
1616

1717
Babylon can be run as a Maven plugin or as a standalone console application.
@@ -25,6 +25,8 @@ To run Babylon:
2525
- A Json configuration file must exist (see the "Configuration" section).
2626
- A Google Sheets spreadsheet must exist (empty for the export phase).
2727

28+
Currently only supported file types are **.properties** and **.ts**
29+
2830
### Google Cloud user credentials
2931

3032
You need a Google Cloud project with Sheets API enabled. Also, you need to download the `credentials.json` client
@@ -122,7 +124,7 @@ mvn babylon:import -Dconfig.file=test-config.json -Dgoogle.sheet.id=1xhnBAOpy8-9
122124

123125
### Running Babylon as a console application
124126

125-
Application needs the following arguments: 1.action 2.config.json 3.google sheet id
127+
Application needs the following arguments: 1.action 2.config.json 3.google sheet id (4. optional combineSheets)
126128

127129
1. expected action (export, import)
128130
* `export` - takes all properties files specified in configuration file and export their properties into specified the Google spreadsheet. Each property
@@ -132,10 +134,13 @@ Application needs the following arguments: 1.action 2.config.json 3.google sheet
132134
properties file (are present only in concrete mutation properties file) is placed at the end of the target mutation file.
133135
2. path to translator-config.json file. This file serves as database for translation process.
134136
3. ID of the Google spreadsheet (e.g. 1xhnBAOpy8-9KWhl8NP0ZIy6mhlgXKnKcLJwKcIeyjPc)
137+
4. **Optional** boolean value whether export should be placed into only one sheet (only usable for debugging translations)
135138

136139
Command line examples:
137140

138141
``` shell
139142
java -jar babylon-1.0-SNAPSHOT.jar export test-config.json 1xhnBAOpy8-9KWhl8NP0ZIy6mhlgXKnKcLJwKcIeyjPc
140143
java -jar babylon-1.0-SNAPSHOT.jar import test-config.json 1xhnBAOpy8-9KWhl8NP0ZIy6mhlgXKnKcLJwKcIeyjPc
141144
```
145+
146+

pom.xml

Lines changed: 108 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<groupId>one.edee.oss</groupId>
66
<artifactId>babylon-maven-plugin</artifactId>
77
<packaging>maven-plugin</packaging>
8-
<version>2.0.9-SNAPSHOT</version>
8+
<!-- <version>2.0.12-SNAPSHOT</version>-->
9+
<version>2024.10.1</version>
910
<name>Babylon - translation utility</name>
1011
<url>https://github.com/FgForrest/Babylon/</url>
1112
<description>
@@ -29,14 +30,14 @@
2930
</developers>
3031

3132
<distributionManagement>
32-
<snapshotRepository>
33-
<id>ossrh</id>
34-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
35-
</snapshotRepository>
36-
<repository>
37-
<id>ossrh</id>
38-
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
39-
</url>
33+
<snapshotRepository>
34+
<id>ossrh</id>
35+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
36+
</snapshotRepository>
37+
<repository>
38+
<id>ossrh</id>
39+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
40+
</url>
4041
</repository>
4142
</distributionManagement>
4243

@@ -65,11 +66,37 @@
6566
<maven.compiler.source>1.8</maven.compiler.source>
6667
<maven.compiler.target>1.8</maven.compiler.target>
6768
<java.version>1.8</java.version>
68-
<kotlin.version>1.4.20</kotlin.version>
6969
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
7070
</properties>
7171

72+
<dependencyManagement>
73+
<dependencies>
74+
<dependency>
75+
<groupId>com.google.cloud</groupId>
76+
<artifactId>libraries-bom</artifactId>
77+
<version>4.3.0</version>
78+
<type>pom</type>
79+
<scope>import</scope>
80+
</dependency>
81+
</dependencies>
82+
</dependencyManagement>
83+
7284
<dependencies>
85+
<dependency>
86+
<groupId>com.theokanning.openai-gpt3-java</groupId>
87+
<artifactId>service</artifactId>
88+
<version>0.18.2</version>
89+
</dependency>
90+
<dependency>
91+
<groupId>com.google.cloud</groupId>
92+
<artifactId>google-cloud-translate</artifactId>
93+
</dependency>
94+
95+
<dependency>
96+
<groupId>com.deepl.api</groupId>
97+
<artifactId>deepl-java</artifactId>
98+
<version>1.4.0</version>
99+
</dependency>
73100
<dependency>
74101
<groupId>org.springframework.boot</groupId>
75102
<artifactId>spring-boot-starter</artifactId>
@@ -84,7 +111,7 @@
84111
<dependency>
85112
<groupId>org.projectlombok</groupId>
86113
<artifactId>lombok</artifactId>
87-
<version>1.18.8</version>
114+
<version>1.18.30</version>
88115
</dependency>
89116
<dependency>
90117
<groupId>com.fasterxml.jackson.core</groupId>
@@ -99,7 +126,7 @@
99126
<dependency>
100127
<groupId>de.poiu.apron</groupId>
101128
<artifactId>apron</artifactId>
102-
<version>2.1.1-FGFIX</version>
129+
<version>2.1.1</version>
103130
</dependency>
104131
<!-- Support for working with google spreadsheets -->
105132
<dependency>
@@ -130,17 +157,12 @@
130157
<artifactId>maven-plugin-annotations</artifactId>
131158
<version>3.6.0</version>
132159
</dependency>
133-
<dependency>
134-
<groupId>org.jetbrains.kotlin</groupId>
135-
<artifactId>kotlin-stdlib-jdk8</artifactId>
136-
<version>${kotlin.version}</version>
137-
</dependency>
138160

139161
<!-- Test dependencies -->
140162
<dependency>
141163
<groupId>junit</groupId>
142164
<artifactId>junit</artifactId>
143-
<version>4.13.1</version>
165+
<version>4.13</version>
144166
<scope>test</scope>
145167
</dependency>
146168
<dependency>
@@ -162,14 +184,19 @@
162184
<scope>test</scope>
163185
</dependency>
164186
<dependency>
165-
<groupId>org.jetbrains.kotlin</groupId>
166-
<artifactId>kotlin-test</artifactId>
167-
<version>${kotlin.version}</version>
168-
<scope>test</scope>
187+
<groupId>org.antlr</groupId>
188+
<artifactId>antlr4</artifactId>
189+
<version>4.13.1</version>
190+
</dependency>
191+
<dependency>
192+
<groupId>org.jetbrains</groupId>
193+
<artifactId>annotations</artifactId>
194+
<version>24.1.0</version>
169195
</dependency>
170196
</dependencies>
171197

172198
<build>
199+
<finalName>babylon</finalName>
173200
<plugins>
174201
<plugin>
175202
<groupId>org.apache.maven.plugins</groupId>
@@ -181,6 +208,7 @@
181208
<artifactId>maven-javadoc-plugin</artifactId>
182209
<version>3.2.0</version>
183210
<configuration>
211+
<failOnError>false</failOnError>
184212
<doclint>none</doclint>
185213
</configuration>
186214
</plugin>
@@ -200,32 +228,33 @@
200228
<plugin>
201229
<groupId>org.apache.maven.plugins</groupId>
202230
<artifactId>maven-release-plugin</artifactId>
203-
<version>2.5.3</version>
204-
<configuration>
205-
<localCheckout>true</localCheckout>
206-
<pushChanges>false</pushChanges>
207-
<mavenExecutorId>forked-path</mavenExecutorId>
208-
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
209-
</configuration>
210-
<dependencies>
211-
<dependency>
212-
<groupId>org.apache.maven.scm</groupId>
213-
<artifactId>maven-scm-provider-gitexe</artifactId>
214-
<version>1.9.5</version>
215-
</dependency>
216-
</dependencies>
217-
</plugin>
218-
<plugin>
219-
<groupId>org.sonatype.plugins</groupId>
220-
<artifactId>nexus-staging-maven-plugin</artifactId>
221-
<version>1.6.7</version>
222-
<extensions>true</extensions>
223-
<configuration>
224-
<serverId>ossrh</serverId>
225-
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
226-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
227-
</configuration>
231+
<version>3.0.1</version>
232+
<configuration>
233+
<localCheckout>true</localCheckout>
234+
<pushChanges>false</pushChanges>
235+
<mavenExecutorId>forked-path</mavenExecutorId>
236+
<arguments>-Dgpg.passphrase=${gpg.passphrase} -DskipTests=true</arguments>
237+
<releaseProfiles>release-sign-artifacts</releaseProfiles>
238+
</configuration>
239+
<dependencies>
240+
<dependency>
241+
<groupId>org.apache.maven.scm</groupId>
242+
<artifactId>maven-scm-provider-gitexe</artifactId>
243+
<version>2.1.0</version>
244+
</dependency>
245+
</dependencies>
228246
</plugin>
247+
<plugin>
248+
<groupId>org.sonatype.plugins</groupId>
249+
<artifactId>nexus-staging-maven-plugin</artifactId>
250+
<version>1.6.13</version>
251+
<extensions>true</extensions>
252+
<configuration>
253+
<serverId>ossrh</serverId>
254+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
255+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
256+
</configuration>
257+
</plugin>
229258
<plugin>
230259
<groupId>org.apache.maven.plugins</groupId>
231260
<artifactId>maven-source-plugin</artifactId>
@@ -285,37 +314,6 @@
285314
</execution>
286315
</executions>
287316
</plugin>
288-
<plugin>
289-
<groupId>org.jetbrains.kotlin</groupId>
290-
<artifactId>kotlin-maven-plugin</artifactId>
291-
<version>${kotlin.version}</version>
292-
<executions>
293-
<execution>
294-
<id>compile</id>
295-
<goals>
296-
<goal>compile</goal>
297-
</goals>
298-
<configuration>
299-
<sourceDirs>
300-
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
301-
<sourceDir>${project.basedir}/src/main/java</sourceDir>
302-
</sourceDirs>
303-
</configuration>
304-
</execution>
305-
<execution>
306-
<id>test-compile</id>
307-
<goals>
308-
<goal>test-compile</goal>
309-
</goals>
310-
<configuration>
311-
<sourceDirs>
312-
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
313-
<sourceDir>${project.basedir}/src/test/java</sourceDir>
314-
</sourceDirs>
315-
</configuration>
316-
</execution>
317-
</executions>
318-
</plugin>
319317
<plugin>
320318
<groupId>org.apache.maven.plugins</groupId>
321319
<artifactId>maven-compiler-plugin</artifactId>
@@ -347,38 +345,40 @@
347345
</execution>
348346
</executions>
349347
</plugin>
348+
350349
</plugins>
351350
</build>
352351

353352
<profiles>
354-
<!-- GPG Signature on release -->
355-
<profile>
356-
<id>release-sign-artifacts</id>
357-
<activation>
358-
<property>
359-
<name>performRelease</name>
360-
<value>true</value>
361-
</property>
362-
</activation>
363-
<build>
364-
<plugins>
365-
<plugin>
366-
<groupId>org.apache.maven.plugins</groupId>
367-
<artifactId>maven-gpg-plugin</artifactId>
368-
<version>1.6</version>
369-
<executions>
370-
<execution>
371-
<id>sign-artifacts</id>
372-
<phase>verify</phase>
373-
<goals>
374-
<goal>sign</goal>
375-
</goals>
376-
</execution>
377-
</executions>
378-
</plugin>
379-
</plugins>
380-
</build>
381-
</profile>
382-
</profiles>
353+
<!-- GPG Signature on release -->
354+
<profile>
355+
<id>release-sign-artifacts</id>
356+
<build>
357+
<plugins>
358+
<plugin>
359+
<groupId>org.apache.maven.plugins</groupId>
360+
<artifactId>maven-gpg-plugin</artifactId>
361+
<version>1.6</version>
362+
<executions>
363+
<execution>
364+
<id>sign-artifacts</id>
365+
<phase>verify</phase>
366+
<goals>
367+
<goal>sign</goal>
368+
</goals>
369+
</execution>
370+
</executions>
371+
<configuration>
372+
<!-- Prevent gpg from using pinentry programs -->
373+
<gpgArguments>
374+
<arg>--pinentry-mode</arg>
375+
<arg>loopback</arg>
376+
</gpgArguments>
377+
</configuration>
378+
</plugin>
379+
</plugins>
380+
</build>
381+
</profile>
382+
</profiles>
383383

384-
</project>
384+
</project>

src/main/java/one/edee/babylon/MainService.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,24 @@ public MainService(Exporter exporter,
2929
this.importProcessor = importProcessor;
3030
}
3131

32-
public void startTranslation(Action action, TranslationConfiguration configuration, String spreadsheetId) throws IOException, GeneralSecurityException, InterruptedException {
32+
public void startTranslation(Action action, TranslationConfiguration configuration, String spreadsheetId, boolean combineSheets) throws IOException, GeneralSecurityException, InterruptedException {
3333
long stTime = System.currentTimeMillis();
3434
switch (action) {
3535
case EXPORT:
3636
log.info("Babylon starting...");
37-
exporter.walkPathsAndWriteSheets(configuration.getPath(), configuration.getMutations(), spreadsheetId, configuration.getSnapshotPath(), configuration.getLockedCellEditor());
37+
exporter.walkPathsAndWriteSheets(
38+
configuration,
39+
spreadsheetId,
40+
combineSheets);
3841
break;
3942
case IMPORT:
4043
importProcessor.doImport(spreadsheetId);
4144
break;
45+
case CHECK:
46+
exporter.walkPathsAndCheckDB(configuration);
47+
break;
4248
}
49+
4350
log.info("Translation done in: " + (System.currentTimeMillis() - stTime) + "ms");
4451
}
4552

0 commit comments

Comments
 (0)