Class HtmlAssetTranslator
A utility which auto-translates the English-language text in a directory of HTML documents using Google Translate.
Pass the Android client assets/ directory as first argument, and the language to translate to second as a comma-separated list. Specify "all" for language to try to translate for all existing translations. Each argument after this is the name of a file to translate; if the first one is "all", all files will be translated.
Usage: HtmlAssetTranslator android/assets/ (all|lang1[,lang2 ...]) (all|file1.html[ file2.html ...])
android/assets/ es all
will translate .html files in subdirectory html-en to
directory html-es, for example. Note that only text nodes in the HTML document are translated.
Any text that is a child of a node with class="notranslate"
will not be translated. It will
also add a note at the end of the translated page that indicates it was automatically translated.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Deprecated.private static Collection
<String> parseFileNamesToTranslate
(Path assetsDir, List<String> restOfArgs) Deprecated.private static Collection
<String> parseLanguagesToTranslate
(Path assetsDir, String languageArg) Deprecated.private static boolean
shouldTranslate
(Node node) Deprecated.private static void
translateOneFile
(String language, Path targetHtmlDir, Path sourceFile, String translationTextTranslated) Deprecated.private static void
translateOneLanguage
(Path assetsDir, String language, Collection<String> filesToTranslate) Deprecated.
-
Field Details
-
COMMA
Deprecated.
-
-
Constructor Details
-
HtmlAssetTranslator
private HtmlAssetTranslator()Deprecated.
-
-
Method Details
-
main
Deprecated.- Throws:
IOException
-
parseLanguagesToTranslate
private static Collection<String> parseLanguagesToTranslate(Path assetsDir, String languageArg) throws IOException Deprecated.- Throws:
IOException
-
parseFileNamesToTranslate
private static Collection<String> parseFileNamesToTranslate(Path assetsDir, List<String> restOfArgs) throws IOException Deprecated.- Throws:
IOException
-
translateOneLanguage
private static void translateOneLanguage(Path assetsDir, String language, Collection<String> filesToTranslate) throws IOException Deprecated.- Throws:
IOException
-
translateOneFile
private static void translateOneFile(String language, Path targetHtmlDir, Path sourceFile, String translationTextTranslated) throws IOException Deprecated.- Throws:
IOException
-
shouldTranslate
Deprecated.
-