otus-localization
Version:
A translation tool for Angular i18n(angular-t9n)
1 lines • 14.6 kB
JavaScript
"use strict";(self.webpackChunkotus_translation=self.webpackChunkotus_translation||[]).push([[96],{2934:(b,U,i)=>{i.d(U,{D:()=>L});var P=i(5619),p=i(2572),u=i(2181),d=i(7398),c=i(4664),I=i(8180),f=i(9397),H=i(553),D=i(2315),m=i(5879),G=i(9862);let L=(()=>{class l{constructor(e,t){this._http=e,this._websocketService=t,this._rootSubject=new P.X(null),this._targetsSubject=new P.X(null),this._targetsMap=new P.X(new Map),this._targets=this._targetsSubject.pipe((0,u.h)(a=>!!a)),this.root=this._rootSubject.pipe((0,u.h)(a=>!!a)),this.targets=this._targetsMap.pipe((0,d.U)(a=>Array.from(a.values()))),this.root.pipe((0,c.w)(a=>this._http.get(a._links.targets.href))).subscribe(a=>this._targetsSubject.next(a)),this._targets.pipe((0,c.w)(a=>this._loadTargets(a))).subscribe(a=>this._targetsMap.next(a)),this._websocketService.projectChange.pipe((0,c.w)(()=>this._http.get(`${H.N.translationServer}/api`))).subscribe(a=>this._rootSubject.next(a))}target(e){return this._targetsMap.pipe((0,d.U)(t=>t.get(e)))}createTarget(e){return this._targets.pipe((0,I.q)(1),(0,d.U)(t=>this._targetHref(t,e)),(0,c.w)(t=>this._http.post(t,{})),(0,f.b)(t=>this._updateTarget(t)))}updateTarget(e){return this._targets.pipe((0,d.U)(t=>this._targetHref(t,e)),(0,c.w)(t=>this._http.get(t)),(0,f.b)(t=>this._updateTarget(t)))}_loadTargets(e){return(0,p.a)(e.languages.map(t=>this._targetHref(e,t)).map(t=>this._http.get(t))).pipe((0,d.U)(t=>t.reduce((a,r)=>a.set(r.language,r),new Map)))}_targetHref(e,t){return e._links.target.href.replace("{language}",t)}_updateTarget(e){const t=new Map(this._targetsMap.value).set(e.language,e);this._targetsMap.next(t)}static{this.\u0275fac=function(t){return new(t||l)(m.LFG(G.eN),m.LFG(D.i))}}static{this.\u0275prov=m.Yz7({token:l,factory:l.\u0275fac,providedIn:"root"})}}return l})()},815:(b,U,i)=>{i.r(U),i.d(U,{OrphanComponent:()=>i_});var P=i(6814),p=i(2296),u=i(617),d=i(3566),c=i(5313),I=i(2596),f=i(1896),H=i(8645),D=i(7398),m=i(4664),G=i(9397),L=i(3020),l=i(2511),_=i(5879),e=i(2939);function t(n,s){if(1&n&&(_.TgZ(0,"dl")(1,"dt"),_.SDv(2,24),_.qZA(),_.TgZ(3,"dd"),_._uU(4),_.qZA(),_.TgZ(5,"dt"),_.SDv(6,25),_.qZA(),_.TgZ(7,"dd"),_._uU(8),_.qZA(),_.TgZ(9,"dt"),_.SDv(10,26),_.qZA(),_.TgZ(11,"dd",27),_._uU(12),_.qZA(),_.TgZ(13,"dt"),_.SDv(14,28),_.qZA(),_.TgZ(15,"dd",29),_._uU(16),_.qZA(),_.TgZ(17,"dt"),_.SDv(18,30),_.qZA(),_.TgZ(19,"dd"),_._uU(20),_.ALo(21,"titlecase"),_.qZA()()),2&n){const o=s.ngIf;_.xp6(4),_.Oqu(o.description||"-"),_.xp6(4),_.Oqu(o.meaning||"-"),_.xp6(4),_.Oqu(o.source),_.xp6(4),_.Oqu(o.target),_.xp6(4),_.Oqu(_.lcZ(21,5,o.state))}}function a(n,s){1&n&&(_.TgZ(0,"th",31),_.SDv(1,32),_.qZA())}function r(n,s){if(1&n&&(_.TgZ(0,"td",33),_._uU(1),_.qZA()),2&n){const o=s.$implicit;_.xp6(1),_.hij(" ",o.distance," ")}}function T(n,s){1&n&&(_.TgZ(0,"th",34),_.SDv(1,35),_.qZA())}function N(n,s){if(1&n&&(_.TgZ(0,"td",36),_._uU(1),_.qZA()),2&n){const o=s.$implicit;_.Q6J("matTooltip",null==o.locations?null:o.locations.join("\n"))("matTooltipDisabled",!(null!=o.locations&&o.locations.length)),_.xp6(1),_.hij(" ",o.id," ")}}function g(n,s){1&n&&(_.TgZ(0,"th",34),_.SDv(1,37),_.qZA())}function A(n,s){if(1&n&&(_.TgZ(0,"td",38),_._uU(1),_.qZA()),2&n){const o=s.$implicit;_.xp6(1),_.Oqu(o.description)}}function S(n,s){1&n&&(_.TgZ(0,"th",34),_.SDv(1,39),_.qZA())}function M(n,s){if(1&n&&(_.TgZ(0,"td",38),_._uU(1),_.qZA()),2&n){const o=s.$implicit;_.xp6(1),_.Oqu(o.meaning)}}function j(n,s){1&n&&(_.TgZ(0,"th",34),_.SDv(1,40),_.qZA())}function Q(n,s){if(1&n&&(_.TgZ(0,"td",38),_._uU(1),_.qZA()),2&n){const o=s.$implicit;_.xp6(1),_.Oqu(o.source)}}function q(n,s){1&n&&(_.TgZ(0,"th",34),_.SDv(1,41),_.qZA())}function F(n,s){if(1&n&&(_.TgZ(0,"td",38),_._uU(1),_.qZA()),2&n){const o=s.$implicit;_.xp6(1),_.Oqu(o.target)}}function J(n,s){1&n&&(_.TgZ(0,"th",34),_.SDv(1,42),_.qZA())}function __(n,s){if(1&n&&(_.TgZ(0,"td",38),_._uU(1),_.ALo(2,"titlecase"),_.qZA()),2&n){const o=s.$implicit;_.xp6(1),_.Oqu(_.lcZ(2,1,o.state))}}function t_(n,s){1&n&&_._UZ(0,"th",43)}function e_(n,s){if(1&n){const o=_.EpF();_.TgZ(0,"td",38)(1,"button",44),_.NdJ("click",function(){const C=_.CHM(o).$implicit,R=_.oxw();return _.KtG(R.migrate(C))}),_.TgZ(2,"mat-icon"),_._uU(3,"input"),_.qZA()()()}}function n_(n,s){1&n&&_._UZ(0,"tr",45)}function o_(n,s){1&n&&_._UZ(0,"tr",46)}const v=function(){return["distance","id","description","meaning","source","target","state","action"]};let i_=(()=>{class n{constructor(o,h,O,C){this._translationTargetService=o,this._route=h,this._router=O,this._snackbar=C,this._destroy=new H.x,this.params=this._route.params.pipe((0,D.U)(({orphanId:R,...$})=>$)),this.orphan=this._route.paramMap.pipe((0,m.w)(R=>this._translationTargetService.orphan(R.get("orphanId"))),(0,G.b)(R=>this._orphan=R),(0,L.B)()),this.similar=this.orphan.pipe((0,D.U)(R=>R._embedded.similar))}ngOnDestroy(){this._destroy.next(),this._destroy.complete()}migrate(o){this.orphan&&this._orphanAction(this._translationTargetService.migrateOrphan(this._orphan,o),`Migrated orphan ${this._orphan.id} to unit ${o.id}`)}delete(){this.orphan&&this._orphanAction(this._translationTargetService.deleteOrphan(this._orphan),`Deleted orphan ${this._orphan.id}`)}_orphanAction(o,h){o.pipe((0,m.w)(({orphansRemaining:O})=>this._router.navigate([O?"..":"../.."],{relativeTo:this._route}))).subscribe(()=>this._snackbar.open(h,void 0,{duration:2500}))}static{this.\u0275fac=function(h){return new(h||n)(_.Y36(l.V),_.Y36(f.gz),_.Y36(f.F0),_.Y36(e.ux))}}static{this.\u0275cmp=_.Xpm({type:n,selectors:[["t9n-orphan"]],standalone:!0,features:[_.jDz],decls:43,vars:17,consts:function(){let o,h,O,C,R,$,y,Z,x,K,w,X,B,W,z,V,Y,k;return o=$localize`:␟a449a33f34e3a6c40b82058c0d69ff39a9f1e925␟2250356394431390492:Similar units`,h=$localize`:␟c9ed6d0fde000bbbca6abfd191c853b5d1306719␟149862035788373642:Distance according to the levenshtein algorithm`,O=$localize`:␟c9ed6d0fde000bbbca6abfd191c853b5d1306719␟149862035788373642:Distance according to the levenshtein algorithm`,C=$localize`:␟cda31dbd724cf5f4fa7a4274d9120651490c8a8c␟8890553633144307762:Back`,R=$localize`:␟53150cdcaa3fc290a4f4018e446e44b998f1f155␟5246620794703463867: Delete orphan `,$=$localize`:␟eec715de352a6b114713b30b640d319fa78207a0␟4902817035128594900:Description`,y=$localize`:␟f2081dbd0b230b2e61d03f870d85af5b54aed1ba␟2984907873245479480:Meaning`,Z=$localize`:␟6834fa6b43d1ecbdf147c48dd9c4d72f1484571d␟9155608366859514313:Source`,x=$localize`:␟38baeb215c17af9d9e295e371a57f4a48ab4c191␟4854396465510517671:Target`,K=$localize`:␟873b72903b1858a9cd6c8967521030b4d7d1435b␟5911214550882917183:State`,w=$localize`:␟33f0509c876e1399d92a9d1882ce38e6f4245ce3␟2590415407309830681: Distance `,X=$localize`:␟2798cc1e152b1ec07fd8daf94a2a073d1ba1ebcc␟7286430803380181008:Id`,B=$localize`:␟eec715de352a6b114713b30b640d319fa78207a0␟4902817035128594900:Description`,W=$localize`:␟f2081dbd0b230b2e61d03f870d85af5b54aed1ba␟2984907873245479480:Meaning`,z=$localize`:␟6834fa6b43d1ecbdf147c48dd9c4d72f1484571d␟9155608366859514313:Source`,V=$localize`:␟38baeb215c17af9d9e295e371a57f4a48ab4c191␟4854396465510517671:Target`,Y=$localize`:␟873b72903b1858a9cd6c8967521030b4d7d1435b␟5911214550882917183:State`,k=$localize`:␟ed06ba25f8b8effadedaa466355f5b85b0041712␟7936624992717622100:Migrate translation and state to this unit and remove this orphan.`,[[4,"ngIf"],[1,"mat-elevation-z1"],["mat-table","","matSort","","aria-label",o,3,"dataSource"],["matColumnDef","distance"],["mat-header-cell","","matTooltip",h,4,"matHeaderCellDef"],["mat-cell","","matTooltip",O,4,"matCellDef"],["matColumnDef","id"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","","matTooltipClass","tooltip-linebreak",3,"matTooltip","matTooltipDisabled",4,"matCellDef"],["matColumnDef","description"],["mat-cell","",4,"matCellDef"],["matColumnDef","meaning"],["matColumnDef","source"],["matColumnDef","target"],["matColumnDef","state"],["matColumnDef","action"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-header-row","",4,"matHeaderRowDef","matHeaderRowDefSticky"],["mat-row","",4,"matRowDef","matRowDefColumns"],[1,"actions"],["mat-raised-button","","color","primary","routerLink","..",3,"queryParams"],C,["type","button","mat-raised-button","","color","warn",3,"click"],R,$,y,Z,[1,"source"],x,[1,"target"],K,["mat-header-cell","","matTooltip",h],w,["mat-cell","","matTooltip",O],["mat-header-cell","","mat-sort-header",""],X,["mat-cell","","matTooltipClass","tooltip-linebreak",3,"matTooltip","matTooltipDisabled"],B,["mat-cell",""],W,z,V,Y,["mat-header-cell",""],["type","button","mat-icon-button","","matTooltip",k,3,"click"],["mat-header-row",""],["mat-row",""]]},template:function(h,O){if(1&h&&(_.TgZ(0,"h2"),_._uU(1),_.ALo(2,"async"),_.qZA(),_.YNc(3,t,22,7,"dl",0),_.ALo(4,"async"),_.TgZ(5,"div",1)(6,"table",2),_.ALo(7,"async"),_.ynx(8,3),_.YNc(9,a,2,0,"th",4),_.YNc(10,r,2,1,"td",5),_.BQk(),_.ynx(11,6),_.YNc(12,T,2,0,"th",7),_.YNc(13,N,2,3,"td",8),_.BQk(),_.ynx(14,9),_.YNc(15,g,2,0,"th",7),_.YNc(16,A,2,1,"td",10),_.BQk(),_.ynx(17,11),_.YNc(18,S,2,0,"th",7),_.YNc(19,M,2,1,"td",10),_.BQk(),_.ynx(20,12),_.YNc(21,j,2,0,"th",7),_.YNc(22,Q,2,1,"td",10),_.BQk(),_.ynx(23,13),_.YNc(24,q,2,0,"th",7),_.YNc(25,F,2,1,"td",10),_.BQk(),_.ynx(26,14),_.YNc(27,J,2,0,"th",7),_.YNc(28,__,3,3,"td",10),_.BQk(),_.ynx(29,15),_.YNc(30,t_,1,0,"th",16),_.YNc(31,e_,4,0,"td",10),_.BQk(),_.YNc(32,n_,1,0,"tr",17),_.YNc(33,o_,1,0,"tr",18),_.qZA()(),_.TgZ(34,"div",19)(35,"a",20),_.ALo(36,"async"),_.TgZ(37,"mat-icon"),_._uU(38,"keyboard_backspace"),_.qZA(),_.ynx(39),_.SDv(40,21),_.BQk(),_.qZA(),_.TgZ(41,"button",22),_.NdJ("click",function(){return O.delete()}),_.SDv(42,23),_.qZA()()),2&h){let C;_.xp6(1),_.Oqu(null==(C=_.lcZ(2,7,O.orphan))?null:C.id),_.xp6(2),_.Q6J("ngIf",_.lcZ(4,9,O.orphan)),_.xp6(3),_.Q6J("dataSource",_.lcZ(7,11,O.similar)),_.xp6(26),_.Q6J("matHeaderRowDef",_.DdM(15,v))("matHeaderRowDefSticky",!0),_.xp6(1),_.Q6J("matRowDefColumns",_.DdM(16,v)),_.xp6(2),_.Q6J("queryParams",_.lcZ(36,13,O.params))}},dependencies:[P.O5,c.p0,c.BZ,c.fO,c.as,c.w1,c.Dz,c.nj,c.ge,c.ev,c.XQ,c.Gk,d.JX,d.YE,d.nU,I.AV,I.gM,p.ot,p.zs,p.lW,p.RK,u.Ps,u.Hw,f.rH,P.Ov,P.rS],styles:["[_nghost-%COMP%]{display:block;padding:0 1.5rem 1.5rem}.source[_ngcontent-%COMP%], .target[_ngcontent-%COMP%]{white-space:pre-wrap}table[_ngcontent-%COMP%]{margin-bottom:1rem}.actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between}"],changeDetection:0})}}return n})()},8337:(b,U,i)=>{i.d(U,{A8:()=>G,Ov:()=>D,Z9:()=>c,eX:()=>H,k:()=>L,o2:()=>d,yy:()=>f});var P=i(3168),p=i(8645),u=i(5879);class d{}function c(l){return l&&"function"==typeof l.connect&&!(l instanceof P.c)}class f{applyChanges(_,e,t,a,r){_.forEachOperation((T,N,g)=>{let A,S;if(null==T.previousIndex){const M=t(T,N,g);A=e.createEmbeddedView(M.templateRef,M.context,M.index),S=1}else null==g?(e.remove(N),S=3):(A=e.get(N),e.move(A,g),S=2);r&&r({context:A?.context,operation:S,record:T})})}detach(){}}class H{constructor(){this.viewCacheSize=20,this._viewCache=[]}applyChanges(_,e,t,a,r){_.forEachOperation((T,N,g)=>{let A,S;null==T.previousIndex?(A=this._insertView(()=>t(T,N,g),g,e,a(T)),S=A?1:0):null==g?(this._detachAndCacheView(N,e),S=3):(A=this._moveView(N,g,e,a(T)),S=2),r&&r({context:A?.context,operation:S,record:T})})}detach(){for(const _ of this._viewCache)_.destroy();this._viewCache=[]}_insertView(_,e,t,a){const r=this._insertViewFromCache(e,t);if(r)return void(r.context.$implicit=a);const T=_();return t.createEmbeddedView(T.templateRef,T.context,T.index)}_detachAndCacheView(_,e){const t=e.detach(_);this._maybeCacheView(t,e)}_moveView(_,e,t,a){const r=t.get(_);return t.move(r,e),r.context.$implicit=a,r}_maybeCacheView(_,e){if(this._viewCache.length<this.viewCacheSize)this._viewCache.push(_);else{const t=e.indexOf(_);-1===t?_.destroy():e.remove(t)}}_insertViewFromCache(_,e){const t=this._viewCache.pop();return t&&e.insert(t,_),t||null}}class D{get selected(){return this._selected||(this._selected=Array.from(this._selection.values())),this._selected}constructor(_=!1,e,t=!0,a){this._multiple=_,this._emitChanges=t,this.compareWith=a,this._selection=new Set,this._deselectedToEmit=[],this._selectedToEmit=[],this.changed=new p.x,e&&e.length&&(_?e.forEach(r=>this._markSelected(r)):this._markSelected(e[0]),this._selectedToEmit.length=0)}select(..._){this._verifyValueAssignment(_),_.forEach(t=>this._markSelected(t));const e=this._hasQueuedChanges();return this._emitChangeEvent(),e}deselect(..._){this._verifyValueAssignment(_),_.forEach(t=>this._unmarkSelected(t));const e=this._hasQueuedChanges();return this._emitChangeEvent(),e}setSelection(..._){this._verifyValueAssignment(_);const e=this.selected,t=new Set(_);_.forEach(r=>this._markSelected(r)),e.filter(r=>!t.has(r)).forEach(r=>this._unmarkSelected(r));const a=this._hasQueuedChanges();return this._emitChangeEvent(),a}toggle(_){return this.isSelected(_)?this.deselect(_):this.select(_)}clear(_=!0){this._unmarkAll();const e=this._hasQueuedChanges();return _&&this._emitChangeEvent(),e}isSelected(_){return this._selection.has(this._getConcreteValue(_))}isEmpty(){return 0===this._selection.size}hasValue(){return!this.isEmpty()}sort(_){this._multiple&&this.selected&&this._selected.sort(_)}isMultipleSelection(){return this._multiple}_emitChangeEvent(){this._selected=null,(this._selectedToEmit.length||this._deselectedToEmit.length)&&(this.changed.next({source:this,added:this._selectedToEmit,removed:this._deselectedToEmit}),this._deselectedToEmit=[],this._selectedToEmit=[])}_markSelected(_){_=this._getConcreteValue(_),this.isSelected(_)||(this._multiple||this._unmarkAll(),this.isSelected(_)||this._selection.add(_),this._emitChanges&&this._selectedToEmit.push(_))}_unmarkSelected(_){_=this._getConcreteValue(_),this.isSelected(_)&&(this._selection.delete(_),this._emitChanges&&this._deselectedToEmit.push(_))}_unmarkAll(){this.isEmpty()||this._selection.forEach(_=>this._unmarkSelected(_))}_verifyValueAssignment(_){}_hasQueuedChanges(){return!(!this._deselectedToEmit.length&&!this._selectedToEmit.length)}_getConcreteValue(_){if(this.compareWith){for(let e of this._selection)if(this.compareWith(_,e))return e;return _}return _}}let G=(()=>{class l{constructor(){this._listeners=[]}notify(e,t){for(let a of this._listeners)a(e,t)}listen(e){return this._listeners.push(e),()=>{this._listeners=this._listeners.filter(t=>e!==t)}}ngOnDestroy(){this._listeners=[]}static{this.\u0275fac=function(t){return new(t||l)}}static{this.\u0275prov=u.Yz7({token:l,factory:l.\u0275fac,providedIn:"root"})}}return l})();const L=new u.OlP("_ViewRepeater")}}]);