mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
feat(translate): add Amazon Translate mock service (#2879)
* feat(translate): add Amazon Translate mock service JSON 1.1 stub for Amazon Translate covering the three self-contained sync operations: TranslateText, TranslateDocument, ListLanguages. Follows the existing Comprehend/Textract stub pattern (stateless, echoes input, AI_MOCK_CONFIG override for TranslateText). - TranslateText echoes Text, enforces the 10,000-byte limit, allows any language pair; an auto source is reported back as en. - TranslateDocument echoes the base64 Content and enforces the English-pivot rule, the ContentType allow-list, valid base64, and the 100 KB cap (InvalidRequestException, matching the operation's error model). The encoded length is checked before decoding so an oversized payload cannot force a large allocation. - ListLanguages returns a fixed ~35-language catalog; DisplayLanguageCode is validated, pagination inputs are accepted but ignored. Untrusted request values are truncated before being echoed into error messages. * chore(translate): remove em-dashes per AGENTS.md style guide Replace em-dashes in the Translate doc page and Java comments with colons, commas, or periods, and the ellipsis in the error-message preview helper with "...". Addresses the Greptile review note on PR #2879.
This commit is contained in:
1 parent
c32f8b5a24
commit
10192f05d5
15 files changed
+842
-9
No files matched your search
@@ -679,6 +679,7 @@ public interface EmulatorConfig {
|
||||
PricingServiceConfig pricing();
|
||||
DuckConfig duck();
|
||||
TranscribeServiceConfig transcribe();
|
||||
TranslateServiceConfig translate();
|
||||
CostExplorerServiceConfig ce();
|
||||
CurServiceConfig cur();
|
||||
BcmDataExportsServiceConfig bcmDataExports();
|
||||
@@ -1607,6 +1608,11 @@ public interface EmulatorConfig {
|
||||
boolean enabled();
|
||||
}
|
||||
|
||||
interface TranslateServiceConfig {
|
||||
@WithDefault("true")
|
||||
boolean enabled();
|
||||
}
|
||||
|
||||
interface PricingServiceConfig {
|
||||
@WithDefault("true")
|
||||
boolean enabled();
|
||||
|
||||
@@ -15,8 +15,8 @@ import java.util.Optional;
|
||||
/**
|
||||
* Loads the shared mock-response configuration file referenced by {@code AI_MOCK_CONFIG}
|
||||
* or {@code floci.ai-mock-config-file}, used by the fixed-stub AI services (Textract,
|
||||
* Comprehend, Rekognition) to return a caller-configured response instead of their default
|
||||
* canned stub. The file is re-read when its modification time changes, so it can be edited
|
||||
* Comprehend, Rekognition, Translate) to return a caller-configured response instead of their
|
||||
* default canned stub. The file is re-read when its modification time changes, so it can be edited
|
||||
* without restarting the emulator — same mechanism as {@code SfnMockLoader}.
|
||||
* <p>
|
||||
* Unlike {@code SfnMockLoader} (where the mock configuration is the only way to run a
|
||||
@@ -27,8 +27,8 @@ import java.util.Optional;
|
||||
* default response.
|
||||
* <p>
|
||||
* Config file shape: {@code {"<serviceKey>": {"<lookupKey>": {"<Action>": <response>}}}}.
|
||||
* See {@code docs/services/textract.md} / {@code comprehend.md} / {@code rekognition.md}
|
||||
* "Mock Responses" sections for each service's lookup-key convention.
|
||||
* See {@code docs/services/textract.md} / {@code comprehend.md} / {@code rekognition.md} /
|
||||
* {@code translate.md} "Mock Responses" sections for each service's lookup-key convention.
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class AiMockConfigLoader {
|
||||
|
||||
@@ -31,6 +31,7 @@ import io.github.hectorvent.floci.services.textract.TextractJsonHandler;
|
||||
import io.github.hectorvent.floci.services.comprehend.ComprehendJsonHandler;
|
||||
import io.github.hectorvent.floci.services.rekognition.RekognitionJsonHandler;
|
||||
import io.github.hectorvent.floci.services.transcribe.TranscribeJsonHandler;
|
||||
import io.github.hectorvent.floci.services.translate.TranslateJsonHandler;
|
||||
import io.github.hectorvent.floci.services.apigatewayv2.ApiGatewayV2JsonHandler;
|
||||
import io.github.hectorvent.floci.services.cloudwatch.logs.CloudWatchLogsHandler;
|
||||
import io.github.hectorvent.floci.services.cognito.CognitoJsonHandler;
|
||||
@@ -106,6 +107,7 @@ public class AwsJson11Controller {
|
||||
private final RekognitionJsonHandler rekognitionJsonHandler;
|
||||
private final PricingJsonHandler pricingJsonHandler;
|
||||
private final TranscribeJsonHandler transcribeJsonHandler;
|
||||
private final TranslateJsonHandler translateJsonHandler;
|
||||
private final CostExplorerJsonHandler costExplorerJsonHandler;
|
||||
private final CurJsonHandler curJsonHandler;
|
||||
private final BcmDataExportsJsonHandler bcmDataExportsJsonHandler;
|
||||
@@ -151,6 +153,7 @@ public class AwsJson11Controller {
|
||||
RekognitionJsonHandler rekognitionJsonHandler,
|
||||
PricingJsonHandler pricingJsonHandler,
|
||||
TranscribeJsonHandler transcribeJsonHandler,
|
||||
TranslateJsonHandler translateJsonHandler,
|
||||
CostExplorerJsonHandler costExplorerJsonHandler,
|
||||
CurJsonHandler curJsonHandler,
|
||||
BcmDataExportsJsonHandler bcmDataExportsJsonHandler,
|
||||
@@ -200,6 +203,7 @@ public class AwsJson11Controller {
|
||||
this.rekognitionJsonHandler = rekognitionJsonHandler;
|
||||
this.pricingJsonHandler = pricingJsonHandler;
|
||||
this.transcribeJsonHandler = transcribeJsonHandler;
|
||||
this.translateJsonHandler = translateJsonHandler;
|
||||
this.costExplorerJsonHandler = costExplorerJsonHandler;
|
||||
this.curJsonHandler = curJsonHandler;
|
||||
this.bcmDataExportsJsonHandler = bcmDataExportsJsonHandler;
|
||||
@@ -280,6 +284,7 @@ public class AwsJson11Controller {
|
||||
case "rekognition" -> rekognitionJsonHandler.handle(action, request, region);
|
||||
case "pricing" -> pricingJsonHandler.handle(action, request, region);
|
||||
case "transcribe" -> transcribeJsonHandler.handle(action, request, region);
|
||||
case "translate" -> translateJsonHandler.handle(action, request, region);
|
||||
case "ce" -> costExplorerJsonHandler.handle(action, request, region);
|
||||
case "cur" -> curJsonHandler.handle(action, request, region);
|
||||
case "bcm-data-exports" -> bcmDataExportsJsonHandler.handle(action, request, region);
|
||||
|
||||
@@ -476,6 +476,10 @@ public class ResolvedServiceCatalog {
|
||||
config.storage().services().transcribe().flushIntervalMs(), null, ServiceProtocol.JSON,
|
||||
protocols(ServiceProtocol.JSON),
|
||||
Set.of("Transcribe."), Set.of("transcribe"), Set.of(), Set.of()),
|
||||
descriptor("translate", "translate", config.services().translate().enabled(), true,
|
||||
null, null, 5000L, null, ServiceProtocol.JSON,
|
||||
protocols(ServiceProtocol.JSON),
|
||||
Set.of("AWSShineFrontendService_20170701."), Set.of("translate"), Set.of(), Set.of()),
|
||||
descriptor("ce", "ce", config.services().ce().enabled(), true,
|
||||
null, null, 5000L, null, ServiceProtocol.JSON,
|
||||
protocols(ServiceProtocol.JSON),
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package io.github.hectorvent.floci.services.translate;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.github.hectorvent.floci.core.common.AwsErrorResponse;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import org.jboss.logging.Logger;
|
||||
/**
|
||||
* JSON 1.1 handler for Amazon Translate API operations.
|
||||
* Dispatches X-Amz-Target: AWSShineFrontendService_20170701.* actions to {@link TranslateService}.
|
||||
*
|
||||
* @see <a href="https://docs.aws.amazon.com/translate/latest/APIReference/welcome.html">Translate API Reference</a>
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class TranslateJsonHandler {
|
||||
private static final Logger LOG = Logger.getLogger(TranslateJsonHandler.class);
|
||||
private final TranslateService translateService;
|
||||
@Inject
|
||||
public TranslateJsonHandler(TranslateService translateService) {
|
||||
this.translateService = translateService;
|
||||
}
|
||||
/**
|
||||
* Dispatches Translate actions received via the AwsJson11Controller. Only the three
|
||||
* self-contained sync actions are implemented; the terminology, parallel-data, async
|
||||
* batch-job, and tagging surface (all of which need persistent state) is out of scope.
|
||||
*/
|
||||
public Response handle(String action, JsonNode request, String region) {
|
||||
LOG.debugv("Translate action: {0}", action);
|
||||
return switch (action) {
|
||||
case "TranslateText" -> translateService.translateText(
|
||||
getStringField(request, "Text"),
|
||||
getStringField(request, "SourceLanguageCode"),
|
||||
getStringField(request, "TargetLanguageCode"));
|
||||
case "TranslateDocument" -> translateService.translateDocument(
|
||||
getNestedStringField(request, "Document", "Content"),
|
||||
getNestedStringField(request, "Document", "ContentType"),
|
||||
getStringField(request, "SourceLanguageCode"),
|
||||
getStringField(request, "TargetLanguageCode"));
|
||||
case "ListLanguages" -> translateService.listLanguages(
|
||||
getStringField(request, "DisplayLanguageCode"));
|
||||
default -> Response.status(400)
|
||||
.entity(new AwsErrorResponse("UnknownOperationException",
|
||||
"Unknown operation: AWSShineFrontendService_20170701." + action))
|
||||
.build();
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Extracts a string-typed field. A present-but-wrong-typed value is a shape/marshalling
|
||||
* mismatch caught at the protocol layer before operation-specific validation, matching
|
||||
* {@link ComprehendJsonHandler}. It must not be silently coerced, nor conflated with a
|
||||
* missing field (a modeled business error handled in {@link TranslateService}).
|
||||
*/
|
||||
private String getStringField(JsonNode node, String field) {
|
||||
JsonNode value = node == null ? null : node.get(field);
|
||||
if (value == null || value.isNull()) {
|
||||
return null;
|
||||
}
|
||||
if (!value.isTextual()) {
|
||||
throw new AwsException("SerializationException",
|
||||
"Unable to unmarshal request; the value for '" + field + "' is not a string.", 400);
|
||||
}
|
||||
return value.asText();
|
||||
}
|
||||
/** {@link #getStringField} for a field nested one level under {@code parent} (e.g. Document.Content). */
|
||||
private String getNestedStringField(JsonNode node, String parent, String field) {
|
||||
JsonNode parentNode = node == null ? null : node.get(parent);
|
||||
if (parentNode == null || parentNode.isNull()) {
|
||||
return null;
|
||||
}
|
||||
if (!parentNode.isObject()) {
|
||||
throw new AwsException("SerializationException",
|
||||
"Unable to unmarshal request; the value for '" + parent + "' is not a structure.", 400);
|
||||
}
|
||||
return getStringField(parentNode, field);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
package io.github.hectorvent.floci.services.translate;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.github.hectorvent.floci.core.common.AiMockConfigLoader;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
/**
|
||||
* Dummy response builder for Amazon Translate. Stateless: no machine translation is
|
||||
* performed. {@code TranslateText} and {@code TranslateDocument} echo their input back
|
||||
* as the "translated" payload; {@code ListLanguages} returns a fixed catalog. Input
|
||||
* validation (required fields, known language codes, Text/document size limits, and the
|
||||
* English-pivot rule for documents) still follows real Translate behavior, since that is
|
||||
* protocol compatibility rather than translation logic.
|
||||
* <p>
|
||||
* Callers can override the {@code TranslateText} default per exact {@code Text} value via
|
||||
* {@link AiMockConfigLoader}; see {@code docs/services/translate.md} "Mock Responses".
|
||||
* {@code TranslateDocument} carries a binary payload with no stable lookup key, so mock
|
||||
* lookup is skipped for it (same treatment as a Bytes-backed Textract document).
|
||||
*
|
||||
* @see <a href="https://docs.aws.amazon.com/translate/latest/APIReference/welcome.html">Translate API Reference</a>
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class TranslateService {
|
||||
private static final String SERVICE_KEY = "translate";
|
||||
/** TranslateText input cap: real Translate rejects Text longer than 10,000 UTF-8 bytes. */
|
||||
private static final int MAX_TEXT_BYTES = 10_000;
|
||||
/** TranslateDocument input cap: real Translate rejects a document larger than 100 KB. */
|
||||
private static final int MAX_DOCUMENT_BYTES = 100 * 1024;
|
||||
/**
|
||||
* Longest base64 string that can decode to {@link #MAX_DOCUMENT_BYTES} (4 chars per 3
|
||||
* bytes, rounded up). Checked before {@link Base64.Decoder#decode} so an oversized
|
||||
* payload is rejected without allocating the decoded {@code byte[]}.
|
||||
*/
|
||||
private static final int MAX_DOCUMENT_CONTENT_CHARS = ((MAX_DOCUMENT_BYTES + 2) / 3) * 4;
|
||||
/** Longest request value echoed verbatim into an error message. */
|
||||
private static final int ERROR_VALUE_PREVIEW_CHARS = 64;
|
||||
/** ContentType values real Translate accepts for TranslateDocument. */
|
||||
private static final Set<String> SUPPORTED_CONTENT_TYPES = Set.of(
|
||||
"text/plain", "text/html",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
||||
/**
|
||||
* DisplayLanguageCode enum accepted by ListLanguages. Matches the AWS API model; the
|
||||
* returned {@code LanguageName}s are always English here regardless of this value
|
||||
* (documented deviation: real Translate localizes the names).
|
||||
*/
|
||||
private static final Set<String> SUPPORTED_DISPLAY_LANGUAGE_CODES = Set.of(
|
||||
"de", "en", "es", "fr", "it", "ja", "ko", "pt", "zh", "zh-TW");
|
||||
/**
|
||||
* Curated subset of Translate's supported languages, enough to exercise an i18n
|
||||
* pipeline without tracking AWS's full ~75-language list. Also the allow-list for
|
||||
* Source/TargetLanguageCode validation. Insertion order is preserved for ListLanguages.
|
||||
*/
|
||||
private static final Map<String, String> SUPPORTED_LANGUAGES = buildSupportedLanguages();
|
||||
private final ObjectMapper objectMapper;
|
||||
private final AiMockConfigLoader mockConfigLoader;
|
||||
@Inject
|
||||
public TranslateService(ObjectMapper objectMapper, AiMockConfigLoader mockConfigLoader) {
|
||||
this.objectMapper = objectMapper;
|
||||
this.mockConfigLoader = mockConfigLoader;
|
||||
}
|
||||
/**
|
||||
* TranslateText: echoes {@code Text} back as {@code TranslatedText}. A source code of
|
||||
* {@code auto} is reported back as {@code en} (the stub's fixed "detected" language).
|
||||
* Response shape: https://docs.aws.amazon.com/translate/latest/APIReference/API_TranslateText.html
|
||||
*/
|
||||
public Response translateText(String text, String sourceLanguageCode, String targetLanguageCode) {
|
||||
requireField(text, "Text");
|
||||
// length() (chars) is a lower bound on UTF-8 byte count, so the cheap check
|
||||
// short-circuits before getBytes() allocates for a pathologically large Text.
|
||||
if (text.length() > MAX_TEXT_BYTES
|
||||
|| text.getBytes(StandardCharsets.UTF_8).length > MAX_TEXT_BYTES) {
|
||||
throw new AwsException("TextSizeLimitExceededException",
|
||||
"The text is longer than the maximum supported size of "
|
||||
+ MAX_TEXT_BYTES + " bytes.", 400);
|
||||
}
|
||||
String resolvedSource = validateSourceLanguage(sourceLanguageCode);
|
||||
validateTargetLanguage(targetLanguageCode);
|
||||
Optional<JsonNode> mock = mockConfigLoader.lookup(SERVICE_KEY, text, "TranslateText");
|
||||
if (mock.isPresent()) {
|
||||
return Response.ok(mock.get()).build();
|
||||
}
|
||||
ObjectNode root = objectMapper.createObjectNode();
|
||||
root.put("TranslatedText", text);
|
||||
root.put("SourceLanguageCode", resolvedSource);
|
||||
root.put("TargetLanguageCode", targetLanguageCode);
|
||||
return Response.ok(root).build();
|
||||
}
|
||||
/**
|
||||
* TranslateDocument: echoes the document bytes back unchanged as the translated
|
||||
* document. Content is validated as base64 and size-checked, but never decoded for
|
||||
* translation. Real Translate only translates between English and another language, so
|
||||
* one of the two language codes must resolve to {@code en}.
|
||||
* Response shape: https://docs.aws.amazon.com/translate/latest/APIReference/API_TranslateDocument.html
|
||||
*/
|
||||
public Response translateDocument(String content, String contentType,
|
||||
String sourceLanguageCode, String targetLanguageCode) {
|
||||
requireField(content, "Document.Content");
|
||||
requireField(contentType, "Document.ContentType");
|
||||
if (!SUPPORTED_CONTENT_TYPES.contains(contentType)) {
|
||||
throw new AwsException("InvalidRequestException",
|
||||
"Unsupported document content type: \"" + preview(contentType) + "\". Supported "
|
||||
+ "types are text/plain, text/html, and the Word (.docx) MIME type.", 400);
|
||||
}
|
||||
// Validate the cheap fields before touching the (potentially large) base64 blob.
|
||||
String resolvedSource = validateSourceLanguage(sourceLanguageCode);
|
||||
validateTargetLanguage(targetLanguageCode);
|
||||
if (!"en".equals(resolvedSource) && !"en".equals(targetLanguageCode)) {
|
||||
throw new AwsException("UnsupportedLanguagePairException",
|
||||
"Amazon Translate can only translate documents between English and another "
|
||||
+ "language. Set either the source or the target language to \"en\".", 400);
|
||||
}
|
||||
if (content.length() > MAX_DOCUMENT_CONTENT_CHARS) {
|
||||
throw new AwsException("InvalidRequestException",
|
||||
"The document exceeds the maximum supported size of "
|
||||
+ MAX_DOCUMENT_BYTES + " bytes.", 400);
|
||||
}
|
||||
byte[] decoded;
|
||||
try {
|
||||
decoded = Base64.getDecoder().decode(content);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new AwsException("InvalidRequestException",
|
||||
"Document.Content is not valid base64-encoded data.", 400);
|
||||
}
|
||||
if (decoded.length > MAX_DOCUMENT_BYTES) {
|
||||
throw new AwsException("InvalidRequestException",
|
||||
"The document size (" + decoded.length + " bytes) exceeds the maximum "
|
||||
+ "supported size of " + MAX_DOCUMENT_BYTES + " bytes.", 400);
|
||||
}
|
||||
ObjectNode root = objectMapper.createObjectNode();
|
||||
// json-1.1 marshals a blob as its base64 string; echo the caller's bytes verbatim.
|
||||
root.putObject("TranslatedDocument").put("Content", content);
|
||||
root.put("SourceLanguageCode", resolvedSource);
|
||||
root.put("TargetLanguageCode", targetLanguageCode);
|
||||
return Response.ok(root).build();
|
||||
}
|
||||
/**
|
||||
* ListLanguages: returns the full fixed catalog. Pagination inputs are accepted but
|
||||
* ignored (the catalog is small and static), so no {@code NextToken} is returned.
|
||||
* Response shape: https://docs.aws.amazon.com/translate/latest/APIReference/API_ListLanguages.html
|
||||
*/
|
||||
public Response listLanguages(String displayLanguageCode) {
|
||||
String display = (displayLanguageCode == null || displayLanguageCode.isEmpty())
|
||||
? "en" : displayLanguageCode;
|
||||
if (!SUPPORTED_DISPLAY_LANGUAGE_CODES.contains(display)) {
|
||||
throw new AwsException("UnsupportedDisplayLanguageCodeException",
|
||||
"Unsupported display language code: \"" + preview(display) + "\".", 400);
|
||||
}
|
||||
ObjectNode root = objectMapper.createObjectNode();
|
||||
ArrayNode languages = root.putArray("Languages");
|
||||
for (Map.Entry<String, String> entry : SUPPORTED_LANGUAGES.entrySet()) {
|
||||
ObjectNode language = languages.addObject();
|
||||
language.put("LanguageCode", entry.getKey());
|
||||
language.put("LanguageName", entry.getValue());
|
||||
}
|
||||
root.put("DisplayLanguageCode", display);
|
||||
return Response.ok(root).build();
|
||||
}
|
||||
// Private helpers
|
||||
private void requireField(String value, String fieldName) {
|
||||
if (value == null || value.isEmpty()) {
|
||||
throw new AwsException("InvalidRequestException",
|
||||
fieldName + " is a required field.", 400);
|
||||
}
|
||||
}
|
||||
/** Returns the code to report back; {@code auto} resolves to {@code en}. */
|
||||
private String validateSourceLanguage(String code) {
|
||||
requireField(code, "SourceLanguageCode");
|
||||
if ("auto".equals(code)) {
|
||||
return "en";
|
||||
}
|
||||
requireKnownLanguage(code);
|
||||
return code;
|
||||
}
|
||||
private void validateTargetLanguage(String code) {
|
||||
requireField(code, "TargetLanguageCode");
|
||||
requireKnownLanguage(code);
|
||||
}
|
||||
private void requireKnownLanguage(String code) {
|
||||
if (!SUPPORTED_LANGUAGES.containsKey(code)) {
|
||||
throw new AwsException("UnsupportedLanguagePairException",
|
||||
"Unsupported language code: \"" + preview(code) + "\".", 400);
|
||||
}
|
||||
}
|
||||
/** Caps an untrusted request value before it goes into a client-visible error message. */
|
||||
private static String preview(String value) {
|
||||
if (value.length() <= ERROR_VALUE_PREVIEW_CHARS) {
|
||||
return value;
|
||||
}
|
||||
return value.substring(0, ERROR_VALUE_PREVIEW_CHARS) + "...";
|
||||
}
|
||||
private static Map<String, String> buildSupportedLanguages() {
|
||||
Map<String, String> languages = new LinkedHashMap<>();
|
||||
languages.put("af", "Afrikaans");
|
||||
languages.put("ar", "Arabic");
|
||||
languages.put("bn", "Bengali");
|
||||
languages.put("zh", "Chinese (Simplified)");
|
||||
languages.put("zh-TW", "Chinese (Traditional)");
|
||||
languages.put("cs", "Czech");
|
||||
languages.put("da", "Danish");
|
||||
languages.put("nl", "Dutch");
|
||||
languages.put("en", "English");
|
||||
languages.put("fi", "Finnish");
|
||||
languages.put("fr", "French");
|
||||
languages.put("de", "German");
|
||||
languages.put("el", "Greek");
|
||||
languages.put("he", "Hebrew");
|
||||
languages.put("hi", "Hindi");
|
||||
languages.put("hu", "Hungarian");
|
||||
languages.put("id", "Indonesian");
|
||||
languages.put("it", "Italian");
|
||||
languages.put("ja", "Japanese");
|
||||
languages.put("ko", "Korean");
|
||||
languages.put("ms", "Malay");
|
||||
languages.put("no", "Norwegian");
|
||||
languages.put("fa", "Persian");
|
||||
languages.put("pl", "Polish");
|
||||
languages.put("pt", "Portuguese (Brazil)");
|
||||
languages.put("pt-PT", "Portuguese (Portugal)");
|
||||
languages.put("ro", "Romanian");
|
||||
languages.put("ru", "Russian");
|
||||
languages.put("sk", "Slovak");
|
||||
languages.put("es", "Spanish");
|
||||
languages.put("sv", "Swedish");
|
||||
languages.put("th", "Thai");
|
||||
languages.put("tr", "Turkish");
|
||||
languages.put("uk", "Ukrainian");
|
||||
languages.put("vi", "Vietnamese");
|
||||
return Collections.unmodifiableMap(languages);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user