Quickstart:Translateadd-onforGoogleSlidesCompletethestepsdescribedintherestofthispage,andinaboutfiveminutesyou'llhavecreatedaGoogleSlidesadd-onthattranslatestextinyourpresentation.
SetitupCreateanewGooglePresentation.Fromwithinyournewpresentation,selectthemenuitemTools>Scripteditor.Ifyouarepresentedwithawelcomescreen,clickBlankProject.DeleteanycodeinthescripteditorandrenameCode.gstotranslate.gs.CreateanewfilebyselectingthemenuitemFile>New>HTMLfile.Namethisfilesidebar(AppsScriptaddsthe.htmlextensionautomatically).Replaceanycodeinthesetwofileswiththefollowingcontent,respectively:translate.gssidebar.htmlslides/translate/translate.gsViewonGitHub/**
/**
//Translateallelementsin-place.texts.forEach(function(text){text.setText(LanguageApp.translate(text.asRenderedString(),'',targetLanguage));});
returntexts.length;}
SelectthemenuitemFile>Saveall.Nameyournewscript"TranslateQuickstart"andclickOK.Thescript'snameisshowntoendusersinseveralplaces,includingtheauthorizationdialog.TryitoutSwitchbacktoyourpresentationandreloadthepage.Afterafewseconds,aTranslateQuickstartsub-menuappearsundertheAdd-onsmenu.ClickAdd-ons>TranslateQuickstart>Start.Adialogboxindicatesthatthescriptrequiresauthorization.ClickContinue.AseconddialogboxrequestsauthorizationforspecificGoogleservices.ClickAllow.Asidebarappears.Totestit,typesometextintoyourpresentation,thenselectit,andclicktheblueTranslatebutton.Toreplacethetextinthepresentation,clickInsert.PublishSincethisisanexampleadd-on,ourtutorialendshere.Ifyouweredevelopingarealadd-on,thelaststepwouldbetopublishitforotherpeopletofindandinstall.
LearnmoreTocontinuelearningabouthowtoextendGoogleSlideswithAppsScript,takealookatthefollowingresources:
Add-ondocumentationExtendingGoogleSlideswithAppsScript
}catch(e){.DumpException(e)}try{varFd=function(a){.A(this,a,0,-1,null,null)};.v(Fd,.z);varGd=function(){.J.call(this);this.f=[];this.b=[]};.p(Gd,.J);Gd.prototype.j=function(a,c){this.f.push({Pd:a,options:c})};Gd.prototype.init=function(a,c,d){window.gapi={};vare=window.jsl={};e.h=.L(.B(a,1));null!=.B(a,12)&&(e.dpo=.K(.C(a,12)));e.ms=.L(.B(a,2));e.m=.L(.B(a,3));e.l=[];.B(c,1)&&(a=.B(c,3))&&this.b.push(a);.B(d,1)&&(d=.B(d,2))&&this.b.push(d);.u("gapi.load",(0,.t)(this.j,this));returnthis};varHd=.G(.vd,.Lc,14)||new.Lc,Id=.G(.vd,_.Mc,9)||new.Mc,Jd=newFd,Kd=newGd;Kd.init(Hd,Id,Jd);.$c("gs",Kd);
GoogleSlideAdd-ontotemplatizetheslide,replacing${}variableswithvaluesfromasidebarform.