Skip to content

Commit

Permalink
Add catalan
Browse files Browse the repository at this point in the history
  • Loading branch information
1-alex98 committed Oct 18, 2020
1 parent d594172 commit 172990a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/faforever/client/i18n/I18n.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ private void loadAvailableLanguages() throws IOException {
new Locale("iw"),
new Locale("tr"),
new Locale("nl"),
new Locale("cat"),
Locale.ITALIAN,
new Locale("pl")
));
Expand Down
Empty file.
15 changes: 13 additions & 2 deletions src/test/java/com/faforever/client/i18n/I18nTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.faforever.client.preferences.Preferences;
import com.faforever.client.preferences.PreferencesService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -11,15 +12,21 @@
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Locale;
import java.util.stream.Stream;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
@Slf4j
public class I18nTest {

@Rule
Expand Down Expand Up @@ -103,7 +110,11 @@ public void rounded() {
}

@Test
public void getAvailableLanguages() {
assertThat(instance.getAvailableLanguages(), hasSize(13));
public void testLoadedLanguagesAreComplete() throws IOException {
final Path path = Paths.get("src", "main", "resources", "i18n");
try (Stream<Path> walk = Files.walk(path)) {
final long messageFileCount = walk.filter(path1 -> Files.isRegularFile(path1) && path.getFileName().toString().endsWith(".properties")).count();
assertThat(instance.getAvailableLanguages(), hasSize((int) messageFileCount));
}
}
}

0 comments on commit 172990a

Please sign in to comment.