Class TranslateArbTask
- All Implemented Interfaces:
Comparable<org.gradle.api.Task>,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.TaskInternal,org.gradle.api.plugins.ExtensionAware,org.gradle.api.Task,org.gradle.util.Configurable<org.gradle.api.Task>
This task translates Flutter/Dart localization files while preserving ICU MessageFormat syntax and tracking changes via checksums.
The task supports incremental translation using CRC32 checksums stored in the
x-translated custom attribute. Resources are only re-translated when:
- They don't exist in the target file yet
- The checksum doesn't match (indicating the source text changed)
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Task
org.gradle.api.Task.Namer -
Field Summary
Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.gradle.api.provider.Property<String> DeepL API key for authentication.abstract org.gradle.api.provider.Property<File> Optional directory containing DeepL glossary files named<source>-<target>.tsv(base language codes, e.g.Language mappings for DeepL API compatibility.abstract org.gradle.api.provider.Property<String> Server ID for retrieving DeepL API key from gradle.properties.abstract org.gradle.api.provider.Property<File> Source ARB file to translate.abstract org.gradle.api.provider.ListProperty<String> List of target language codes (e.g., ["de", "fr", "es"]).voidMethods inherited from class org.gradle.api.DefaultTask
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTask
acceptServiceReferences, appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.Task
doNotTrackState, getConvention, notCompatibleWithConfigurationCache
-
Constructor Details
-
TranslateArbTask
public TranslateArbTask()
-
-
Method Details
-
getApiKey
DeepL API key for authentication.This parameter is optional and can be used to directly provide the API key. If both serverId and apiKey are provided, apiKey takes precedence.
-
getServerId
Server ID for retrieving DeepL API key from gradle.properties.The API key should be stored in gradle.properties as:
deepl.apiKey=YOUR_DEEPL_API_KEY
Or in ~/.gradle/gradle.properties for global configuration. -
getSourceFile
Source ARB file to translate.The file must follow the naming convention:
basename_lang.arb(e.g.,app_en.arb,messages_de.arb). The source language is automatically extracted from the filename. -
getTargetLangs
List of target language codes (e.g., ["de", "fr", "es"]).Target files will be created in the same directory as the source file with the appropriate language suffix (e.g.,
app_de.arb,app_fr.arb). -
getLanguageMappings
@Input @Optional public abstract org.gradle.api.provider.MapProperty<String,String> getLanguageMappings()Language mappings for DeepL API compatibility.Allows customizing how generic language codes map to DeepL-specific variants. For example, "en" can be mapped to "en-US" or "en-GB".
Default mappings are used if not specified:
en→en-USpt→pt-PT
-
getGlossaryDir
Optional directory containing DeepL glossary files named<source>-<target>.tsv(base language codes, e.g.en-de.tsv), each linesourceTerm<TAB>targetTerm. Pins how individual terms are translated so the same source word stays consistent across resources and runs. When unset, translation runs without glossaries. -
translateArb
public void translateArb()
-