From 66357162f8e1227495f09bd4f68446aad7071c6d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 12 Aug 2020 10:40:04 +0200 Subject: Migrate to $localize * Remove i18n polyfill to translate things in components * Reduce bundle sizes * Improve runtime perf * Reduce a lot the time to make a full client build * Reduce client build complexity * We don't need a service to translate things anymore (so we will be able to translate title pages etc) Unfortunately we may loose some translations in the migration process. I'll put a message on weblate to notify translators --- .../plugin-list-installed.component.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts') diff --git a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts index af31f1144..1ffd001c6 100644 --- a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts +++ b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts @@ -4,7 +4,6 @@ import { ActivatedRoute, Router } from '@angular/router' import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' import { ComponentPagination, ConfirmService, hasMoreItems, Notifier } from '@app/core' import { PluginService } from '@app/core/plugins/plugin.service' -import { I18n } from '@ngx-translate/i18n-polyfill' import { compareSemVer } from '@shared/core-utils/miscs/miscs' import { PeerTubePlugin } from '@shared/models/plugins/peertube-plugin.model' import { PluginType } from '@shared/models/plugins/plugin.type' @@ -37,7 +36,6 @@ export class PluginListInstalledComponent implements OnInit { onDataSubject = new Subject() constructor ( - private i18n: I18n, private pluginService: PluginService, private pluginApiService: PluginApiService, private notifier: Notifier, @@ -88,10 +86,10 @@ export class PluginListInstalledComponent implements OnInit { getNoResultMessage () { if (this.pluginType === PluginType.PLUGIN) { - return this.i18n("You don't have plugins installed yet.") + return $localize`You don't have plugins installed yet.` } - return this.i18n("You don't have themes installed yet.") + return $localize`You don't have themes installed yet.` } isUpdateAvailable (plugin: PeerTubePlugin) { @@ -99,7 +97,7 @@ export class PluginListInstalledComponent implements OnInit { } getUpdateLabel (plugin: PeerTubePlugin) { - return this.i18n('Update to {{version}}', { version: plugin.latestVersion }) + return $localize`Update to ${plugin.latestVersion}` } isUpdating (plugin: PeerTubePlugin) { @@ -108,15 +106,15 @@ export class PluginListInstalledComponent implements OnInit { async uninstall (plugin: PeerTubePlugin) { const res = await this.confirmService.confirm( - this.i18n('Do you really want to uninstall {{pluginName}}?', { pluginName: plugin.name }), - this.i18n('Uninstall') + $localize`Do you really want to uninstall ${plugin.name}?`, + $localize`Uninstall` ) if (res === false) return this.pluginApiService.uninstall(plugin.name, plugin.type) .subscribe( () => { - this.notifier.success(this.i18n('{{pluginName}} uninstalled.', { pluginName: plugin.name })) + this.notifier.success($localize`${plugin.name} uninstalled.`) this.plugins = this.plugins.filter(p => p.name !== plugin.name) this.pagination.totalItems-- @@ -138,7 +136,7 @@ export class PluginListInstalledComponent implements OnInit { res => { this.updating[updatingKey] = false - this.notifier.success(this.i18n('{{pluginName}} updated.', { pluginName: plugin.name })) + this.notifier.success($localize`${plugin.name} updated.`) Object.assign(plugin, res) }, -- cgit v1.2.3