Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3bcc918
feat(localization): Initial integration of new i18nManager.
skrustev Aug 29, 2025
657af61
chore(*): Remove extra types.
skrustev Aug 29, 2025
59778b2
feat(localization): Move logic for localization in controller and utils.
skrustev Sep 4, 2025
092ecc6
feat(calendar): Add i18n controller to calendar base and move related…
skrustev Sep 4, 2025
1c6c396
feat(date-range-picker): Add controller and update relatet props.
skrustev Sep 4, 2025
815286c
feat(carousel): Add i18n controller and set localizable strings.
skrustev Sep 4, 2025
39e0dd9
feat(chip): Add i18n controller and use it for localizable strings.
skrustev Sep 4, 2025
e03f8aa
feat(combo): Add localization to combo.
skrustev Sep 4, 2025
2180546
fix(*): Fix some paths and export for types.
skrustev Sep 4, 2025
757494f
fix(i18n): Fix applying resources for new localized components that u…
skrustev Sep 4, 2025
f103d47
feat(combo): Add search placeholder localization.
skrustev Sep 4, 2025
634081e
fix(carousel): Fix typo for getter.
skrustev Sep 4, 2025
9bc0c9b
chore(*): Remove leftover code.
skrustev Sep 5, 2025
0f6ff62
test(localization): Add basic tests for localization.
skrustev Sep 15, 2025
6234c12
feat(localization): Enable localized strings for week label.
skrustev Sep 15, 2025
e325593
refactor(validation): Switch to use resource strings from i18n packages.
skrustev Sep 17, 2025
f5e5957
feat(date-inputs): Add localizaiton for Date Time Input and Date Picker.
skrustev Sep 19, 2025
a3ad181
tests(localization): Update tests failing due to latest changes in lo…
skrustev Sep 19, 2025
b290679
feat(localization): Add i18n packages.
skrustev Oct 2, 2025
3ff39a9
Merge master into skrastev/localization
skrustev Oct 2, 2025
9a79f8f
Merge branch 'master' into skrastev/localization
rkaraivanov Oct 7, 2025
df6f19e
Merge remote-tracking branch 'origin/master' into skrastev/localization
rkaraivanov Oct 20, 2025
4d3df96
chore: Add several localization resources to Storybook UI
rkaraivanov Oct 20, 2025
bbfe950
Merge remote-tracking branch 'origin/master' into skrastev/localization
rkaraivanov Oct 21, 2025
0da064f
refactor: Added API documentation and abstracted some internal methods
rkaraivanov Oct 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ i18nRepo
.env
.envrc
.direnv

.vs
46 changes: 45 additions & 1 deletion .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ import { type CSSResult, html } from 'lit';
import { configureTheme } from '../src/theming/config';
import type { Decorator, Preview } from '@storybook/web-components-vite';
import { withActions } from 'storybook/actions/decorator';
import { registerI18n } from 'igniteui-i18n-core';
import {
ResourceStringsBG,
ResourceStringsDE,
ResourceStringsES,
ResourceStringsFR,
ResourceStringsJA,
} from 'igniteui-i18n-resources';

const LocalizationResources = new Map(
Object.entries({
de: ResourceStringsDE,
fr: ResourceStringsFR,
es: ResourceStringsES,
ja: ResourceStringsJA,
bg: ResourceStringsBG,
})
);

type ThemeImport = { styles: CSSResult };

Expand Down Expand Up @@ -62,6 +80,12 @@ const themeProvider: Decorator = (story, context) => {
`;
};

const localeProvider: Decorator = (story, context) => {
const { localization } = context.globals;
document.documentElement.lang = localization ?? 'en';
return story();
};

export default {
globalTypes: {
theme: {
Expand Down Expand Up @@ -102,6 +126,21 @@ export default {
],
},
},
localization: {
name: 'Localization',
description: 'Component localization',
toolbar: {
icon: 'globe',
items: [
{ value: 'en', title: 'English' },
{ value: 'de', title: 'German' },
{ value: 'fr', title: 'French' },
{ value: 'es', title: 'Spanish' },
{ value: 'ja', title: 'Japanese' },
{ value: 'bg', title: 'Bulgarian' },
],
},
},
size: {
name: 'Size',
description: 'Component size',
Expand All @@ -120,16 +159,21 @@ export default {
theme: 'bootstrap',
variant: 'light',
direction: 'ltr',
localization: 'en',
size: 'default',
},
parameters: {
backgrounds: {
disable: true,
},
},
decorators: [themeProvider, withActions],
decorators: [themeProvider, withActions, localeProvider],
loaders: [
async (context) => {
for (const [locale, resources] of LocalizationResources.entries()) {
registerI18n(resources, locale);
}

const { theme, variant } = context.globals;
return { theme: getTheme({ theme, variant }) };
},
Expand Down
39 changes: 39 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"@floating-ui/dom": "^1.7.4",
"@lit-labs/virtualizer": "^2.1.1",
"@lit/context": "^1.1.6",
"lit": "^3.3.1"
"lit": "^3.3.1",
"igniteui-i18n-core": "0.6.0-alpha.4"
},
"devDependencies": {
"@biomejs/biome": "~2.2.6",
Expand All @@ -80,6 +81,7 @@
"globby": "^15.0.0",
"husky": "^9.1.7",
"ig-typedoc-theme": "^6.2.3",
"igniteui-i18n-resources": "0.6.0-alpha.4",
"igniteui-theming": "^20.0.0",
"keep-a-changelog": "^2.7.1",
"lint-staged": "^16.2.4",
Expand Down
29 changes: 28 additions & 1 deletion src/components/calendar/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { property, state } from 'lit/decorators.js';
import { blazorDeepImport } from '../common/decorators/blazorDeepImport.js';
import { blazorIndirectRender } from '../common/decorators/blazorIndirectRender.js';
import { watch } from '../common/decorators/watch.js';
import {
IgcCalendarResourceStringEN,
type IgcCalendarResourceStrings,
} from '../common/i18n/EN/calendar.resources.js';
import { addI18nController } from '../common/i18n/i18n-controller.js';
import { first } from '../common/util.js';
import { convertToDate, convertToDates, getWeekDayNumber } from './helpers.js';
import { CalendarDay } from './model.js';
Expand All @@ -16,6 +21,10 @@ import type {
@blazorIndirectRender
@blazorDeepImport
export class IgcCalendarBaseComponent extends LitElement {
protected readonly _i18nController =
addI18nController<IgcCalendarResourceStrings>(this, {
defaultEN: IgcCalendarResourceStringEN,
});
private _initialActiveDateSet = false;

protected get _hasValues() {
Expand Down Expand Up @@ -130,7 +139,25 @@ export class IgcCalendarBaseComponent extends LitElement {
* @attr locale
*/
@property()
public locale = 'en';
public set locale(value: string) {
this._i18nController.locale = value;
}

public get locale() {
return this._i18nController.locale;
}

/**
* The resource strings for localization.
*/
@property({ attribute: false })
public set resourceStrings(value: IgcCalendarResourceStrings) {
this._i18nController.resourceStrings = value;
}

public get resourceStrings(): IgcCalendarResourceStrings {
return this._i18nController.resourceStrings;
}

/** Gets/Sets the special dates for the component. */
@property({ attribute: false })
Expand Down
2 changes: 1 addition & 1 deletion src/components/calendar/calendar-rendering.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('Calendar Rendering', () => {
`
<div part="header">
<h5 part="header-title">
<slot name="title">Select date</slot>
<slot name="title">Select Date</slot>
</h5>
<h2 part="header-date">
<slot>
Expand Down
7 changes: 0 additions & 7 deletions src/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
} from '../common/controllers/key-bindings.js';
import { watch } from '../common/decorators/watch.js';
import { registerComponent } from '../common/definitions/register.js';
import { IgcCalendarResourceStringEN } from '../common/i18n/calendar.resources.js';
import { createDateTimeFormatters } from '../common/localization/intl-formatters.js';
import type { Constructor } from '../common/mixins/constructor.js';
import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
Expand Down Expand Up @@ -220,12 +219,6 @@ export default class IgcCalendarComponent extends EventEmitterMixin<
public formatOptions: Pick<Intl.DateTimeFormatOptions, 'month' | 'weekday'> =
{ month: 'long', weekday: 'narrow' };

/**
* The resource strings for localization.
*/
@property({ attribute: false })
public resourceStrings = IgcCalendarResourceStringEN;

private _intl = createDateTimeFormatters(this.locale, {
month: {
month: this.formatOptions.month,
Expand Down
5 changes: 0 additions & 5 deletions src/components/calendar/days-view/days-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { blazorIndirectRender } from '../../common/decorators/blazorIndirectRend
import { blazorSuppressComponent } from '../../common/decorators/blazorSuppressComponent.js';
import { watch } from '../../common/decorators/watch.js';
import { registerComponent } from '../../common/definitions/register.js';
import { IgcCalendarResourceStringEN } from '../../common/i18n/calendar.resources.js';
import { createDateTimeFormatters } from '../../common/localization/intl-formatters.js';
import type { Constructor } from '../../common/mixins/constructor.js';
import { EventEmitterMixin } from '../../common/mixins/event-emitter.js';
Expand Down Expand Up @@ -101,10 +100,6 @@ export default class IgcDaysViewComponent extends EventEmitterMixin<
return this._rangePreviewDate?.native;
}

/** The resource strings. */
@property({ attribute: false })
public resourceStrings = IgcCalendarResourceStringEN;

/**
* The format of the days. Defaults to narrow.
* @attr week-day-format
Expand Down
4 changes: 2 additions & 2 deletions src/components/carousel/carousel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ describe('Carousel', () => {
)?.id;
expect(carousel).shadowDom.to.equal(
`<section>
<igc-button aria-label="Previous slide" aria-controls="${carouselId}">
<igc-button aria-label="previous slide" aria-controls="${carouselId}">
<slot name="previous-button">
<igc-icon aria-hidden="true" collection="default" name="carousel_prev"></igc-icon>
</slot>
</igc-button>
<igc-button aria-label="Next slide" aria-controls="${carouselId}">
<igc-button aria-label="next slide" aria-controls="${carouselId}">
<slot name="next-button">
<igc-icon aria-hidden="true" collection="default" name="carousel_next"></igc-icon>
</slot>
Expand Down
Loading