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