Skip to content

Commit db49fb3

Browse files
Merge branch 'v15/dev' into v15/feature/reworking-error-notifications
2 parents 64efd73 + 9c62160 commit db49fb3

File tree

25 files changed

+211
-123
lines changed

25 files changed

+211
-123
lines changed

src/Umbraco.Web.UI.Client/src/assets/lang/da-dk.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,7 @@ export default {
875875
unknown: 'Ukendt',
876876
unknownUser: 'Ukendt bruger',
877877
under: 'under',
878+
unnamed: 'Unavngivet',
878879
up: 'Op',
879880
update: 'Opdatér',
880881
upgrade: 'Opdatér',

src/Umbraco.Web.UI.Client/src/assets/lang/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,7 @@ export default {
913913
unknown: 'Unknown',
914914
unknownUser: 'Unknown user',
915915
under: 'under',
916+
unnamed: 'Unnamed',
916917
up: 'Up',
917918
update: 'Update',
918919
upgrade: 'Upgrade',

src/Umbraco.Web.UI.Client/src/libs/localization-api/localization.controller.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ describe('UmbLocalizeController', () => {
298298
});
299299

300300
it('should return an empty string if the input is not a string', async () => {
301-
expect(controller.string(123)).to.equal('');
302-
expect(controller.string({})).to.equal('');
301+
expect(controller.string(123 as any)).to.equal('');
302+
expect(controller.string({} as any)).to.equal('');
303303
expect(controller.string(undefined)).to.equal('');
304304
});
305305

@@ -338,5 +338,15 @@ describe('UmbLocalizeController', () => {
338338
await elementUpdated(element);
339339
expect(element.localize.term('close')).to.equal('Luk');
340340
});
341+
342+
it('should update the string when the language changes', async () => {
343+
expect(element.localize.string('testing #close')).to.equal('testing Close');
344+
345+
// Switch browser to Danish
346+
element.lang = danishRegional.$code;
347+
348+
await elementUpdated(element);
349+
expect(element.localize.string('testing #close')).to.equal('testing Luk');
350+
});
341351
});
342352
});

src/Umbraco.Web.UI.Client/src/libs/localization-api/localization.controller.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ export class UmbLocalizationController<LocalizationSetType extends UmbLocalizati
190190
* Translates a string containing one or more terms. The terms should be prefixed with a `#` character.
191191
* If the term is found in the localization set, it will be replaced with the localized term.
192192
* If the term is not found, the original term will be returned.
193-
* @param {string} text The text to translate.
193+
* @param {string | null | undefined} text The text to translate.
194194
* @param {...any} args The arguments to parse for this localization entry.
195195
* @returns {string} The translated text.
196196
*/
197-
string(text: unknown, ...args: any): string {
197+
string(text: string | null | undefined, ...args: any): string {
198198
if (typeof text !== 'string') {
199199
return '';
200200
}
@@ -204,6 +204,9 @@ export class UmbLocalizationController<LocalizationSetType extends UmbLocalizati
204204

205205
const localizedText = text.replace(regex, (match: string) => {
206206
const key = match.slice(1);
207+
if (!this.#usedKeys.includes(key)) {
208+
this.#usedKeys.push(key);
209+
}
207210

208211
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
209212
// @ts-ignore

src/Umbraco.Web.UI.Client/src/packages/core/content/workspace/views/edit/content-editor.element.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ import './content-editor-tab.element.js';
1616

1717
@customElement('umb-content-workspace-view-edit')
1818
export class UmbContentWorkspaceViewEditElement extends UmbLitElement implements UmbWorkspaceViewElement {
19-
//@state()
20-
//private _hasRootProperties = false;
19+
/*
20+
// root properties is a possible feature with Bellissima, but as it is new its not fully implemented yet [NL]
21+
@state()
22+
private _hasRootProperties = false;
23+
*/
2124

2225
@state()
2326
private _hasRootGroups = false;
@@ -78,6 +81,16 @@ export class UmbContentWorkspaceViewEditElement extends UmbLitElement implements
7881
if (!this._tabs || !this.#structureManager) return;
7982
const routes: UmbRoute[] = [];
8083

84+
if (this._hasRootGroups) {
85+
routes.push({
86+
path: `root`,
87+
component: () => import('./content-editor-tab.element.js'),
88+
setup: (component) => {
89+
(component as UmbContentWorkspaceViewEditTabElement).containerId = null;
90+
},
91+
});
92+
}
93+
8194
if (this._tabs.length > 0) {
8295
this._tabs?.forEach((tab) => {
8396
const tabName = tab.name ?? '';
@@ -91,23 +104,11 @@ export class UmbContentWorkspaceViewEditElement extends UmbLitElement implements
91104
});
92105
}
93106

94-
if (this._hasRootGroups) {
107+
if (routes.length !== 0) {
95108
routes.push({
96109
path: '',
97-
component: () => import('./content-editor-tab.element.js'),
98-
setup: (component) => {
99-
(component as UmbContentWorkspaceViewEditTabElement).containerId = null;
100-
},
110+
redirectTo: routes[0].path,
101111
});
102-
}
103-
104-
if (routes.length !== 0) {
105-
if (!this._hasRootGroups) {
106-
routes.push({
107-
path: '',
108-
redirectTo: routes[0]?.path,
109-
});
110-
}
111112

112113
routes.push({
113114
path: `**`,
@@ -127,21 +128,20 @@ export class UmbContentWorkspaceViewEditElement extends UmbLitElement implements
127128
${this._hasRootGroups && this._tabs.length > 0
128129
? html`
129130
<uui-tab
130-
label="Content"
131-
.active=${this._routerPath + '/' === this._activePath}
132-
href=${this._routerPath + '/'}
133-
>Content</uui-tab
134-
>
131+
.label=${this.localize.term('general_generic')}
132+
.active=${this._routerPath + '/root' === this._activePath}
133+
.href=${this._routerPath + '/root'}></uui-tab>
135134
`
136135
: ''}
137136
${repeat(
138137
this._tabs,
139138
(tab) => tab.name,
140139
(tab) => {
141140
const path = this._routerPath + '/tab/' + encodeFolderName(tab.name || '');
142-
return html`<uui-tab label=${tab.name ?? 'Unnamed'} .active=${path === this._activePath} href=${path}
143-
>${this.localize.string(tab.name)}</uui-tab
144-
>`;
141+
return html`<uui-tab
142+
.label=${this.localize.string(tab.name ?? '#general_unnamed')}
143+
.active=${path === this._activePath}
144+
.href=${path}></uui-tab>`;
145145
},
146146
)}
147147
</uui-tab-group>`

src/Umbraco.Web.UI.Client/src/packages/core/modal/common/confirm/confirm-modal.element.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export class UmbConfirmModalElement extends UmbLitElement {
2222
override render() {
2323
return html`
2424
<uui-dialog-layout class="uui-text" .headline=${this.localize.string(this.data?.headline) ?? null}>
25-
${unsafeHTML(this.localize.string(this.data?.content))}
25+
${typeof this.data?.content === 'string'
26+
? unsafeHTML(this.localize.string(this.data?.content))
27+
: this.data?.content}
2628
2729
<uui-button
2830
slot="actions"

src/Umbraco.Web.UI.Client/src/packages/core/router/components/not-found/route-not-found.element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class UmbRouteNotFoundElement extends UmbLitElement {
3434
align-items: center;
3535
height: 100%;
3636
opacity: 0;
37-
animation: fadeIn 4s 0.2s forwards;
37+
animation: fadeIn 6s 0.2s forwards;
3838
}
3939
4040
@keyframes fadeIn {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export type * from './workspace-action/types.js';
2+
export type * from './workspace-action-menu-item/types.js';

src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-action-menu-item/default/workspace-action-menu-item.element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { UmbWorkspaceActionMenuItem } from '../index.js';
1+
import type { UmbWorkspaceActionMenuItem } from '../types.js';
22
import { UmbActionExecutedEvent } from '@umbraco-cms/backoffice/event';
33
import { html, customElement, property, state, ifDefined, nothing } from '@umbraco-cms/backoffice/external/lit';
44
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
export * from './workspace-action-menu-item-base.controller.js';
2-
export type * from './types.js';
3-
export type * from './workspace-action-menu-item.interface.js';

0 commit comments

Comments
 (0)