UNPKG

otus-localization

Version:

A translation tool for Angular i18n(angular-t9n)

1 lines 5.55 kB
"use strict";(self.webpackChunkotus_translation=self.webpackChunkotus_translation||[]).push([[737],{7125:(d,O,e)=>{e.d(O,{C:()=>A});var c=e(9862);function A(n){let a=new c.LE;return n.page&&(a=a.set("page",n.page.toString())),n.entriesPerPage&&(a=a.set("entriesPerPage",n.entriesPerPage.toString())),n.sort&&n.sort.active&&n.sort.direction&&(a=a.set("sort",`${"desc"===n.sort.direction?"!":""}${n.sort.active}`)),n.filter&&(a=Object.keys(n.filter).filter(s=>n.filter[s]).reduce((s,P)=>s.set(P,n.filter[P]),a)),a}},2934:(d,O,e)=>{e.d(O,{D:()=>h});var c=e(5619),A=e(2572),n=e(2181),a=e(7398),s=e(4664),P=e(8180),p=e(9397),C=e(553),u=e(2315),_=e(5879),S=e(9862);let h=(()=>{class g{constructor(o,t){this._http=o,this._websocketService=t,this._rootSubject=new c.X(null),this._targetsSubject=new c.X(null),this._targetsMap=new c.X(new Map),this._targets=this._targetsSubject.pipe((0,n.h)(r=>!!r)),this.root=this._rootSubject.pipe((0,n.h)(r=>!!r)),this.targets=this._targetsMap.pipe((0,a.U)(r=>Array.from(r.values()))),this.root.pipe((0,s.w)(r=>this._http.get(r._links.targets.href))).subscribe(r=>this._targetsSubject.next(r)),this._targets.pipe((0,s.w)(r=>this._loadTargets(r))).subscribe(r=>this._targetsMap.next(r)),this._websocketService.projectChange.pipe((0,s.w)(()=>this._http.get(`${C.N.translationServer}/api`))).subscribe(r=>this._rootSubject.next(r))}target(o){return this._targetsMap.pipe((0,a.U)(t=>t.get(o)))}createTarget(o){return this._targets.pipe((0,P.q)(1),(0,a.U)(t=>this._targetHref(t,o)),(0,s.w)(t=>this._http.post(t,{})),(0,p.b)(t=>this._updateTarget(t)))}updateTarget(o){return this._targets.pipe((0,a.U)(t=>this._targetHref(t,o)),(0,s.w)(t=>this._http.get(t)),(0,p.b)(t=>this._updateTarget(t)))}_loadTargets(o){return(0,A.a)(o.languages.map(t=>this._targetHref(o,t)).map(t=>this._http.get(t))).pipe((0,a.U)(t=>t.reduce((r,E)=>r.set(E.language,E),new Map)))}_targetHref(o,t){return o._links.target.href.replace("{language}",t)}_updateTarget(o){const t=new Map(this._targetsMap.value).set(o.language,o);this._targetsMap.next(t)}static{this.\u0275fac=function(t){return new(t||g)(_.LFG(S.eN),_.LFG(u.i))}}static{this.\u0275prov=_.Yz7({token:g,factory:g.\u0275fac,providedIn:"root"})}}return g})()},6346:(d,O,e)=>{e.r(O),e.d(O,{TargetComponent:()=>o});var c=e(6814),A=e(5195),n=e(1919),a=e(2651),s=e(1896),P=e(4664),p=e(2181),C=e(2934),u=e(2511),_=e(5879);function S(t,r){1&t&&(_.TgZ(0,"a",9),_.SDv(1,10),_.qZA())}function h(t,r){1&t&&(_.TgZ(0,"mat-card",11),_.SDv(1,12),_.qZA())}const g=function(){return{exact:!0}},m=function(){return{state:"initial"}};let o=(()=>{class t{constructor(E,T){this._route=E,this._translationService=T,this.target=this._route.params.pipe((0,P.w)(i=>this._translationService.target(i.language)),(0,p.h)(i=>!!i))}static{this.\u0275fac=function(T){return new(T||t)(_.Y36(s.gz),_.Y36(C.D))}}static{this.\u0275cmp=_.Xpm({type:t,selectors:[["t9n-target"]],standalone:!0,features:[_._Bn([u.V]),_.jDz],decls:18,vars:13,consts:function(){let E,T,i,M,R;return E=$localize`:␟e5b9218a6c766b23fc18899f8dc559cc4f7e7621␟1613971242435858090:Translate`,T=$localize`:␟5f19586aba912ec6eb123ec5ab609a3bcc073066␟7462301153729425254:Export`,i=$localize`:␟a059709f71aa4c0ac219e160e78a738682ca6a36␟1071721880474488785:Import`,M=$localize`:␟4ab6aedb58478677ac0bfc5eb87bc3fe8b8c0920␟1724892236454928633:Orphans`,R=$localize`:␟883f596b4489ae541868cbc12502ed1ec13f08c7␟8128328859314736211: Orphans are translation units whose id is no longer contained in the source file. Migrate them in the orphans section. `,[["opened","","mode","side"],["mat-list-item","","routerLink","./","routerLinkActive","active",3,"routerLinkActiveOptions","queryParams"],E,["mat-list-item","","routerLink","./export","routerLinkActive","active"],T,["mat-list-item","","routerLink","./import","routerLinkActive","active"],i,["mat-list-item","","routerLink","./orphans","routerLinkActive","active",4,"ngIf"],["appearance","outlined",4,"ngIf"],["mat-list-item","","routerLink","./orphans","routerLinkActive","active"],M,["appearance","outlined"],R]},template:function(T,i){if(1&T&&(_.TgZ(0,"mat-sidenav-container")(1,"mat-sidenav",0)(2,"h1"),_._uU(3),_.ALo(4,"async"),_.qZA(),_.TgZ(5,"mat-nav-list")(6,"a",1),_.SDv(7,2),_.qZA(),_.TgZ(8,"a",3),_.SDv(9,4),_.qZA(),_.TgZ(10,"a",5),_.SDv(11,6),_.qZA(),_.YNc(12,S,2,0,"a",7),_.ALo(13,"async"),_.qZA(),_.YNc(14,h,2,0,"mat-card",8),_.ALo(15,"async"),_.qZA(),_.TgZ(16,"mat-sidenav-content"),_._UZ(17,"router-outlet"),_.qZA()()),2&T){let M,R,l;_.xp6(3),_.Oqu(null==(M=_.lcZ(4,5,i.target))?null:M.language),_.xp6(3),_.Q6J("routerLinkActiveOptions",_.DdM(11,g))("queryParams",_.DdM(12,m)),_.xp6(6),_.Q6J("ngIf",null==(R=_.lcZ(13,7,i.target))?null:R.orphanCount),_.xp6(2),_.Q6J("ngIf",null==(l=_.lcZ(15,9,i.target))?null:l.orphanCount)}},dependencies:[a.SJ,a.JX,a.TM,a.Rh,n.ie,n.Hk,n.Tg,s.rH,s.Od,c.O5,A.QW,A.a8,s.lC,c.Ov],styles:["[_nghost-%COMP%]{display:block;height:100%}h1[_ngcontent-%COMP%]{color:#00000061;font-size:12px;font-weight:600;margin-bottom:8px;padding:20px 24px 0 16px;text-transform:uppercase}mat-sidenav-container[_ngcontent-%COMP%]{height:100%}mat-sidenav-container[_ngcontent-%COMP%] mat-sidenav[_ngcontent-%COMP%]{width:12rem}mat-sidenav-container[_ngcontent-%COMP%] mat-sidenav[_ngcontent-%COMP%] a.active[_ngcontent-%COMP%]{color:#3f51b5;background-color:#0000000d}mat-sidenav-container[_ngcontent-%COMP%] mat-sidenav[_ngcontent-%COMP%] mat-card[_ngcontent-%COMP%]{background-color:#fff59d;margin:.5rem;padding:.25rem}"],changeDetection:0})}}return t})()}}]);