The Base library for Angular provides reusable building blocks for Angular apps. Using the pre-made components allows frontend developers to focus on the app-specific challenges. The library fuels rapid development of Talenra apps that comply with the Talenra design system.
Make sure you have node >= 24 and npm >= 11 installed.
Example :# Check node version
node --version
# Check npm version
npm --versionThe package @talenra/components is served via the Talenra artifactory. Access to the artifactory requires the TC user provided in the Talenra onboarding process.
Add the @talenra registry to your npm configuration and login.
npm config set @talenra:registry=https://gitlab.com:talenra/workspace.git
npm login --scope=@talenraInstall the package.
Example :npm i @talenra/componentsThe Talenra libraries support internationalization with translations for German (de-CH), French (fr-CH), and Italian (it-CH). You can configure translations in two ways:
Configure translations in your app.config.ts using the provider functions:
import { provideTalenraBaseConfig } from '@talenra/components/config';
import { TalenraBaseTranslations } from '@talenra/components/locales';
export const appConfig: ApplicationConfig = {
providers: [
// Configure Base library translations
provideTalenraBaseConfig({
translation: TalenraBaseTranslations.deCH.translations, // or frCH, itCH
}),
// ... other providers
],
};You can also provide partial translations to override specific strings:
Example :provideTalenraBaseConfig({
translation: {
...TalenraBaseTranslations.deCH.translations,
paginatorItemsPerPage: 'Custom items per page text',
},
});For applications that depend on Angular's LOCALE_ID, inject the configuration services into your root component (commonly app.component.ts):
import { Component, inject, LOCALE_ID } from '@angular/core';
import { TalenraBaseConfig } from '@talenra/components/config';
import { TalenraBaseTranslations } from '@talenra/components/locales';
@Component({
// ...component configuration
})
export class AppComponent {
private localeId = inject(LOCALE_ID);
private talenraBaseConfig = inject(TalenraBaseConfig);
constructor() {
// Set the translations based on LOCALE_ID
let baseTranslation = TalenraBaseTranslations.deCH;
if (this.localeId === 'fr-CH') {
baseTranslation = TalenraBaseTranslations.frCH;
}
if (this.localeId === 'it-CH') {
baseTranslation = TalenraBaseTranslations.itCH;
}
this.talenraBaseConfig.setTranslation(baseTranslation.translations);
}
}TalenraBaseTranslations from @talenra/components/localesTalenraBaseTranslations.deCHTalenraBaseTranslations.frCHTalenraBaseTranslations.itCHThe tutorial "build a simple app" is a good starting point if you're using the library for the first time.
Please open a new issue to report bugs. The better your report, the faster we can solve the issue. Information required to address the issue include:
Lead Talenra
workspace@talenra.com