Skip to content

Commit ae52348

Browse files
committed
Drop i18n pseudo-namespace #8020
Because it add maintenance complexity and I don't think we ever needed it. And if it actually becomes an issue we can always specify a proper meaning to disambiguate (and not a generic "natural")
1 parent ad5039a commit ae52348

File tree

21 files changed

+45
-65
lines changed

21 files changed

+45
-65
lines changed

README.md

-15
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,6 @@ The most useful commands for development are:
2727
This library is ready to be translated, but it does not ship translations. It is up to the consuming
2828
application to extract and translate strings.
2929

30-
#### Marking text for translation
31-
32-
All text marked for translation must use the "namespace" natural. This is done via the _meaning_
33-
of the translation. So something like:
34-
35-
```html
36-
<p i18n="natural|">My text to translate</p>
37-
```
38-
39-
```ts
40-
const message = $localize`:natural|:My text to translate`;
41-
```
42-
43-
This is to avoid collision between the translation of natural and the consuming application.
44-
4530
## Components
4631

4732
### Natural Search

projects/natural/src/lib/classes/abstract-detail.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class NaturalAbstractDetail<
9898
ifValid(this.form).subscribe(() => {
9999
this.formToData();
100100
const postUpdate = (model: ExtractTupdate<TService>) => {
101-
this.alertService.info($localize`:natural|:Mis à jour`);
101+
this.alertService.info($localize`Mis à jour`);
102102
this.form.patchValue(model);
103103
this.postUpdate(model);
104104
};
@@ -127,7 +127,7 @@ export class NaturalAbstractDetail<
127127
);
128128

129129
obs.subscribe(model => {
130-
this.alertService.info($localize`:natural|:Créé`);
130+
this.alertService.info($localize`Créé`);
131131
this.form.patchValue(model);
132132
this.postCreate(model);
133133

@@ -149,9 +149,9 @@ export class NaturalAbstractDetail<
149149
public delete(redirectionRoute?: unknown[]): void {
150150
this.alertService
151151
.confirm(
152-
$localize`:natural|:Suppression`,
153-
$localize`:natural|:Voulez-vous supprimer définitivement cet élément ?`,
154-
$localize`:natural|:Supprimer définitivement`,
152+
$localize`Suppression`,
153+
$localize`Voulez-vous supprimer définitivement cet élément ?`,
154+
$localize`Supprimer définitivement`,
155155
)
156156
.subscribe(confirmed => {
157157
if (confirmed) {
@@ -162,7 +162,7 @@ export class NaturalAbstractDetail<
162162
.delete([this.data.model])
163163
.pipe(finalize(() => this.form.enable()))
164164
.subscribe(() => {
165-
this.alertService.info($localize`:natural|:Supprimé`);
165+
this.alertService.info($localize`Supprimé`);
166166

167167
if (!this.isPanel) {
168168
const defaultRoute = ['../../' + kebabCase(this.key)];

projects/natural/src/lib/classes/abstract-list.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,9 @@ export class NaturalAbstractList<
482482

483483
protected bulkdDeleteConfirmation(): Observable<boolean | undefined> {
484484
return this.alertService.confirm(
485-
$localize`:natural|:Suppression`,
486-
$localize`:natural|:Voulez-vous supprimer définitivement les éléments sélectionnés ?`,
487-
$localize`:natural|:Supprimer définitivement`,
485+
$localize`Suppression`,
486+
$localize`Voulez-vous supprimer définitivement les éléments sélectionnés ?`,
487+
$localize`Supprimer définitivement`,
488488
);
489489
}
490490

@@ -503,7 +503,7 @@ export class NaturalAbstractList<
503503

504504
this.service.delete(selection).subscribe(() => {
505505
this.selection.clear();
506-
this.alertService.info($localize`:natural|:Supprimé`);
506+
this.alertService.info($localize`Supprimé`);
507507
subject.next();
508508
subject.complete();
509509
});

projects/natural/src/lib/modules/alert/alert.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class NaturalAlertService {
4040
title: string,
4141
message: string,
4242
confirmText: string,
43-
cancelText: string = $localize`:natural|:Annuler`,
43+
cancelText: string = $localize`Annuler`,
4444
): Observable<boolean | undefined> {
4545
const dialog = this.dialog.open<NaturalConfirmComponent, NaturalConfirmData, boolean>(NaturalConfirmComponent, {
4646
data: {

projects/natural/src/lib/modules/columns-picker/columns-picker.component.html

+1-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@
1010
}}</mat-checkbox>
1111
</div>
1212
</mat-menu>
13-
<button
14-
[matMenuTriggerFor]="naturalMenu"
15-
mat-icon-button
16-
i18n-matTooltip="natural|"
17-
matTooltip="Sélectionner les colonnes"
18-
>
13+
<button [matMenuTriggerFor]="naturalMenu" mat-icon-button i18n-matTooltip matTooltip="Sélectionner les colonnes">
1914
<natural-icon name="view_column"></natural-icon>
2015
</button>
2116
</div>

projects/natural/src/lib/modules/dropdown-components/type-date/type-date.component.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<form [formGroup]="form">
22
<mat-form-field style="max-width: 4em; margin-right: 1em">
3-
<mat-label i18n="natural|Mathematical operator < > =">Opérateur</mat-label>
3+
<mat-label i18n="Mathematical operator < > =">Opérateur</mat-label>
44
<mat-select [formControl]="operatorCtrl" [required]="true">
55
<mat-option *ngFor="let item of operators" [value]="item.key">
66
{{ item.label }}
@@ -9,7 +9,7 @@
99
</mat-form-field>
1010

1111
<mat-form-field>
12-
<mat-label i18n="natural|">Date</mat-label>
12+
<mat-label i18n>Date</mat-label>
1313
<input
1414
[formControl]="valueCtrl"
1515
[matDatepicker]="value"

projects/natural/src/lib/modules/dropdown-components/type-hierarchic-selector/type-hierarchic-selector.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<form [formGroup]="form">
22
<mat-form-field style="max-width: 7em; margin-right: 1em">
3-
<mat-label i18n="natural|Mathematical operator < > =">Opérateur</mat-label>
3+
<mat-label i18n="Mathematical operator < > =">Opérateur</mat-label>
44
<mat-select [formControl]="operatorCtrl" [required]="true">
55
<mat-option *ngFor="let item of operators" [value]="item.key">
66
{{ item.label }}

projects/natural/src/lib/modules/dropdown-components/type-natural-select/type-natural-select.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<form [formGroup]="form">
22
<mat-form-field style="max-width: 7em; margin-right: 1em">
3-
<mat-label i18n="natural|Mathematical operator < > =">Opérateur</mat-label>
3+
<mat-label i18n="Mathematical operator < > =">Opérateur</mat-label>
44
<mat-select [formControl]="operatorCtrl" [required]="true">
55
<mat-option *ngFor="let item of operators" [value]="item.key">
66
{{ item.label }}

projects/natural/src/lib/modules/dropdown-components/type-number/type-number.component.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<form [formGroup]="form">
22
<mat-form-field style="max-width: 4em; margin-right: 1em">
3-
<mat-label i18n="natural|Mathematical operator < > =">Opérateur</mat-label>
3+
<mat-label i18n="Mathematical operator < > =">Opérateur</mat-label>
44
<mat-select [formControl]="operatorCtrl" [required]="true">
55
<mat-option *ngFor="let item of operators" [value]="item.key">
66
{{ item.label }}
@@ -9,7 +9,7 @@
99
</mat-form-field>
1010

1111
<mat-form-field>
12-
<mat-label i18n="natural|">Valeur</mat-label>
12+
<mat-label i18n>Valeur</mat-label>
1313
<input
1414
(keydown.enter)="close()"
1515
[errorStateMatcher]="matcher"

projects/natural/src/lib/modules/dropdown-components/type-select/type-select.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<form [formGroup]="form">
22
<mat-form-field style="max-width: 7em; margin-right: 1em">
3-
<mat-label i18n="natural|Mathematical operator < > =">Opérateur</mat-label>
3+
<mat-label i18n="Mathematical operator < > =">Opérateur</mat-label>
44
<mat-select [formControl]="operatorCtrl" [required]="true">
55
<mat-option *ngFor="let item of operators" [value]="item.key">
66
{{ item.label }}

projects/natural/src/lib/modules/dropdown-components/type-text/type-text.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<mat-form-field>
2-
<mat-label i18n="natural|">Valeur</mat-label>
2+
<mat-label i18n>Valeur</mat-label>
33
<input
44
(keydown.enter)="close()"
55
[errorStateMatcher]="matcher"

projects/natural/src/lib/modules/dropdown-components/types.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ export interface PossibleDiscreteOperator {
3636
export const possibleDiscreteOperators: PossibleDiscreteOperator[] = [
3737
{
3838
key: 'is',
39-
label: $localize`:natural|:est`,
39+
label: $localize`est`,
4040
},
4141
{
4242
key: 'isnot',
43-
label: $localize`:natural|:n'est pas`,
43+
label: $localize`n'est pas`,
4444
},
4545
{
4646
key: 'any',
47-
label: $localize`:natural|:tous`,
47+
label: $localize`tous`,
4848
},
4949
{
5050
key: 'none',
51-
label: $localize`:natural|:aucun`,
51+
label: $localize`aucun`,
5252
},
5353
];

projects/natural/src/lib/modules/fixed-button-detail/fixed-button-detail.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class="detail-speed-dial"
1515
color="warn"
1616
icon="delete_forever"
17-
i18n-matTooltip="natural|"
17+
i18n-matTooltip
1818
matTooltip="Supprimer définitivement"
1919
matTooltipPosition="left"
2020
></natural-fixed-button>

projects/natural/src/lib/modules/hierarchic-selector/hierarchic-selector-dialog/hierarchic-selector-dialog.component.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h2 i18n="natural|" mat-dialog-title>Sélection</h2>
1+
<h2 i18n mat-dialog-title>Sélection</h2>
22

33
<mat-dialog-content>
44
<natural-hierarchic-selector
@@ -15,8 +15,8 @@ <h2 i18n="natural|" mat-dialog-title>Sélection</h2>
1515
</mat-dialog-content>
1616

1717
<mat-dialog-actions>
18-
<button [mat-dialog-close] i18n="natural|" mat-button>Annuler</button>
18+
<button [mat-dialog-close] i18n mat-button>Annuler</button>
1919
<button (click)="close(config.hierarchicSelection)" color="primary" mat-raised-button
20-
><span i18n="natural|">Valider</span>
20+
><span i18n>Valider</span>
2121
</button>
2222
</mat-dialog-actions>

projects/natural/src/lib/modules/hierarchic-selector/hierarchic-selector/hierarchic-selector.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@
6666
</mat-chip-list>
6767
</div>
6868

69-
<div *ngIf="!loading && !dataSource.data.length" class="margin-v" i18n="natural|">Aucun résultat</div>
69+
<div *ngIf="!loading && !dataSource.data.length" class="margin-v" i18n>Aucun résultat</div>

projects/natural/src/lib/modules/relations/relations.component.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<tr *matRowDef="let row; columns: displayedColumns" mat-row></tr>
99

1010
<ng-container matColumnDef="name">
11-
<th *matHeaderCellDef i18n="natural|" mat-header-cell>Titre</th>
11+
<th *matHeaderCellDef i18n mat-header-cell>Titre</th>
1212
<td *matCellDef="let item" mat-cell>
1313
<ng-template
1414
[ngTemplateOutletContext]="{item: item}"
@@ -24,7 +24,7 @@
2424
(click)="removeRelation(element)"
2525
color="warn"
2626
mat-icon-button
27-
i18n-matTooltip="natural|"
27+
i18n-matTooltip
2828
matTooltip="Dissocier"
2929
>
3030
<natural-icon name="link_off"></natural-icon>
@@ -43,7 +43,7 @@
4343
></mat-paginator>
4444

4545
<div *ngIf="!loading && dataSource?.data?.length === 0" class="margin-v mat-body">
46-
<span i18n="natural|">Aucun résultat</span>
46+
<span i18n>Aucun résultat</span>
4747
</div>
4848

4949
<mat-progress-spinner *ngIf="loading" [diameter]="40" class="loading" mode="indeterminate"></mat-progress-spinner>

projects/natural/src/lib/modules/search/search/search.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class NaturalSearchComponent implements OnChanges {
1212
/**
1313
* Placeholder for last input (the free search input)
1414
*/
15-
@Input() public placeholder = $localize`:natural|:Rechercher`;
15+
@Input() public placeholder = $localize`Rechercher`;
1616

1717
/**
1818
* Exhaustive list of facets to be used in this <natural-search>

projects/natural/src/lib/modules/select/select-enum/select-enum.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
</mat-option>
1717
</mat-select>
1818

19-
<mat-error *ngIf="hasRequiredError()" i18n="natural|">Ce champ est requis</mat-error></mat-form-field
19+
<mat-error *ngIf="hasRequiredError()" i18n>Ce champ est requis</mat-error></mat-form-field
2020
>

projects/natural/src/lib/modules/select/select-hierarchic/select-hierarchic.component.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[formControl]="internalCtrl"
1010
[errorStateMatcher]="matcher"
1111
aria-label="Recherche et sélection"
12-
i18n-aria-label="natural|"
12+
i18n-aria-label
1313
matInput
1414
/>
1515

@@ -22,7 +22,7 @@
2222
(click)="clear(); $event.stopPropagation()"
2323
*ngIf="internalCtrl.value && internalCtrl.enabled && !clearLabel"
2424
mat-icon-button
25-
i18n-matTooltip="natural|"
25+
i18n-matTooltip
2626
matTooltip="Désélectionner"
2727
>
2828
<natural-icon name="close"></natural-icon>
@@ -32,14 +32,14 @@
3232
[routerLink]="navigateTo"
3333
mat-button
3434
mat-icon-button
35-
i18n-matTooltip="natural|"
35+
i18n-matTooltip
3636
matTooltip="Naviguer vers"
3737
>
3838
<natural-icon name="open_in_browser"></natural-icon>
3939
</button>
4040
</div>
4141

42-
<mat-error *ngIf="hasRequiredError()" i18n="natural|">Ce champ est requis</mat-error>
42+
<mat-error *ngIf="hasRequiredError()" i18n>Ce champ est requis</mat-error>
4343
</mat-form-field>
4444

4545
<!-- Additional (un)select/(un)link buttons for more visual cohesion with natural-relations --><!-- [clearLabel] and/or [selectLabel] has to be given as attribute input -->

projects/natural/src/lib/modules/select/select/select.component.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[ngTemplateOutlet]="itemTemplate ? itemTemplate : defaultACItem"
1212
></ng-template>
1313
</mat-option>
14-
<div *ngIf="moreNbItems > 0" class="mat-caption" i18n="natural|" style="padding: 5px 10px"
14+
<div *ngIf="moreNbItems > 0" class="mat-caption" i18n style="padding: 5px 10px"
1515
>{{ moreNbItems }} élément(s) supplémentaire(s)</div
1616
>
1717
</mat-autocomplete>
@@ -33,7 +33,7 @@
3333
[formControl]="internalCtrl"
3434
[matAutocomplete]="ac"
3535
aria-label="Recherche et sélection"
36-
i18n-aria-label="natural|"
36+
i18n-aria-label
3737
matInput
3838
[errorStateMatcher]="matcher"
3939
/>
@@ -54,7 +54,7 @@
5454
(click)="clear(); $event.stopPropagation()"
5555
*ngIf="internalCtrl.value && internalCtrl.enabled && !clearLabel"
5656
mat-icon-button
57-
i18n-matTooltip="natural|"
57+
i18n-matTooltip
5858
matTooltip="Désélectionner"
5959
>
6060
<natural-icon name="close"></natural-icon>
@@ -64,14 +64,14 @@
6464
[routerLink]="navigateTo"
6565
mat-button
6666
mat-icon-button
67-
i18n-matTooltip="natural|"
67+
i18n-matTooltip
6868
matTooltip="Naviguer vers"
6969
>
7070
<natural-icon name="open_in_browser"></natural-icon>
7171
</button>
7272
</div>
7373

74-
<mat-error *ngIf="hasRequiredError()" i18n="natural|">Ce champ est requis</mat-error>
74+
<mat-error *ngIf="hasRequiredError()" i18n>Ce champ est requis</mat-error>
7575
</mat-form-field>
7676

7777
<!-- Additional (un)select/(un)link buttons for more visual cohesion with natural-relations --><!-- [clearLabel] and/or [selectLabel] has to be given as attribute input -->

projects/natural/src/lib/modules/stamp/stamp.component.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<ng-container *ngIf="item">
22
<div *ngIf="item.creationDate || item.creator">
3-
<span class="mat-body-2" i18n="natural|">Création</span>
3+
<span class="mat-body-2" i18n>Création</span>
44
:
55
<span *ngIf="item.creator">{{ item.creator?.fullName || item.creator?.name }}</span>
66
<span *ngIf="item.creator && item.creationDate">,&nbsp;</span>
@@ -10,7 +10,7 @@
1010
</div>
1111

1212
<div *ngIf="item.updateDate || item.updater">
13-
<span class="mat-body-2" i18n="natural|">Modification</span>
13+
<span class="mat-body-2" i18n>Modification</span>
1414
:
1515
<span *ngIf="item.updater">{{ item.updater?.fullName || item.updater?.name }}</span>
1616
<span *ngIf="item.updater && item.updateDate">,&nbsp;</span>

0 commit comments

Comments
 (0)