diff --git a/README.md b/README.md index 1c5f1fb..82ef543 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ apt-get install build-essential libkrb5-dev gcc g++ * instant search, auto complete * sharing * setting link expiration time + * internalization / translation support * Nice design * responsive design (phone, tablet desktop support) * Setup page @@ -111,3 +112,22 @@ apt-get install build-essential libkrb5-dev gcc g++ * **Markdown based blogging support** - `future plan` * you can write some note in the blog.md for every directory * bug free :) - `In progress` + + +## Translate the page to you own language +1) download / clone the repo (the source not the packed release!) +2) add your language e.g: fr +```bash +npm run add-translation -- --fr +``` +it creates a new `messages.fr.xls` file at `frontend/translate` folder, +it will already contain dummy translation with google translate. +3) 'fix' the dummy translation +4) test if it works: +build and start the app +```bash +npm install +npm start +``` +5) create a pull request at github to add your translation to the project. + diff --git a/frontend/app/admin/admin.component.html b/frontend/app/admin/admin.component.html index a8325e1..bba4e58 100644 --- a/frontend/app/admin/admin.component.html +++ b/frontend/app/admin/admin.component.html @@ -31,10 +31,11 @@ [switch-off-color]="'warning'" [switch-on-color]="'primary'" [switch-inverse]="'inverse'" - [switch-off-text]="'Advanced'" - [switch-on-text]="'Simplified'" + [switch-off-text]="text.Advanced" + [switch-on-text]="text.Simplified" [switch-handle-width]="'100'" [switch-label-width]="'20'" + i18n- [(ngModel)]="simplifiedMode"> diff --git a/frontend/app/admin/admin.component.ts b/frontend/app/admin/admin.component.ts index a1e7b40..a8c5744 100644 --- a/frontend/app/admin/admin.component.ts +++ b/frontend/app/admin/admin.component.ts @@ -4,6 +4,8 @@ import {UserRoles} from "../../../common/entities/UserDTO"; import {NotificationService} from "../model/notification.service"; import {NotificationType} from "../../../common/entities/NotificationDTO"; import {NavigationService} from "../model/navigation.service"; +import {I18n} from "@ngx-translate/i18n-polyfill"; + @Component({ selector: 'admin', templateUrl: './admin.component.html', @@ -12,10 +14,17 @@ import {NavigationService} from "../model/navigation.service"; export class AdminComponent implements OnInit { simplifiedMode = true; + text = { + Advanced: "Advanced", + Simplified: "Simplified" + }; constructor(private _authService: AuthenticationService, private _navigation: NavigationService, - public notificationService: NotificationService) { + public notificationService: NotificationService, + public i18n: I18n) { + this.text.Advanced = i18n("Advanced"); + this.text.Simplified = i18n("Simplified"); } ngOnInit() { diff --git a/frontend/app/app.module.ts b/frontend/app/app.module.ts index b66825f..92babec 100644 --- a/frontend/app/app.module.ts +++ b/frontend/app/app.module.ts @@ -1,4 +1,4 @@ -import {Injectable, NgModule} from "@angular/core"; +import {Injectable, LOCALE_ID, NgModule, TRANSLATIONS} from "@angular/core"; import {BrowserModule, HAMMER_GESTURE_CONFIG, HammerGestureConfig} from "@angular/platform-browser"; import {FormsModule} from "@angular/forms"; import {HttpModule} from "@angular/http"; @@ -57,6 +57,7 @@ import {OtherSettingsComponent} from "./settings/other/other.settings.component" import {DefaultUrlSerializer, UrlSerializer, UrlTree} from '@angular/router'; import {IndexingSettingsComponent} from "./settings/indexing/indexing.settings.component"; import {LanguageComponent} from "./language/language.component"; +import {I18n} from '@ngx-translate/i18n-polyfill'; @Injectable() export class GoogleMapsConfig { @@ -88,6 +89,14 @@ export class CustomUrlSerializer implements UrlSerializer { } } +declare const require; + +export function translationsFactory(locale: string) { + locale = locale || 'en'; // default to english if no locale + console.log("locale", locale); + return require(`raw-loader!../translate/messages.${locale}.xlf`); +} + @NgModule({ imports: [ BrowserModule, @@ -153,8 +162,14 @@ export class CustomUrlSerializer implements UrlSerializer { FullScreenService, NavigationService, SettingsService, - OverlayService], - + OverlayService, + { + provide: TRANSLATIONS, + useFactory: translationsFactory, + deps: [LOCALE_ID] + }, + I18n + ], bootstrap: [AppComponent] }) export class AppModule { diff --git a/frontend/app/gallery/grid/grid.gallery.component.ts b/frontend/app/gallery/grid/grid.gallery.component.ts index 80c2032..80274c0 100644 --- a/frontend/app/gallery/grid/grid.gallery.component.ts +++ b/frontend/app/gallery/grid/grid.gallery.component.ts @@ -154,7 +154,7 @@ export class GalleryGridComponent implements OnChanges, AfterViewInit, OnDestroy this.renderedPhotoIndex < numberOfPhotos)) { let ret = this.renderARow(); if (ret === null) { - throw "Gridphotos rendering failed"; + throw new Error("Grid photos rendering failed"); } renderedContentHeight += ret; } diff --git a/frontend/app/gallery/lightbox/lightbox.gallery.component.html b/frontend/app/gallery/lightbox/lightbox.gallery.component.html index 565ab84..bc5d0c9 100644 --- a/frontend/app/gallery/lightbox/lightbox.gallery.component.html +++ b/frontend/app/gallery/lightbox/lightbox.gallery.component.html @@ -20,28 +20,28 @@ + title="download" i18n-title> + title="info" i18n-title> + (click)="fullScreenService.exitFullScreen()" title="toggle fullscreen" i18n-title> + (click)="fullScreenService.showFullScreen(root)" title="toggle fullscreen" i18n-title> - + diff --git a/frontend/app/gallery/navigator/navigator.gallery.component.ts b/frontend/app/gallery/navigator/navigator.gallery.component.ts index 6848120..6850320 100644 --- a/frontend/app/gallery/navigator/navigator.gallery.component.ts +++ b/frontend/app/gallery/navigator/navigator.gallery.component.ts @@ -4,6 +4,7 @@ import {RouterLink} from "@angular/router"; import {UserDTO} from "../../../../common/entities/UserDTO"; import {AuthenticationService} from "../../model/network/authentication.service"; import {ShareService} from "../share.service"; +import {I18n} from "@ngx-translate/i18n-polyfill"; @Component({ selector: 'gallery-navbar', @@ -16,7 +17,8 @@ export class GalleryNavigatorComponent implements OnChanges { routes: Array = []; constructor(private _authService: AuthenticationService, - public _shareService: ShareService) { + public _shareService: ShareService, + private i18n: I18n) { } @@ -47,9 +49,9 @@ export class GalleryNavigatorComponent implements OnChanges { //create root link if (dirs.length == 0) { - arr.push({name: "Images", route: null}); + arr.push({name: this.i18n("Images"), route: null}); } else { - arr.push({name: "Images", route: UserDTO.isPathAvailable("/", user.permissions) ? "/" : null}); + arr.push({name: this.i18n("Images"), route: UserDTO.isPathAvailable("/", user.permissions) ? "/" : null}); } //create rest navigation diff --git a/frontend/app/gallery/search/search.gallery.component.ts b/frontend/app/gallery/search/search.gallery.component.ts index 7217e2c..dfd926e 100644 --- a/frontend/app/gallery/search/search.gallery.component.ts +++ b/frontend/app/gallery/search/search.gallery.component.ts @@ -67,7 +67,6 @@ export class GallerySearchComponent { } public search(item: AutoCompleteItem) { - console.log("clicked"); this.searchText = item.text; this.onSearch(); } diff --git a/frontend/app/gallery/share/share.gallery.component.ts b/frontend/app/gallery/share/share.gallery.component.ts index fccf030..cbf01e4 100644 --- a/frontend/app/gallery/share/share.gallery.component.ts +++ b/frontend/app/gallery/share/share.gallery.component.ts @@ -8,6 +8,7 @@ import {ModalDirective} from "ngx-bootstrap/modal"; import {Config} from "../../../../common/config/public/Config"; import {NotificationService} from "../../model/notification.service"; import {DirectoryDTO} from "../../../../common/entities/DirectoryDTO"; +import {I18n} from "@ngx-translate/i18n-polyfill"; @Component({ @@ -37,7 +38,8 @@ export class GalleryShareComponent implements OnInit, OnDestroy { constructor(private _sharingService: ShareService, public _galleryService: GalleryService, - private _notification: NotificationService) { + private _notification: NotificationService, + public i18n: I18n) { this.ValidityTypes = ValidityTypes; } @@ -70,7 +72,7 @@ export class GalleryShareComponent implements OnInit, OnDestroy { case ValidityTypes.Months: return this.input.valid.amount * 1000 * 60 * 60 * 24 * 30; } - throw "unknown type: " + this.input.valid.type; + throw new Error("unknown type: " + this.input.valid.type); } async update() { @@ -96,7 +98,7 @@ export class GalleryShareComponent implements OnInit, OnDestroy { } onCopy() { - this._notification.success("Url has been copied to clipboard"); + this._notification.success(this.i18n("Url has been copied to clipboard")); } public hideModal() { diff --git a/frontend/app/gallery/thumnailLoader.service.ts b/frontend/app/gallery/thumnailLoader.service.ts index 0602854..3cb4098 100644 --- a/frontend/app/gallery/thumnailLoader.service.ts +++ b/frontend/app/gallery/thumnailLoader.service.ts @@ -23,7 +23,7 @@ export class ThumbnailLoaderService { let index = taskEntry.parentTask.taskEntities.indexOf(taskEntry); if (index == -1) { - throw "ThumbnailTaskEntity not exist on Task"; + throw new Error("ThumbnailTaskEntity not exist on Task"); } taskEntry.parentTask.taskEntities.splice(index, 1); @@ -31,7 +31,7 @@ export class ThumbnailLoaderService { && taskEntry.parentTask.inProgress == false) { let i = this.que.indexOf(taskEntry.parentTask); if (i == -1) { - throw "ThumbnailTask not exist"; + throw new Error("ThumbnailTask not exist"); } this.que.splice(i, 1); } diff --git a/frontend/app/model/notification.service.ts b/frontend/app/model/notification.service.ts index 0b1a180..93957fa 100644 --- a/frontend/app/model/notification.service.ts +++ b/frontend/app/model/notification.service.ts @@ -4,6 +4,7 @@ import {NetworkService} from "./network/network.service"; import {AuthenticationService} from "./network/authentication.service"; import {NotificationDTO, NotificationType} from "../../../common/entities/NotificationDTO"; import {UserDTO, UserRoles} from "../../../common/entities/UserDTO"; +import {I18n} from "@ngx-translate/i18n-polyfill"; @Injectable() export class NotificationService { @@ -17,7 +18,8 @@ export class NotificationService { constructor(private _toastr: ToastsManager, private _networkService: NetworkService, - private _authService: AuthenticationService) { + private _authService: AuthenticationService, + public i18n: I18n) { this._authService.user.subscribe(() => { if (this._authService.isAuthenticated() && @@ -39,13 +41,13 @@ export class NotificationService { } switch (noti.type) { case NotificationType.error: - this.error(msg, "Server error"); + this.error(msg, this.i18n("Server error")); break; case NotificationType.warning: - this.warning(msg, "Server error"); + this.warning(msg, this.i18n("Server error")); break; case NotificationType.info: - this.info(msg, "Server info"); + this.info(msg, this.i18n("Server info")); break; } }) diff --git a/frontend/app/settings/_abstract/abstract.settings.component.ts b/frontend/app/settings/_abstract/abstract.settings.component.ts index c3f837f..b8d9749 100644 --- a/frontend/app/settings/_abstract/abstract.settings.component.ts +++ b/frontend/app/settings/_abstract/abstract.settings.component.ts @@ -7,6 +7,7 @@ import {NotificationService} from "../../model/notification.service"; import {NavigationService} from "../../model/navigation.service"; import {AbstractSettingsService} from "./abstract.settings.service"; import {IPrivateConfig} from "../../../../common/config/private/IPrivateConfig"; +import {I18n} from "@ngx-translate/i18n-polyfill"; export abstract class SettingsComponent=AbstractSettingsService> @@ -30,16 +31,28 @@ export abstract class SettingsComponent= public settings: T = {}; public original: T = {}; + text = { + Enabled: "Enabled", + Disabled: "Disabled", + Low: "Low", + High: "High" + }; + constructor(private name, private _authService: AuthenticationService, private _navigation: NavigationService, public _settingsService: S, protected notification: NotificationService, + public i18n: I18n, private sliceFN?: (s: IPrivateConfig) => T) { if (this.sliceFN) { this._settingsSubscription = this._settingsService.Settings.subscribe(this.onNewSettings); this.onNewSettings(this._settingsService._settingsService.settings.value); } + this.text.Enabled = i18n("Enabled"); + this.text.Disabled = i18n("Disabled"); + this.text.Low = i18n("Low"); + this.text.High = i18n("High"); } onNewSettings = (s) => { @@ -92,7 +105,7 @@ export abstract class SettingsComponent= try { await this._settingsService.updateSettings(this.settings); await this.getSettings(); - this.notification.success(this.name + ' settings saved', "Success"); + this.notification.success(this.name + this.i18n(' settings saved'), this.i18n("Success")); this.inProgress = false; return true; } catch (err) { diff --git a/frontend/app/settings/basic/basic.settings.component.ts b/frontend/app/settings/basic/basic.settings.component.ts index 4071654..372b338 100644 --- a/frontend/app/settings/basic/basic.settings.component.ts +++ b/frontend/app/settings/basic/basic.settings.component.ts @@ -5,6 +5,7 @@ import {NavigationService} from "../../model/navigation.service"; import {NotificationService} from "../../model/notification.service"; import {BasicSettingsService} from "./basic.settings.service"; import {BasicConfigDTO} from "../../../../common/entities/settings/BasicConfigDTO"; +import {I18n} from "@ngx-translate/i18n-polyfill"; @Component({ selector: 'settings-basic', @@ -20,8 +21,9 @@ export class BasicSettingsComponent extends SettingsComponent { constructor(_authService: AuthenticationService, _navigation: NavigationService, _settingsService: BasicSettingsService, - notification: NotificationService) { - super("Basic", _authService, _navigation, _settingsService, notification, s => ({ + notification: NotificationService, + i18n: I18n) { + super(i18n("Basic"), _authService, _navigation, _settingsService, notification, i18n, s => ({ port: s.Server.port, imagesFolder: s.Server.imagesFolder, applicationTitle: s.Client.applicationTitle, diff --git a/frontend/app/settings/database/database.settings.component.ts b/frontend/app/settings/database/database.settings.component.ts index 1ee3b81..40f15a3 100644 --- a/frontend/app/settings/database/database.settings.component.ts +++ b/frontend/app/settings/database/database.settings.component.ts @@ -6,6 +6,7 @@ import {NotificationService} from "../../model/notification.service"; import {NavigationService} from "../../model/navigation.service"; import {SettingsComponent} from "../_abstract/abstract.settings.component"; import {DatabaseSettingsService} from "./database.settings.service"; +import {I18n} from "@ngx-translate/i18n-polyfill"; @Component({ selector: 'settings-database', @@ -22,8 +23,9 @@ export class DatabaseSettingsComponent extends SettingsComponent constructor(_authService: AuthenticationService, _navigation: NavigationService, _settingsService: DatabaseSettingsService, - notification: NotificationService) { - super("Database", _authService, _navigation, _settingsService, notification, s => s.Server.database); + notification: NotificationService, + i18n: I18n) { + super(i18n("Database"), _authService, _navigation, _settingsService, notification, i18n, s => s.Server.database); } ngOnInit() { diff --git a/frontend/app/settings/indexing/indexing.settings.component.html b/frontend/app/settings/indexing/indexing.settings.component.html index e910b0a..0ffe77c 100644 --- a/frontend/app/settings/indexing/indexing.settings.component.html +++ b/frontend/app/settings/indexing/indexing.settings.component.html @@ -62,7 +62,7 @@ If you would like to trigger indexing manually, click index button.
( - Note: search ony searched among the indexed directories + Note: search only works among the indexed directories )
diff --git a/frontend/app/settings/indexing/indexing.settings.component.ts b/frontend/app/settings/indexing/indexing.settings.component.ts index 63cdb0d..4b10593 100644 --- a/frontend/app/settings/indexing/indexing.settings.component.ts +++ b/frontend/app/settings/indexing/indexing.settings.component.ts @@ -8,6 +8,7 @@ import {Observable} from "rxjs/Rx"; import {IndexingConfig, ReIndexingSensitivity} from "../../../../common/config/private/IPrivateConfig"; import {SettingsComponent} from "../_abstract/abstract.settings.component"; import {Utils} from "../../../../common/Utils"; +import {I18n} from "@ngx-translate/i18n-polyfill"; @Component({ selector: 'settings-indexing', @@ -50,9 +51,10 @@ export class IndexingSettingsComponent extends SettingsComponent_settingsService, notification, s => s.Server.indexing); + super(i18n("Indexing"), _authService, _navigation, _settingsService, notification, i18n, s => s.Server.indexing); } @@ -81,7 +83,7 @@ export class IndexingSettingsComponent extends SettingsComponentthis._settingsService).cancel(); - this.notification.success("Folder indexed", "Success"); + this.notification.success(this.i18n("Folder indexed"), this.i18n("Success")); this.inProgress = false; return true; } catch (err) { @@ -119,7 +121,7 @@ export class IndexingSettingsComponent extends SettingsComponentthis._settingsService).reset(); - this.notification.success('Database reset', "Success"); + this.notification.success(this.i18n('Database reset'), this.i18n("Success")); this.inProgress = false; return true; } catch (err) { diff --git a/frontend/app/settings/map/map.settings.component.html b/frontend/app/settings/map/map.settings.component.html index 2315ecb..441144a 100644 --- a/frontend/app/settings/map/map.settings.component.html +++ b/frontend/app/settings/map/map.settings.component.html @@ -8,8 +8,8 @@ name="enabled" [switch-on-color]="'success'" [switch-inverse]="'inverse'" - [switch-off-text]="'Disabled'" - [switch-on-text]="'Enabled'" + [switch-off-text]="text.Disabled" + [switch-on-text]="text.Enabled" [switch-disabled]="inProgress" [switch-handle-width]="'100'" [switch-label-width]="'20'" diff --git a/frontend/app/settings/map/map.settings.component.ts b/frontend/app/settings/map/map.settings.component.ts index 1fe83cc..33f1dc2 100644 --- a/frontend/app/settings/map/map.settings.component.ts +++ b/frontend/app/settings/map/map.settings.component.ts @@ -5,6 +5,8 @@ import {AuthenticationService} from "../../model/network/authentication.service" import {NavigationService} from "../../model/navigation.service"; import {NotificationService} from "../../model/notification.service"; import {ClientConfig} from "../../../../common/config/public/ConfigClass"; +import {I18n} from "@ngx-translate/i18n-polyfill"; + @Component({ selector: 'settings-map', @@ -18,8 +20,9 @@ export class MapSettingsComponent extends SettingsComponent_settingsService, notification, s => s.Client.Map); + notification: NotificationService, + i18n: I18n) { + super(i18n("Map"), _authService, _navigation, _settingsService, notification, i18n, s => s.Client.Map); } diff --git a/frontend/app/settings/other/other.settings.component.html b/frontend/app/settings/other/other.settings.component.html index 135eb4a..1368664 100644 --- a/frontend/app/settings/other/other.settings.component.html +++ b/frontend/app/settings/other/other.settings.component.html @@ -16,8 +16,8 @@ name="enableThreading" [switch-on-color]="'primary'" [switch-inverse]="'inverse'" - [switch-off-text]="'Disabled'" - [switch-on-text]="'Enabled'" + [switch-off-text]="text.Disabled" + [switch-on-text]="text.Enabled" [switch-handle-width]="'100'" [switch-label-width]="'20'" [(ngModel)]="settings.enableThreading"> @@ -36,8 +36,8 @@ name="enableOnScrollThumbnailPrioritising" [switch-on-color]="'primary'" [switch-inverse]="'inverse'" - [switch-off-text]="'Disabled'" - [switch-on-text]="'Enabled'" + [switch-off-text]="text.Disabled" + [switch-on-text]="text.Enabled" [switch-handle-width]="'100'" [switch-label-width]="'20'" [(ngModel)]="settings.enableOnScrollThumbnailPrioritising"> @@ -55,8 +55,8 @@ name="enableOnScrollRendering" [switch-on-color]="'primary'" [switch-inverse]="'inverse'" - [switch-off-text]="'Disabled'" - [switch-on-text]="'Enabled'" + [switch-off-text]="text.Disabled" + [switch-on-text]="text.Enabled" [switch-handle-width]="'100'" [switch-label-width]="'20'" [(ngModel)]="settings.enableOnScrollRendering"> @@ -75,8 +75,8 @@ name="enableCache" [switch-on-color]="'primary'" [switch-inverse]="'inverse'" - [switch-off-text]="'Disabled'" - [switch-on-text]="'Enabled'" + [switch-off-text]="text.Disabled" + [switch-on-text]="text.Enabled" [switch-handle-width]="'100'" [switch-label-width]="'20'" [(ngModel)]="settings.enableCache"> diff --git a/frontend/app/settings/other/other.settings.component.ts b/frontend/app/settings/other/other.settings.component.ts index b9de4c7..9e41a90 100644 --- a/frontend/app/settings/other/other.settings.component.ts +++ b/frontend/app/settings/other/other.settings.component.ts @@ -5,6 +5,7 @@ import {NavigationService} from "../../model/navigation.service"; import {NotificationService} from "../../model/notification.service"; import {OtherSettingsService} from "./other.settings.service"; import {OtherConfigDTO} from "../../../../common/entities/settings/OtherConfigDTO"; +import {I18n} from "@ngx-translate/i18n-polyfill"; @Component({ selector: 'settings-other', @@ -18,8 +19,9 @@ export class OtherSettingsComponent extends SettingsComponent im constructor(_authService: AuthenticationService, _navigation: NavigationService, _settingsService: OtherSettingsService, - notification: NotificationService) { - super("Other", _authService, _navigation, _settingsService, notification, s => ({ + notification: NotificationService, + i18n: I18n) { + super(i18n("Other"), _authService, _navigation, _settingsService, notification, i18n, s => ({ enableThreading: s.Server.enableThreading, enableOnScrollThumbnailPrioritising: s.Client.enableOnScrollThumbnailPrioritising, enableOnScrollRendering: s.Client.enableOnScrollRendering, @@ -36,7 +38,7 @@ export class OtherSettingsComponent extends SettingsComponent im const val = await super.save(); if (val == true) { - this.notification.info('Restart the server to apply the new settings', "Info"); + this.notification.info(this.i18n('Restart the server to apply the new settings'), this.i18n("Info")); } return val; } diff --git a/frontend/app/settings/search/search.settings.component.html b/frontend/app/settings/search/search.settings.component.html index e1b3b31..f172dd3 100644 --- a/frontend/app/settings/search/search.settings.component.html +++ b/frontend/app/settings/search/search.settings.component.html @@ -9,8 +9,8 @@ name="enabled" [switch-on-color]="'success'" [switch-inverse]="'inverse'" - [switch-off-text]="'Disabled'" - [switch-on-text]="'Enabled'" + [switch-off-text]="text.Disabled" + [switch-on-text]="text.Enabled" [switch-disabled]="inProgress || (!settings.enabled && !_settingsService.isSupported())" [switch-handle-width]="'100'" [switch-label-width]="'20'" @@ -33,8 +33,8 @@ [switch-on-color]="'primary'" [switch-disabled]="!settings.enabled" [switch-inverse]="'inverse'" - [switch-off-text]="'Disabled'" - [switch-on-text]="'Enabled'" + [switch-off-text]="text.Disabled" + [switch-on-text]="text.Enabled" [switch-handle-width]="'100'" [switch-label-width]="'20'" [(ngModel)]="settings.autocompleteEnabled"> @@ -54,8 +54,8 @@ [switch-on-color]="'primary'" [switch-disabled]="!settings.enabled" [switch-inverse]="'inverse'" - [switch-off-text]="'Disabled'" - [switch-on-text]="'Enabled'" + [switch-off-text]="text.Disabled" + [switch-on-text]="text.Enabled" [switch-handle-width]="'100'" [switch-label-width]="'20'" [(ngModel)]="settings.instantSearchEnabled"> diff --git a/frontend/app/settings/search/search.settings.component.ts b/frontend/app/settings/search/search.settings.component.ts index 1006dcd..a178fbd 100644 --- a/frontend/app/settings/search/search.settings.component.ts +++ b/frontend/app/settings/search/search.settings.component.ts @@ -5,6 +5,7 @@ import {NavigationService} from "../../model/navigation.service"; import {NotificationService} from "../../model/notification.service"; import {ClientConfig} from "../../../../common/config/public/ConfigClass"; import {SearchSettingsService} from "./search.settings.service"; +import {I18n} from "@ngx-translate/i18n-polyfill"; @Component({ selector: 'settings-search', @@ -18,8 +19,9 @@ export class SearchSettingsComponent extends SettingsComponent s.Client.Search); + notification: NotificationService, + i18n: I18n) { + super(i18n("Search"), _authService, _navigation, _settingsService, notification, i18n, s => s.Client.Search); } diff --git a/frontend/app/settings/share/share.settings.component.html b/frontend/app/settings/share/share.settings.component.html index 5522a3e..87fe9c0 100644 --- a/frontend/app/settings/share/share.settings.component.html +++ b/frontend/app/settings/share/share.settings.component.html @@ -9,8 +9,8 @@ name="enabled" [switch-on-color]="'success'" [switch-inverse]="'inverse'" - [switch-off-text]="'Disabled'" - [switch-on-text]="'Enabled'" + [switch-off-text]="text.Disabled" + [switch-on-text]="text.Enabled" [switch-disabled]="inProgress || (!settings.enabled && !_settingsService.isSupported())" [switch-handle-width]="'100'" [switch-label-width]="'20'" @@ -32,8 +32,8 @@ [switch-on-color]="'primary'" [switch-disabled]="!settings.enabled" [switch-inverse]="'inverse'" - [switch-off-text]="'Disabled'" - [switch-on-text]="'Enabled'" + [switch-off-text]="text.Disabled" + [switch-on-text]="text.Enabled" [switch-handle-width]="'100'" [switch-label-width]="'20'" [(ngModel)]="settings.passwordProtected"> diff --git a/frontend/app/settings/share/share.settings.component.ts b/frontend/app/settings/share/share.settings.component.ts index 5a07b54..8bb0ad2 100644 --- a/frontend/app/settings/share/share.settings.component.ts +++ b/frontend/app/settings/share/share.settings.component.ts @@ -5,6 +5,7 @@ import {NavigationService} from "../../model/navigation.service"; import {NotificationService} from "../../model/notification.service"; import {ClientConfig} from "../../../../common/config/public/ConfigClass"; import {ShareSettingsService} from "./share.settings.service"; +import {I18n} from "@ngx-translate/i18n-polyfill"; @Component({ selector: 'settings-share', @@ -18,8 +19,9 @@ export class ShareSettingsComponent extends SettingsComponent s.Client.Sharing); + notification: NotificationService, + i18n: I18n) { + super(i18n("Share"), _authService, _navigation, _settingsService, notification, i18n, s => s.Client.Sharing); } diff --git a/frontend/app/settings/thumbnail/thumbanil.settings.component.html b/frontend/app/settings/thumbnail/thumbanil.settings.component.html index 151ebca..1867da6 100644 --- a/frontend/app/settings/thumbnail/thumbanil.settings.component.html +++ b/frontend/app/settings/thumbnail/thumbanil.settings.component.html @@ -49,8 +49,8 @@ name="enabled" [switch-on-color]="'primary'" [switch-inverse]="'inverse'" - [switch-off-text]="'Low'" - [switch-on-text]="'High'" + [switch-off-text]="text.Low" + [switch-on-text]="text.High" [switch-handle-width]="'100'" [switch-label-width]="'20'" [(ngModel)]="settings.server.qualityPriority"> diff --git a/frontend/app/settings/thumbnail/thumbanil.settings.component.ts b/frontend/app/settings/thumbnail/thumbanil.settings.component.ts index 4a5ed5d..0ca4067 100644 --- a/frontend/app/settings/thumbnail/thumbanil.settings.component.ts +++ b/frontend/app/settings/thumbnail/thumbanil.settings.component.ts @@ -7,6 +7,7 @@ import {ThumbnailConfig, ThumbnailProcessingLib} from "../../../../common/config import {ClientConfig} from "../../../../common/config/public/ConfigClass"; import {ThumbnailSettingsService} from "./thumbanil.settings.service"; import {Utils} from "../../../../common/Utils"; +import {I18n} from "@ngx-translate/i18n-polyfill"; @Component({ selector: 'settings-thumbnail', @@ -22,8 +23,9 @@ export class ThumbnailSettingsComponent extends SettingsComponent<{ server: Thum constructor(_authService: AuthenticationService, _navigation: NavigationService, _settingsService: ThumbnailSettingsService, - notification: NotificationService) { - super("Thumbnail", _authService, _navigation, _settingsService, notification, s => ({ + notification: NotificationService, + i18n: I18n) { + super(i18n("Thumbnail"), _authService, _navigation, _settingsService, notification, i18n, s => ({ client: s.Client.Thumbnail, server: s.Server.thumbnail })); @@ -44,7 +46,7 @@ export class ThumbnailSettingsComponent extends SettingsComponent<{ server: Thum this.types = Utils .enumToArray(ThumbnailProcessingLib).map((v) => { if (v.value.toLowerCase() == "sharp") { - v.value += " (recommended)"; + v.value += " " + this.i18n("(recommended)"); } return v; }); diff --git a/frontend/app/settings/usermanager/usermanager.settings.component.html b/frontend/app/settings/usermanager/usermanager.settings.component.html index f20fefe..50cf828 100644 --- a/frontend/app/settings/usermanager/usermanager.settings.component.html +++ b/frontend/app/settings/usermanager/usermanager.settings.component.html @@ -7,8 +7,8 @@ name="enabled" [switch-on-color]="'success'" [switch-inverse]="'inverse'" - [switch-off-text]="'Disabled'" - [switch-on-text]="'Enabled'" + [switch-off-text]="text.Disabled" + [switch-on-text]="text.Enabled" [switch-handle-width]="'100'" [switch-label-width]="'20'" [switch-disabled]="inProgress" diff --git a/frontend/app/settings/usermanager/usermanager.settings.component.ts b/frontend/app/settings/usermanager/usermanager.settings.component.ts index fc056c2..5a677cb 100644 --- a/frontend/app/settings/usermanager/usermanager.settings.component.ts +++ b/frontend/app/settings/usermanager/usermanager.settings.component.ts @@ -7,6 +7,7 @@ import {ModalDirective} from "ngx-bootstrap/modal"; import {NavigationService} from "../../model/navigation.service"; import {NotificationService} from "../../model/notification.service"; import {ErrorCodes, ErrorDTO} from "../../../../common/entities/Error"; +import {I18n} from "@ngx-translate/i18n-polyfill"; @Component({ selector: 'settings-usermanager', @@ -24,10 +25,24 @@ export class UserMangerSettingsComponent implements OnInit { public error: string = null; public inProgress = false; + + text = { + Enabled: "Enabled", + Disabled: "Disabled", + Low: "Low", + High: "High" + }; + + constructor(private _authService: AuthenticationService, private _navigation: NavigationService, private _userSettings: UserManagerSettingsService, - private notification: NotificationService) { + private notification: NotificationService, + public i18n: I18n) { + this.text.Enabled = i18n("Enabled"); + this.text.Disabled = i18n("Disabled"); + this.text.Low = i18n("Low"); + this.text.High = i18n("High"); } @@ -103,10 +118,10 @@ export class UserMangerSettingsComponent implements OnInit { await this._userSettings.updateSettings(this.enabled); await this.getSettings(); if (this.enabled == true) { - this.notification.success('Password protection enabled', "Success"); + this.notification.success(this.i18n('Password protection enabled'), this.i18n("Success")); this.getUsersList(); } else { - this.notification.success('Password protection disabled', "Success"); + this.notification.success(this.i18n('Password protection disabled'), this.i18n("Success")); } } catch (err) { console.log(err); diff --git a/frontend/locale/messages.hu.xlf b/frontend/translate/messages.hu.xlf similarity index 70% rename from frontend/locale/messages.hu.xlf rename to frontend/translate/messages.hu.xlf index 15a04bd..1903733 100644 --- a/frontend/locale/messages.hu.xlf +++ b/frontend/translate/messages.hu.xlf @@ -18,7 +18,7 @@ app/login/login.component.ts 13 - Hibás felhasználónév vagy jelszó + Rossz felhasználónév vagy jelszó Username @@ -50,6 +50,10 @@ app/gallery/share/share.gallery.component.ts 67 + + app/gallery/share/share.gallery.component.ts + 78 + app/settings/usermanager/usermanager.settings.component.ts 79 @@ -66,7 +70,7 @@ app/login/login.component.ts 42 - Jegyezzen meg + Emlékezz rám Login @@ -85,7 +89,7 @@ app/sharelogin/share-login.component.ts 13 - Hibás jelszó + Rossz jelszó Enter @@ -96,6 +100,58 @@ Belépés + + download + + app/gallery/lightbox/lightbox.gallery.component.ts + 23 + + letöltés + + + info + + app/gallery/lightbox/lightbox.gallery.component.ts + 26 + + info + + + toggle fullscreen + + app/gallery/lightbox/lightbox.gallery.component.ts + 30 + + + app/gallery/lightbox/lightbox.gallery.component.ts + 34 + + teljes képernyőre váltás + + + close + + app/gallery/lightbox/lightbox.gallery.component.ts + 36 + + bezárás + + + key: left arrow + + app/gallery/lightbox/lightbox.gallery.component.ts + 40 + + billentyű: balra nyíl + + + key: right arrow + + app/gallery/lightbox/lightbox.gallery.component.ts + 44 + + billentyű: jobbra nyíl + Search @@ -110,7 +166,7 @@ app/gallery/gallery.component.ts 8 - Link érvényes + Link elérhetősége days @@ -118,7 +174,7 @@ app/gallery/gallery.component.ts 10 - nap + napok @@ -128,7 +184,7 @@ app/gallery/gallery.component.ts 39 - Túl sok találat. Pontosítsd a keresést. + Túl sok eredmény jelenik meg. Pontosítsa a keresést. Searching for: @@ -165,7 +221,7 @@ app/gallery/share/share.gallery.component.ts 34 - Másolás + Másolat Sharing: @@ -173,7 +229,7 @@ app/gallery/share/share.gallery.component.ts 41 - Megosztás: + megosztás: Include subfolders: @@ -181,13 +237,13 @@ app/gallery/share/share.gallery.component.ts 52 - Alkönyvtárakat is: + Alkönyvtárak beillesztése: Valid: app/gallery/share/share.gallery.component.ts - 82 + 84 Érvényes: @@ -195,33 +251,33 @@ Minutes app/gallery/share/share.gallery.component.ts - 92 + 94 - Perc + Percek Hours app/gallery/share/share.gallery.component.ts - 93 + 95 - Óra + Órák Days app/gallery/share/share.gallery.component.ts - 94 + 96 - Nap + Napok Months app/gallery/share/share.gallery.component.ts - 95 + 97 - Hónap + hónapok Server notifications @@ -239,7 +295,7 @@ app/admin/admin.component.ts 19 - Az ilyen értesítések elütetéséhez indítsd újra a az alkalmazást. + Az ilyen értesítések elutasításához indítsa újra a kiszolgálót. Mode @@ -263,7 +319,7 @@ app/settings/usermanager/usermanager.settings.component.ts 3 - Jelszavas védelem + Jelszó védelem Name @@ -279,7 +335,7 @@ app/settings/usermanager/usermanager.settings.component.ts 28 - Jogkör + Szerep + Add user @@ -288,7 +344,7 @@ app/settings/usermanager/usermanager.settings.component.ts 55 - + Felhasználó hozzáadása + + Felhasználó felvétele @@ -298,7 +354,7 @@ app/settings/usermanager/usermanager.settings.component.ts 58 - A webhely jelszóval legyen védve / be kelljen jelentkezni + A webhely jelszóval való védelme / a bejelentkezés engedélyezi ezt. Add new User @@ -347,7 +403,7 @@ app/settings/database/database.settings.component.ts 14 - Telepítsd kézzel mysql node-modult a mysql (npm install mysql) használatához + Telepítsd kézzel mysql csomópont-modulot a mysql (npm install mysql) használatához MySQL settings: @@ -363,7 +419,7 @@ app/settings/database/database.settings.component.ts 18 - Cím + Házigazda Database @@ -413,7 +469,7 @@ app/settings/map/map.settings.component.ts 25 - Google maps api key + A Google térképek api kulcsot tartalmaznak To show the images on a map, @@ -421,7 +477,7 @@ app/settings/map/map.settings.component.ts 31 - Ahhoz, hogy a térképen megjelenjenek a képek + A képek megjelenítéséhez térképen, google api key @@ -429,7 +485,7 @@ app/settings/map/map.settings.component.ts 32 - google api key-re + google api kulcs is need @@ -437,7 +493,7 @@ app/settings/map/map.settings.component.ts 33 - van szükség + szükség van Save @@ -503,7 +559,7 @@ app/settings/thumbnail/thumbanil.settings.component.ts 4 - Thumbnail beállítások + Miniatűr beállítások It is highly recommended to use hardware accelerated (sharp or gm) lib for thumbnail @@ -522,7 +578,7 @@ app/settings/thumbnail/thumbanil.settings.component.ts 16 - Thumbnail generáló könyvtár + Thumbnail generációs könyvtár Make sure that sharp node module is installed (npm install sharp). @@ -530,7 +586,7 @@ app/settings/thumbnail/thumbanil.settings.component.ts 24 - Győződj meg arról, hogy a sharp node modul telepítve van (npm telepítés sharp). + Győződjön meg arról, hogy az éles csomópont modul telepítve van (npm telepítés éles). Make sure that gm node module and @@ -538,7 +594,7 @@ app/settings/thumbnail/thumbanil.settings.component.ts 26 - Győződjd meg arról, hogy a gm node modul és + Győződjön meg róla, hogy a gm csomópont modul és GraphicsMagick @@ -570,7 +626,7 @@ app/settings/thumbnail/thumbanil.settings.component.ts 39 - A thumbnail-ek ebben a mappában lesznek elmentve. Írási jog szükséges + A miniatűrök ebben a mappában lesznek elmentve. Íráshoz való hozzáférés szükséges Thumbnail Quality @@ -578,7 +634,7 @@ app/settings/thumbnail/thumbanil.settings.component.ts 44 - Thumbnail minőség + Thumbnail Quality High quality may be slow. Especially with Jimp. @@ -586,7 +642,7 @@ app/settings/thumbnail/thumbanil.settings.component.ts 58 - A jó minőségű lassú lehet. Különösen a Jimp esetén. + A jó minőségű lehet lassú. Különösen a Jimp. Icon size (used on maps) @@ -610,7 +666,7 @@ app/settings/thumbnail/thumbanil.settings.component.ts 86 - A thumbnail mérete. + A bélyegképek mérete. The best matching size will be generated. (More size gives better quality, but use storage to store and CPU to render.) @@ -618,7 +674,7 @@ app/settings/thumbnail/thumbanil.settings.component.ts 87 - A legjobban egyezett méret lesz generálva. (Több méret lehetőség jobb minőségéet eredményez, de processzort és tárhelyet fogyaszt) + A legjobb egyezési méret keletkezik. (A nagyobb méret jobb minőségű, de tárolja a tárolást és a processzort a megjelenítéshez.) ';' separated integers. If size is 200, tha thumbnail will have 200^2 pixels. @@ -626,7 +682,7 @@ app/settings/thumbnail/thumbanil.settings.component.ts 89 - ';'-val elválasztott egész számok. Ha a méret 200, akkor a thumnail-ok 200^2 pixelből fognak állni. + ';' elválasztott egész számok. Ha a méret 200, akkor a bélyegképnek 200 ^ 2 képpontja lesz. Search settings @@ -642,7 +698,7 @@ app/settings/search/search.settings.component.ts 27 - Automatikus kiegészítés + Autocomplete Show hints while typing search query @@ -650,7 +706,7 @@ app/settings/search/search.settings.component.ts 42 - Kersési javaslatok megjelenítése a keresési szöveg beírása közben + Tippek felajánlása a keresés gépelése közben Instant search @@ -658,7 +714,7 @@ app/settings/search/search.settings.component.ts 48 - Azonnali (instant) keresés + Instant keresés Enables showing search results, while typing search query @@ -666,7 +722,7 @@ app/settings/search/search.settings.component.ts 63 - Lehetővé teszi a keresési eredmények megjelenítését a keresés beírása közben + Lehetővé teszi a keresési eredmények megjelenítését a keresési lekérdezés beírása közben @@ -684,7 +740,7 @@ app/settings/share/share.settings.component.ts 5 - Megosztási bállítások + Megosztási beállítások Password protected @@ -700,7 +756,7 @@ app/settings/share/share.settings.component.ts 41 - Jelszóval védi a megoszott linkeket. + Engedélyezi a jelszóval védett megosztást @@ -718,7 +774,7 @@ app/settings/basic/basic.settings.component.ts 4 - Egyszerű beállítások + Alapvető beállítások Page title @@ -726,7 +782,7 @@ app/settings/basic/basic.settings.component.ts 11 - Oldal cím + Oldal címe Port number. Port 80 is usually what you need. @@ -742,7 +798,7 @@ app/settings/basic/basic.settings.component.ts 40 - A képeket ebből a mappából tölti be (olvasási engedély szükséges) + A képek a mappából töltődnek be (olvasási engedély szükséges a mappára) Page public url @@ -750,7 +806,7 @@ app/settings/basic/basic.settings.component.ts 45 - Oldal nyilvános urlje (webcím) + Oldal nyilvános url-je If you access the page form local network its good to know the public url for creating sharing link @@ -758,7 +814,7 @@ app/settings/basic/basic.settings.component.ts 51 - Ha helyi hálózatról nézed az oldalt, jó ha tudja az oldal a publikus címét, hogy tudjon megosztási linket generálni + Ha belső hálózatról nézed oldalt, jó tudni a nyilvános URL-t, a megosztási link létrehozásához Other settings @@ -782,7 +838,7 @@ app/settings/other/other.settings.component.ts 11 - Háttérszálon futtatás + Többszálas működés Runs directory scanning and thumbnail generation (only for Jimp) in a different thread @@ -790,7 +846,7 @@ app/settings/other/other.settings.component.ts 25 - Könyvtrá indexelést és thumnail generálást (csak Jimp esetén) háttérszálon futtatja. + A konytár szkennelések és az indexkép generálás (csak Jimp esetén) háttérszálon fut Scroll based thumbnail @@ -799,8 +855,8 @@ app/settings/other/other.settings.component.ts 30 - Scroll-ozás alapú thumbnail -          generálás + Görgetés alapú kirajzolás + Those thumbnails get higher priority that are visible on the screen @@ -808,7 +864,7 @@ app/settings/other/other.settings.component.ts 45 - A képernyőn látható thumnailek nagyobb prioritással generálódnak + Ezek a thumbnail-ek nagyobb prioritást kapnak, amelyek láthatóak a képernyőn Lazy image rendering @@ -816,7 +872,7 @@ app/settings/other/other.settings.component.ts 50 - Lazy kép megjelenítés + 'Lazy' kép megjelenítés Shows only the required amount of photos at once. Renders more if page bottom is reached @@ -824,7 +880,7 @@ app/settings/other/other.settings.component.ts 64 - Csak a szükséges mennyiségű fotót jeleníti meg egyszerre. újabbakat tölt be, ha elérte az oldal alját + Csak a szükséges mennyiségű fotót jeleníti meg egyszerre. Újebb képeket mutat, ha elérte az oldal alját Cache @@ -832,7 +888,7 @@ app/settings/other/other.settings.component.ts 70 - gyorsítótár + Gyorsítótár Caches directory contents and search results for better performance @@ -840,7 +896,7 @@ app/settings/other/other.settings.component.ts 84 - Cach-eli a könyvtár tartalmát és a keresési eredményeket, hogy responzívabb legyen az oldal + Gyorsítótárazza a könyvtár tartalmát és a keresési eredményeket a jobb teljesítmény érdekében Folder indexing @@ -856,7 +912,7 @@ app/settings/indexing/indexing.settings.component.ts 11 - Index cache timeout [ms] + Index cache időtúllépés [ms] If there was no indexing in this time, it reindexes. (skipped if indexen in DB and sensitivity is low) @@ -864,7 +920,7 @@ app/settings/indexing/indexing.settings.component.ts 19 - Ha ennyi ideje nem volt indexelés, újraindexeli a könyvtárat. (kivéve, ha a DB index és az érzékenység alacsony) + Ha ebben az időben nem volt indexelés, újraindexet hajt végre. (kivéve, ha a DB index és az érzékenység alacsony) Sub folder preview size @@ -872,7 +928,7 @@ app/settings/indexing/indexing.settings.component.ts 23 - Alkönyvtár előnézet mérete + Alkönyvtár előnézeti mérete Reads this many photos from sub folders @@ -880,7 +936,7 @@ app/settings/indexing/indexing.settings.component.ts 31 - Ennyi fotót olvas be az alkönytárból + Ennyi fotót olvas be az almappákból (ezek közül választ az oldal amikor mappához képet rendel) Folder reindexing sensitivity @@ -888,7 +944,7 @@ app/settings/indexing/indexing.settings.component.ts 36 - Folder újra indeyelés érzékenysége + Folder reindexing érzékenység Set the reindexing sensitivity. High value check the folders for change more often @@ -896,7 +952,7 @@ app/settings/indexing/indexing.settings.component.ts 45 - Állítsa be az újraindexelés érzékenységét. A magasabb érzékenység gyarkabban ellenőrzi a mappákat válztozás + Állítsa be az újraindexelés érzékenységét. Nagyob értékenység gyakrabban vizsgálja mappákat Save @@ -933,12 +989,12 @@ Ha kézzel szeretné indítani az indexelést, kattintson az index gombra. - Note: search ony searched among the indexed directories + Note: search only works among the indexed directories app/settings/indexing/indexing.settings.component.ts 65 - Megjegyzés: a keresés csak az indexelet mappákban működik + Megjegyzés: csak az indexelt könyvtárak között működik a keresés Index @@ -965,7 +1021,239 @@ app/settings/indexing/indexing.settings.component.ts 97 - Indexek törlése + Indexek visszaállítása + + + Advanced + + frontend/app/admin/admin.component.ts + 1 + + Részletes + + + Simplified + + frontend/app/admin/admin.component.ts + 1 + + Egyszerűsített + + + Images + + frontend/app/gallery/navigator/navigator.gallery.component.ts + 1 + + + frontend/app/gallery/navigator/navigator.gallery.component.ts + 1 + + képek + + + Url has been copied to clipboard + + frontend/app/gallery/share/share.gallery.component.ts + 1 + + Az URL-t a vágólapon + + + Server error + + frontend/app/model/notification.service.ts + 1 + + + frontend/app/model/notification.service.ts + 1 + + Szerver hiba + + + Server info + + frontend/app/model/notification.service.ts + 1 + + Szerverinformáció + + + Enabled + + frontend/app/settings/_abstract/abstract.settings.component.ts + 1 + + + frontend/app/settings/usermanager/usermanager.settings.component.ts + 1 + + Engedélyezve + + + Disabled + + frontend/app/settings/_abstract/abstract.settings.component.ts + 1 + + + frontend/app/settings/usermanager/usermanager.settings.component.ts + 1 + + Tiltva + + + Low + + frontend/app/settings/_abstract/abstract.settings.component.ts + 1 + + + frontend/app/settings/usermanager/usermanager.settings.component.ts + 1 + + Alacsony + + + High + + frontend/app/settings/_abstract/abstract.settings.component.ts + 1 + + + frontend/app/settings/usermanager/usermanager.settings.component.ts + 1 + + Magas + + + settings saved + + frontend/app/settings/_abstract/abstract.settings.component.ts + 1 + + beállítások elmentve + + + Success + + frontend/app/settings/_abstract/abstract.settings.component.ts + 1 + + + frontend/app/settings/indexing/indexing.settings.component.ts + 1 + + + frontend/app/settings/indexing/indexing.settings.component.ts + 1 + + + frontend/app/settings/indexing/indexing.settings.component.ts + 1 + + + frontend/app/settings/usermanager/usermanager.settings.component.ts + 1 + + + frontend/app/settings/usermanager/usermanager.settings.component.ts + 1 + + Siker + + + Basic + + frontend/app/settings/basic/basic.settings.component.ts + 1 + + Alapvető + + + Indexing + + frontend/app/settings/indexing/indexing.settings.component.ts + 1 + + Indexelés + + + Folder indexed + + frontend/app/settings/indexing/indexing.settings.component.ts + 1 + + + frontend/app/settings/indexing/indexing.settings.component.ts + 1 + + Mappa indexelve + + + Database reset + + frontend/app/settings/indexing/indexing.settings.component.ts + 1 + + Adatbázis visszaállítása + + + Map + + frontend/app/settings/map/map.settings.component.ts + 1 + + Térkép + + + Other + + frontend/app/settings/other/other.settings.component.ts + 1 + + Más + + + Restart the server to apply the new settings + + frontend/app/settings/other/other.settings.component.ts + 1 + + Indítsa újra a weboldalt az új beállítások alkalmazásához + + + Thumbnail + + frontend/app/settings/thumbnail/thumbanil.settings.component.ts + 1 + + Thumbnail + + + (recommended) + + frontend/app/settings/thumbnail/thumbanil.settings.component.ts + 1 + + (ajánlott) + + + Password protection enabled + + frontend/app/settings/usermanager/usermanager.settings.component.ts + 1 + + Jelszavas védelem engedélyezve + + + Password protection disabled + + frontend/app/settings/usermanager/usermanager.settings.component.ts + 1 + + Jelszavas védelem tiltva diff --git a/gulpfile.js b/gulpfile.js index b927d30..ed1be6c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,6 +6,7 @@ var runSequence = require('run-sequence'); var jsonModify = require('gulp-json-modify'); var exec = require('child_process').exec; +var translationFolder = "translate"; var tsBackendProject = ts.createProject('tsconfig.json'); gulp.task('build-backend', function () { return gulp.src([ @@ -16,9 +17,8 @@ gulp.task('build-backend', function () { .pipe(gulp.dest("./release")) }); -var createFornendTask = function (tpye, script) { - //console.log(tpye, script); - gulp.task(tpye, function (cb) { +var createFrontendTask = function (type, script) { + gulp.task(type, function (cb) { exec(script, function (err, stdout, stderr) { console.log(stdout); console.log(stderr); @@ -28,18 +28,13 @@ var createFornendTask = function (tpye, script) { }; gulp.task('build-frontend', function (done) { - var dirCont = fs.readdirSync("./frontend/locale"); - var files = dirCont.filter(function (elm) { - return elm.match(/.*\.[a-zA-Z]+\.(xlf)/ig); - }); - var languages = files.map(function (f) { - return f.split(".")[1] - }); + var languages = getLanguages(); var tasks = []; - createFornendTask('build-frontend-release default', "ng build --aot -prod --output-path=./release/dist --no-progress"); + createFrontendTask('build-frontend-release default', "ng build --aot -prod --output-path=./release/dist --no-progress"); tasks.push('build-frontend-release default'); - for (var i = 0; i < files.length; i++) { - createFornendTask('build-frontend-release ' + languages[i], "ng build --aot -prod --output-path=./release/dist/" + languages[i] + " --no-progress --locale=" + languages[i] + " --i18n-format xlf --i18n-file frontend/locale/" + files[i] + " --missing-translation warning"); + for (var i = 0; i < languages.length; i++) { + createFrontendTask('build-frontend-release ' + languages[i], "ng build --aot -prod --output-path=./release/dist/" + languages[i] + " --no-progress --locale=" + languages[i] + + " --i18n-format xlf --i18n-file frontend/" + translationFolder + "/messages." + languages[i] + ".xlf" + " --missing-translation warning"); tasks.push('build-frontend-release ' + languages[i]); } tasks.push(function () { @@ -84,24 +79,32 @@ gulp.task('build-release', function (done) { }); }); +var getLanguages = function () { + if (!fs.existsSync("./frontend/" + translationFolder)) { + return []; + } + var dirCont = fs.readdirSync("./frontend/" + translationFolder); + var files = dirCont.filter(function (elm) { + return elm.match(/.*\.[a-zA-Z]+\.(xlf)/ig); + }); + return files.map(function (f) { + return f.split(".")[1] + }); +}; + var simpleBuild = function (isProd) { return function (done) { - var dirCont = fs.readdirSync("./frontend/locale"); - var files = dirCont.filter(function (elm) { - return elm.match(/.*\.[a-zA-Z]+\.(xlf)/ig); - }); - var languages = files.map(function (f) { - return f.split(".")[1] - }); + var languages = getLanguages(); var tasks = []; var cmd = "ng build "; if (isProd) { cmd += " -prod " } - createFornendTask('build-frontend default', cmd + "--output-path=./dist --no-progress"); + createFrontendTask('build-frontend default', cmd + "--output-path=./dist --no-progress"); tasks.push('build-frontend default'); - for (var i = 0; i < files.length; i++) { - createFornendTask('build-frontend ' + languages[i], cmd + "--output-path=./dist/" + languages[i] + " --no-progress --locale " + languages[i] + " --i18n-format=xlf --i18n-file=frontend/locale/" + files[i] + " --missing-translation warning"); + for (var i = 0; i < languages.length; i++) { + createFrontendTask('build-frontend ' + languages[i], cmd + "--output-path=./dist/" + languages[i] + " --no-progress --locale " + languages[i] + + " --i18n-format=xlf --i18n-file=frontend/" + translationFolder + "/messages." + languages[i] + ".xlf" + " --missing-translation warning"); tasks.push('build-frontend ' + languages[i]); } tasks.push(function () { @@ -112,5 +115,70 @@ var simpleBuild = function (isProd) { }; }; +gulp.task("extract-locale", function (cb) { + console.log("creating source translation file: locale.source.xlf"); + exec('ng xi18n -of ./../locale.source.xlf -f xlf --locale en', function (err, stdout, stderr) { + console.log(stdout); + console.log(stderr); + if (err) { + return cb(err); + } + exec('ngx-extractor -i frontend/**/*.ts -f xlf -o locale.source.xlf', function (err, stdout, stderr) { + console.log(stdout); + console.log(stderr); + cb(err); + }); + }); +}); + +var translate = function (list, cb) { + var localsStr = '"[\\"' + list.join('\\",\\"') + '\\"]"'; + console.log(localsStr); + exec('xlf-google-translate --source-lang="en" --source-file="./locale.source.xlf" --destination-folder="./frontend/"' + + translationFolder + ' --destination-languages=' + localsStr, function (err, stdout, stderr) { + console.log(stdout); + console.log(stderr); + cb(err); + }); +}; + +gulp.task("update-translation-only", function (cb) { + translate(getLanguages(), cb) +}); + +gulp.task("update-translation", function (done) { + runSequence('extract-locale', 'update-translation-only', function () { + done(); + }); +}); + + +gulp.task("add-translation-only", function (cb) { + var languages = getLanguages(); + var lng = null; + for (var i = 0; i < process.argv.length - 1; i++) { + if (process.argv[i] === "add-translation") { + lng = process.argv[i + 1].replace("--", ""); + } + } + if (lng == null) { + console.error("Error: set language with '--' e.g: npm run add-translation -- --en"); + return cb(); + } + if (languages.indexOf(lng) !== -1) { + console.error("Error: language already exists, can't add. These language(s) already exist(s): " + languages); + return cb(); + } + translate([lng], cb) +}); + + +gulp.task("add-translation", function (done) { + runSequence('extract-locale', 'add-translation-only', function () { + done(); + }); +}); + + gulp.task('build-dev', simpleBuild(false)); gulp.task('build-prod', simpleBuild(true)); diff --git a/package.json b/package.json index d6eecec..015c71f 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,9 @@ "ng": "ng", "lint": "ng lint", "e2e": "ng e2e", - "build-hu": "ng build --aot --output-path=./dist/hu --locale hu --i18n-format xlf --i18n-file frontend/locale/messages.hu.xlf --missing-translation warning" + "build-hu": "ng build --aot --output-path=./dist/hu --locale hu --i18n-format xlf --i18n-file frontend/locale/messages.hu.xlf --missing-translation warning", + "update-translation": "gulp update-translation", + "add-translation": "gulp add-translation" }, "repository": { "type": "git", @@ -30,88 +32,90 @@ "body-parser": "1.18.2", "cookie-parser": "^1.4.3", "cookie-session": "2.0.0-beta.3", - "ejs": "2.5.7", - "express": "4.16.2", + "ejs": "2.5.8", + "express": "4.16.3", "jimp": "0.2.28", "locale": "0.1.0", "mysql": "2.15.0", "reflect-metadata": "0.1.12", - "sqlite3": "3.1.13", + "sqlite3": "4.0.0", "ts-exif-parser": "0.1.23", "ts-node-iptc": "1.0.9", "typeconfig": "1.0.6", - "typeorm": "0.1.11", - "winston": "2.4.0" + "typeorm": "0.1.19", + "winston": "2.4.1" }, "devDependencies": { "@agm/core": "^1.0.0-beta.2", - "@angular/animations": "^5.2.2", - "@angular/cli": "1.6.6", - "@angular/common": "~5.2.2", - "@angular/compiler": "~5.2.2", - "@angular/compiler-cli": "^5.2.2", - "@angular/core": "~5.2.2", - "@angular/forms": "~5.2.2", - "@angular/http": "~5.2.2", - "@angular/language-service": "^5.2.2", - "@angular/platform-browser": "~5.2.2", - "@angular/platform-browser-dynamic": "~5.2.2", - "@angular/router": "~5.2.2", + "@angular/animations": "^5.2.9", + "@angular/cli": "1.7.3", + "@angular/common": "~5.2.9", + "@angular/compiler": "~5.2.9", + "@angular/compiler-cli": "^5.2.9", + "@angular/core": "~5.2.9", + "@angular/forms": "~5.2.9", + "@angular/http": "~5.2.9", + "@angular/language-service": "^5.2.9", + "@angular/platform-browser": "~5.2.9", + "@angular/platform-browser-dynamic": "~5.2.9", + "@angular/router": "~5.2.9", + "@ngx-translate/i18n-polyfill": "^0.1.2", "@types/bcryptjs": "^2.4.1", "@types/chai": "^4.1.2", "@types/cookie-session": "^2.0.34", - "@types/express": "^4.11.0", + "@types/express": "^4.11.1", "@types/gm": "^1.17.33", "@types/jasmine": "^2.8.6", "@types/jimp": "^0.2.28", - "@types/node": "^9.4.0", - "@types/sharp": "^0.17.6", - "@types/winston": "^2.3.7", - "bootstrap": "^3.3.7", + "@types/node": "^9.6.1", + "@types/sharp": "^0.17.7", + "@types/winston": "^2.3.8", + "bootstrap": "3.3.7", "chai": "^4.1.2", - "codelyzer": "~4.1.0", - "core-js": "^2.5.3", - "ejs-loader": "^0.3.0", + "codelyzer": "~4.2.1", + "core-js": "^2.5.4", + "ejs-loader": "^0.3.1", "gulp": "^3.9.1", "gulp-json-modify": "^1.0.2", - "gulp-typescript": "^4.0.0-alpha.1", + "gulp-typescript": "^4.0.2", "gulp-zip": "^4.1.0", "hammerjs": "^2.0.8", "intl": "^1.2.5", - "jasmine-core": "^2.9.1", + "jasmine-core": "^3.1.0", "jasmine-spec-reporter": "~4.2.1", "jw-bootstrap-switch-ng2": "1.0.10", "karma": "^2.0.0", "karma-cli": "^1.0.1", - "karma-coverage-istanbul-reporter": "^1.4.1", + "karma-coverage-istanbul-reporter": "^1.4.2", "karma-jasmine": "^1.1.1", - "karma-jasmine-html-reporter": "^0.2.2", + "karma-jasmine-html-reporter": "^1.0.0", "karma-phantomjs-launcher": "^1.0.4", "karma-remap-istanbul": "^0.6.0", "karma-systemjs": "^0.16.0", "merge2": "^1.2.1", - "mocha": "^5.0.0", + "mocha": "^5.0.5", "ng2-cookies": "^1.0.12", "ng2-slim-loading-bar": "^4.0.0", "ng2-toastr": "^4.1.2", - "ngx-bootstrap": "^2.0.2", - "ngx-clipboard": "^9.1.3", + "ngx-bootstrap": "^2.0.3", + "ngx-clipboard": "^10.0.0", "phantomjs-prebuilt": "^2.1.16", "protractor": "^5.3.0", - "remap-istanbul": "^0.10.1", + "remap-istanbul": "^0.11.0", "rimraf": "^2.6.2", "run-sequence": "^2.2.1", - "rxjs": "^5.5.6", + "rxjs": "^5.5.8", "ts-helpers": "^1.1.2", - "ts-node": "~4.1.0", + "ts-node": "~5.0.1", "tslint": "^5.9.1", - "typescript": "^2.6.2", + "typescript": "^2.8.1", + "xlf-google-translate": "^1.0.0-beta.8", "zone.js": "^0.8.20" }, "optionalDependencies": { "bcrypt": "^1.0.3", "gm": "^1.23.1", - "sharp": "^0.19.0" + "sharp": "^0.20.1" }, "engines": { "node": ">= 6.9" diff --git a/test/backend/unit/model/sql/SearchManager.ts b/test/backend/unit/model/sql/SearchManager.ts index ef269cd..28263f3 100644 --- a/test/backend/unit/model/sql/SearchManager.ts +++ b/test/backend/unit/model/sql/SearchManager.ts @@ -101,7 +101,7 @@ describe('SearchManager', () => { await SQLConnection.close(); }; - const teardownUpSqlDB = async () => { + const tearDownSqlDB = async () => { await SQLConnection.close(); if (fs.existsSync(dbPath)) { fs.unlinkSync(dbPath); @@ -116,7 +116,7 @@ describe('SearchManager', () => { }); afterEach(async () => { - await teardownUpSqlDB(); + await tearDownSqlDB(); }); diff --git a/test/backend/unit/model/sql/SharingManager.ts b/test/backend/unit/model/sql/SharingManager.ts index 802d8c0..45c05fe 100644 --- a/test/backend/unit/model/sql/SharingManager.ts +++ b/test/backend/unit/model/sql/SharingManager.ts @@ -141,7 +141,6 @@ describe('SharingManager', () => { }; const updated = await sm.updateSharing(update); - console.log(updated); expect(updated.id).to.equals(saved.id); expect(updated.sharingKey).to.equals(sharing.sharingKey); expect(updated.timeStamp).to.equals(sharing.timeStamp);