@Test public void canGetGoogleMappedLocales() { assertThat(backend.getMappedLocale(LocaleCode.EN_US)) .isEqualTo(new BackendLocaleCodeImpl("en")); assertThat(backend.getMappedLocale(LocaleCode.ZH_HANS)) .isEqualTo(new BackendLocaleCodeImpl("zh-CN")); assertThat(backend.getMappedLocale(LocaleCode.ZH_HANT)) .isEqualTo(new BackendLocaleCodeImpl("zh-TW")); assertThat(backend.getMappedLocale(LocaleCode.DE)) .isEqualTo(new BackendLocaleCodeImpl("de")); }
@Override public BackendLocaleCode getMappedLocale(LocaleCode localeCode) { BackendLocaleCode googleLocaleCode = new BackendLocaleCodeImpl(localeCode); return LOCALE_MAP.getOrDefault(localeCode, googleLocaleCode); }
GoogleTranslatorBackend implements TranslatorBackend { @Override public BackendLocaleCode getMappedLocale(LocaleCode localeCode) { BackendLocaleCode googleLocaleCode = new BackendLocaleCodeImpl(localeCode); return LOCALE_MAP.getOrDefault(localeCode, googleLocaleCode); } }
GoogleTranslatorBackend implements TranslatorBackend { @Override public BackendLocaleCode getMappedLocale(LocaleCode localeCode) { BackendLocaleCode googleLocaleCode = new BackendLocaleCodeImpl(localeCode); return LOCALE_MAP.getOrDefault(localeCode, googleLocaleCode); } @Inject  GoogleTranslatorBackend(DTOUtil dtoUtil,
            @Credentials(BackendID.GOOGLE) GoogleCredential googleCredential); @VisibleForTesting protected  GoogleTranslatorBackend(Translate translate,
            DTOUtil dtoUtil, GoogleCredential googleCredential); }
GoogleTranslatorBackend implements TranslatorBackend { @Override public BackendLocaleCode getMappedLocale(LocaleCode localeCode) { BackendLocaleCode googleLocaleCode = new BackendLocaleCodeImpl(localeCode); return LOCALE_MAP.getOrDefault(localeCode, googleLocaleCode); } @Inject  GoogleTranslatorBackend(DTOUtil dtoUtil,
            @Credentials(BackendID.GOOGLE) GoogleCredential googleCredential); @VisibleForTesting protected  GoogleTranslatorBackend(Translate translate,
            DTOUtil dtoUtil, GoogleCredential googleCredential); @Override List<AugmentedTranslation> translate(List<String> contents,
            BackendLocaleCode srcLocale, BackendLocaleCode targetLocale,
            StringType stringType, Optional<String> category); @Override BackendLocaleCode getMappedLocale(LocaleCode localeCode); @Override int getCharLimitPerRequest(); @Override BackendID getId(); }
GoogleTranslatorBackend implements TranslatorBackend { @Override public BackendLocaleCode getMappedLocale(LocaleCode localeCode) { BackendLocaleCode googleLocaleCode = new BackendLocaleCodeImpl(localeCode); return LOCALE_MAP.getOrDefault(localeCode, googleLocaleCode); } @Inject  GoogleTranslatorBackend(DTOUtil dtoUtil,
            @Credentials(BackendID.GOOGLE) GoogleCredential googleCredential); @VisibleForTesting protected  GoogleTranslatorBackend(Translate translate,
            DTOUtil dtoUtil, GoogleCredential googleCredential); @Override List<AugmentedTranslation> translate(List<String> contents,
            BackendLocaleCode srcLocale, BackendLocaleCode targetLocale,
            StringType stringType, Optional<String> category); @Override BackendLocaleCode getMappedLocale(LocaleCode localeCode); @Override int getCharLimitPerRequest(); @Override BackendID getId();  }