Вопрос

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.

Это было полезно?

Решение

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;

      }      

    }
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top