Frage

Is it possible to support different locales, not making use of Google Web Translation Tool?

Web translation does not seems to be working with Google Sites, once generated code (javascript) is considered invalid by the Google Sites page editor (Edit HTML). Head based meta tags are also not supported.

War es hilfreich?

Lösung

Make a new site for each locale and synchronize their page structures. You could also create machine translated versions using this script (although they would need fixing by a native speaker):

function localizepagestolocalizedsites() {

      var fromblog =  SitesApp.getPageByUrl("https://sites.google.com/a/yourdomain.com/english/home");
      var toblog =  SitesApp.getPageByUrl("https://sites.google.com/a/yourdomain.com/japanese/home");

      var nextbloc = 0;

      while (true) {
        var pages = fromblog.getAllDescendants({"start":nextbloc,"max":100});

        if (pages.length > 0){

          Logger.log("starting at.."+nextbloc+" there are .."+pages.length+" pages starting with.."+pages[0].getTitle());
          var i = nextbloc;
          for (var x in pages) {

            var localizedTitle = LanguageApp.translate(pages[x].getTitle(), "en", "ja");
            var localizedBody = LanguageApp.translate(pages[x].getHtmlContent(), "en", "ja");

            toblog.createWebPage(localizedTitle, pages[x].getName(), localizedBody);

            i = i + 1;          
          }    
        } else {
          break;      
        }
        nextbloc = nextbloc + 100;

      }      

    }
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top