Class HtmlAssetTranslator


  • @Deprecated
    public final class HtmlAssetTranslator
    extends java.lang.Object
    Deprecated.
    without replacement since 3.4.2

    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 
      Modifier and Type Field Description
      private static java.util.regex.Pattern COMMA
      Deprecated.
       
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private HtmlAssetTranslator()
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void main​(java.lang.String[] args)
      Deprecated.
       
      private static java.util.Collection<java.lang.String> parseFileNamesToTranslate​(java.nio.file.Path assetsDir, java.util.List<java.lang.String> restOfArgs)
      Deprecated.
       
      private static java.util.Collection<java.lang.String> parseLanguagesToTranslate​(java.nio.file.Path assetsDir, java.lang.String languageArg)
      Deprecated.
       
      private static boolean shouldTranslate​(org.w3c.dom.Node node)
      Deprecated.
       
      private static void translateOneFile​(java.lang.String language, java.nio.file.Path targetHtmlDir, java.nio.file.Path sourceFile, java.lang.String translationTextTranslated)
      Deprecated.
       
      private static void translateOneLanguage​(java.nio.file.Path assetsDir, java.lang.String language, java.util.Collection<java.lang.String> filesToTranslate)
      Deprecated.
       
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COMMA

        private static final java.util.regex.Pattern COMMA
        Deprecated.
    • Constructor Detail

      • HtmlAssetTranslator

        private HtmlAssetTranslator()
        Deprecated.
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
      • parseLanguagesToTranslate

        private static java.util.Collection<java.lang.String> parseLanguagesToTranslate​(java.nio.file.Path assetsDir,
                                                                                        java.lang.String languageArg)
                                                                                 throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
      • parseFileNamesToTranslate

        private static java.util.Collection<java.lang.String> parseFileNamesToTranslate​(java.nio.file.Path assetsDir,
                                                                                        java.util.List<java.lang.String> restOfArgs)
                                                                                 throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
      • translateOneLanguage

        private static void translateOneLanguage​(java.nio.file.Path assetsDir,
                                                 java.lang.String language,
                                                 java.util.Collection<java.lang.String> filesToTranslate)
                                          throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
      • translateOneFile

        private static void translateOneFile​(java.lang.String language,
                                             java.nio.file.Path targetHtmlDir,
                                             java.nio.file.Path sourceFile,
                                             java.lang.String translationTextTranslated)
                                      throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
      • shouldTranslate

        private static boolean shouldTranslate​(org.w3c.dom.Node node)
        Deprecated.