From 7b5f2648af510697558d39e438f48c9da0c28d63 Mon Sep 17 00:00:00 2001 From: Sean Date: Mon, 6 Apr 2020 16:55:23 +0200 Subject: [PATCH] Update translation extractor --- client/package.json | 3 ++- client/src/app/core/core-services/offline.service.ts | 2 +- client/src/app/core/translate/marked-translations.ts | 2 +- client/src/app/core/translate/translation-marker.ts | 12 ------------ .../app/core/ui-services/voting-banner.service.ts | 2 +- client/src/app/shared/models/users/user.ts | 3 ++- .../components/agenda-list/agenda-list.component.ts | 2 +- .../site/assignments/models/view-assignment-poll.ts | 2 +- client/src/app/site/motions/models/view-motion.ts | 3 ++- .../motions/services/motion-sort-list.service.ts | 2 +- client/src/app/site/polls/services/poll.service.ts | 2 +- .../src/app/site/projector/models/view-countdown.ts | 3 ++- .../components/user-list/user-list.component.ts | 2 +- 13 files changed, 16 insertions(+), 24 deletions(-) delete mode 100644 client/src/app/core/translate/translation-marker.ts diff --git a/client/package.json b/client/package.json index 4ec2ba254..7aa33aa0d 100644 --- a/client/package.json +++ b/client/package.json @@ -22,7 +22,7 @@ "e2e": "ng e2e", "licenses": "node src/crawler.js", "compodoc": "./node_modules/.bin/compodoc --hideGenerator -p tsconfig.app.json -n 'OpenSlides Documentation' -d ../Compodoc -s -o -r", - "extract": "ngx-translate-extract -i ./src -o ./src/assets/i18n/template-en.pot --clean --sort --format pot -m _", + "extract": "ngx-translate-extract -i ./src -o ./src/assets/i18n/template-en.pot --clean --sort --format pot", "po2json": "./node_modules/.bin/po2json -f mf src/assets/i18n/de.po src/assets/i18n/de.json && ./node_modules/.bin/po2json -f mf src/assets/i18n/cs.po src/assets/i18n/cs.json && ./node_modules/.bin/po2json -f mf src/assets/i18n/ru.po src/assets/i18n/ru.json", "po2json-tempfix": "./node_modules/.bin/po2json -f mf src/assets/i18n/de.po /dev/stdout | sed -f sed_replacements > src/assets/i18n/de.json && ./node_modules/.bin/po2json -f mf src/assets/i18n/cs.po /dev/stdout | sed -f sed_replacements > src/assets/i18n/cs.json && ./node_modules/.bin/po2json -f mf src/assets/i18n/ru.po /dev/stdout | sed -f sed_replacements > src/assets/i18n/ru.json", "prettify-check": "prettier --config ./.prettierrc --list-different \"src/{app,environments}/**/*{.ts,.js,.json,.css,.scss}\"", @@ -80,6 +80,7 @@ "@angular/compiler-cli": "~9.1.0", "@angular/language-service": "~9.1.0", "@biesbjerg/ngx-translate-extract": "^6.0.3", + "@biesbjerg/ngx-translate-extract-marker": "^1.0.0", "@compodoc/compodoc": "^1.1.8", "@schematics/angular": "^9.0.6", "@types/jasmine": "^3.3.9", diff --git a/client/src/app/core/core-services/offline.service.ts b/client/src/app/core/core-services/offline.service.ts index e869a7fb9..9689c018e 100644 --- a/client/src/app/core/core-services/offline.service.ts +++ b/client/src/app/core/core-services/offline.service.ts @@ -1,9 +1,9 @@ import { Injectable } from '@angular/core'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { TranslateService } from '@ngx-translate/core'; import { BehaviorSubject, Observable } from 'rxjs'; -import { _ } from 'app/core/translate/translation-marker'; import { BannerDefinition, BannerService } from '../ui-services/banner.service'; /** diff --git a/client/src/app/core/translate/marked-translations.ts b/client/src/app/core/translate/marked-translations.ts index ea95070da..c3b14fa60 100644 --- a/client/src/app/core/translate/marked-translations.ts +++ b/client/src/app/core/translate/marked-translations.ts @@ -1,4 +1,4 @@ -import { _ } from 'app/core/translate/translation-marker'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; /** * Add strings here that require translations but have never been declared diff --git a/client/src/app/core/translate/translation-marker.ts b/client/src/app/core/translate/translation-marker.ts deleted file mode 100644 index 4b0eefd9c..000000000 --- a/client/src/app/core/translate/translation-marker.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Mark strings as translateable for ng-translate-extract. - * Marked strings are added into template-en.pot by 'npm run extract'. - * - * @example - * ```ts - * _('translateable string'); - * ``` - */ -export function _(str: string): string { - return str; -} diff --git a/client/src/app/core/ui-services/voting-banner.service.ts b/client/src/app/core/ui-services/voting-banner.service.ts index ce5c59e47..88cadfcf9 100644 --- a/client/src/app/core/ui-services/voting-banner.service.ts +++ b/client/src/app/core/ui-services/voting-banner.service.ts @@ -1,8 +1,8 @@ import { Injectable } from '@angular/core'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { TranslateService } from '@ngx-translate/core'; -import { _ } from 'app/core/translate/translation-marker'; import { ViewAssignmentPoll } from 'app/site/assignments/models/view-assignment-poll'; import { ViewMotionPoll } from 'app/site/motions/models/view-motion-poll'; import { ViewBasePoll } from 'app/site/polls/models/view-base-poll'; diff --git a/client/src/app/shared/models/users/user.ts b/client/src/app/shared/models/users/user.ts index 96062dd60..89d83e540 100644 --- a/client/src/app/shared/models/users/user.ts +++ b/client/src/app/shared/models/users/user.ts @@ -1,4 +1,5 @@ -import { _ } from 'app/core/translate/translation-marker'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; + import { BaseModel } from '../base/base-model'; /** diff --git a/client/src/app/site/agenda/components/agenda-list/agenda-list.component.ts b/client/src/app/site/agenda/components/agenda-list/agenda-list.component.ts index 6c0882573..3b43f4a3d 100644 --- a/client/src/app/site/agenda/components/agenda-list/agenda-list.component.ts +++ b/client/src/app/site/agenda/components/agenda-list/agenda-list.component.ts @@ -4,6 +4,7 @@ import { MatSnackBar } from '@angular/material/snack-bar'; import { Title } from '@angular/platform-browser'; import { Router } from '@angular/router'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { TranslateService } from '@ngx-translate/core'; import { PblColumnDefinition } from '@pebula/ngrid'; @@ -16,7 +17,6 @@ import { PdfDocumentService } from 'app/core/pdf-services/pdf-document.service'; import { ItemRepositoryService } from 'app/core/repositories/agenda/item-repository.service'; import { ListOfSpeakersRepositoryService } from 'app/core/repositories/agenda/list-of-speakers-repository.service'; import { TopicRepositoryService } from 'app/core/repositories/topics/topic-repository.service'; -import { _ } from 'app/core/translate/translation-marker'; import { ConfigService } from 'app/core/ui-services/config.service'; import { DurationService } from 'app/core/ui-services/duration.service'; import { PromptService } from 'app/core/ui-services/prompt.service'; diff --git a/client/src/app/site/assignments/models/view-assignment-poll.ts b/client/src/app/site/assignments/models/view-assignment-poll.ts index 6a4110aca..397c27e00 100644 --- a/client/src/app/site/assignments/models/view-assignment-poll.ts +++ b/client/src/app/site/assignments/models/view-assignment-poll.ts @@ -1,6 +1,6 @@ +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { BehaviorSubject } from 'rxjs'; -import { _ } from 'app/core/translate/translation-marker'; import { ChartData } from 'app/shared/components/charts/charts.component'; import { AssignmentPoll, diff --git a/client/src/app/site/motions/models/view-motion.ts b/client/src/app/site/motions/models/view-motion.ts index 4e71068ad..5b9284938 100644 --- a/client/src/app/site/motions/models/view-motion.ts +++ b/client/src/app/site/motions/models/view-motion.ts @@ -1,4 +1,5 @@ -import { _ } from 'app/core/translate/translation-marker'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; + import { ConfigService } from 'app/core/ui-services/config.service'; import { DiffLinesInParagraph } from 'app/core/ui-services/diff.service'; import { SearchProperty, SearchRepresentation } from 'app/core/ui-services/search.service'; diff --git a/client/src/app/site/motions/services/motion-sort-list.service.ts b/client/src/app/site/motions/services/motion-sort-list.service.ts index 5bc61c87b..e49fb6136 100644 --- a/client/src/app/site/motions/services/motion-sort-list.service.ts +++ b/client/src/app/site/motions/services/motion-sort-list.service.ts @@ -1,11 +1,11 @@ import { Injectable } from '@angular/core'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { TranslateService } from '@ngx-translate/core'; import { OpenSlidesStatusService } from 'app/core/core-services/openslides-status.service'; import { StorageService } from 'app/core/core-services/storage.service'; import { Deferred } from 'app/core/promises/deferred'; -import { _ } from 'app/core/translate/translation-marker'; import { BaseSortListService } from 'app/core/ui-services/base-sort-list.service'; import { OsSortingDefinition, OsSortingOption } from 'app/core/ui-services/base-sort.service'; import { ConfigService } from 'app/core/ui-services/config.service'; diff --git a/client/src/app/site/polls/services/poll.service.ts b/client/src/app/site/polls/services/poll.service.ts index 7484daf85..ecc594769 100644 --- a/client/src/app/site/polls/services/poll.service.ts +++ b/client/src/app/site/polls/services/poll.service.ts @@ -1,8 +1,8 @@ import { Injectable } from '@angular/core'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { TranslateService } from '@ngx-translate/core'; -import { _ } from 'app/core/translate/translation-marker'; import { ChartData, ChartDate } from 'app/shared/components/charts/charts.component'; import { AssignmentPollMethod } from 'app/shared/models/assignments/assignment-poll'; import { diff --git a/client/src/app/site/projector/models/view-countdown.ts b/client/src/app/site/projector/models/view-countdown.ts index 1c8bd7472..11300b832 100644 --- a/client/src/app/site/projector/models/view-countdown.ts +++ b/client/src/app/site/projector/models/view-countdown.ts @@ -1,4 +1,5 @@ -import { _ } from 'app/core/translate/translation-marker'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; + import { Countdown } from 'app/shared/models/core/countdown'; import { BaseProjectableViewModel } from 'app/site/base/base-projectable-view-model'; import { ProjectorElementBuildDeskriptor } from 'app/site/base/projectable'; diff --git a/client/src/app/site/users/components/user-list/user-list.component.ts b/client/src/app/site/users/components/user-list/user-list.component.ts index 32fc4e479..e9e0d1a52 100644 --- a/client/src/app/site/users/components/user-list/user-list.component.ts +++ b/client/src/app/site/users/components/user-list/user-list.component.ts @@ -4,6 +4,7 @@ import { MatSnackBar } from '@angular/material/snack-bar'; import { Title } from '@angular/platform-browser'; import { ActivatedRoute, Router } from '@angular/router'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { TranslateService } from '@ngx-translate/core'; import { PblColumnDefinition } from '@pebula/ngrid'; @@ -11,7 +12,6 @@ import { OperatorService } from 'app/core/core-services/operator.service'; import { StorageService } from 'app/core/core-services/storage.service'; import { GroupRepositoryService } from 'app/core/repositories/users/group-repository.service'; import { UserRepositoryService } from 'app/core/repositories/users/user-repository.service'; -import { _ } from 'app/core/translate/translation-marker'; import { ChoiceService } from 'app/core/ui-services/choice.service'; import { ConfigService } from 'app/core/ui-services/config.service'; import { CsvExportService } from 'app/core/ui-services/csv-export.service';