lara-light-indigo

Internationalization and Localization

The Locale API allows setting i18n and l7n options globally for the components.

Getting Started

By using the locale, addLocale, updateLocaleOption, updateLocaleOptions, localeOption and localeOptions methods, locale objects can be used in the whole application or in certain pages.


import { locale, addLocale, updateLocaleOption, updateLocaleOptions, localeOption, localeOptions } from 'primereact/api';
 

The current locale can be set with locale method.


locale('en');
 

New locale values can be added using addLocale method for the application.


addLocale('es', {
    firstDayOfWeek: 1,
    dayNames: ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'],
    dayNamesShort: ['dom', 'lun', 'mar', 'mié', 'jue', 'vie', 'sáb'],
    dayNamesMin: ['D', 'L', 'M', 'X', 'J', 'V', 'S'],
    monthNames: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'],
    monthNamesShort: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'],
    today: 'Hoy',
    clear: 'Limpiar'
});

locale('es');
 

Locale values can be changed dynamically. (Note: please don't forget to update main or current component with state management or forceUpdate method of React.)


<Button label="EN" onClick={() => locale('en')} />
<Button label="ES" onClick={() => locale('es')} />
 
Locale Repo

Ready to use settings for locales are available at the community supported PrimeLocale repository. We'd appreciate if you could contribute to this repository with pull requests and share it with the rest of the community.

Locale Methods
NameParametersReturnDescription
localecurrentLocale: string{locale: string, options: object}Used to determine the current locale value. Returns the name and values ​​of the current locale.
addLocalelocale: string, options: objectUsed to add a new locale.
updateLocaleOptionkey: string, value: any, locale: stringUsed to change the option value of a current or specific locale.
updateLocaleOptionsoptions: object, locale: stringUsed to change the option values of a current or specific locale.
localeOptionkey: string, locale: stringUsed to get the option value of a current or specific locale.
localeOptionslocale: stringUsed to get the option values of a current or specific locale.
Locale Options
KeyValue
startsWithStarts with
containsContains
notContainsNot contains
endsWithEnds with
equalsEquals
notEqualsNot equals
noFilterNo Filter
filterFilter
ltLess than
lteLess than or equal to
gtGreater than
gteGreater than or equal to
dateIsDate is
dateIsNotDate is not
dateBeforeDate is before
dateAfterDate is after
customCustom
clearClear
applyApply
matchAllMatch All
matchAnyMatch Any
addRuleAdd Rule
removeRuleRemove Rule
acceptYes
rejectNo
chooseChoose
uploadUpload
cancelCancel
closeClose
dayNames['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
dayNamesShort['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
dayNamesMin['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
monthNames['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
monthNamesShort['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
todayToday
weekHeaderWk
firstDayOfWeek0
dateFormatmm/dd/yy
weakWeak
mediumMedium
strongStrong
passwordPromptEnter a password
emptyFilterMessageNo available options
emptyMessageNo results found
aria.trueLabelTrue
aria.falseLabelFalse
aria.nullLabelNot Selected
aria.pageLabelPage
aria.firstPageLabelFirst Page
aria.lastPageLabelLast Page
aria.nextPageLabelNext Page
aria.previousPageLabelPrevious Page
aria.selectLabelSelect
aria.unselectLabelUnselect
aria.expandLabelExpand
aria.collapseLabelCollapse

Component Scale

Input Style

Ripple Effect

Free Themes

Built-in component themes created by the PrimeReact Theme Designer.

Bootstrap
Blue
Purple
Blue
Purple
Material Design
Indigo
Deep Purple
Indigo
Deep Purple
Material Design Compact
Indigo
Deep Purple
Indigo
Deep Purple
Tailwind
Tailwind Light
Fluent UI
Blue
PrimeOne Design - 2022 NEW
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
PrimeOne Design - 2021
Saga Blue
Saga Green
Saga Orange
Saga Purple
Vela Blue
Vela Green
Vela Orange
Vela Purple
Arya Blue
Arya Green
Arya Orange
Arya Purple
Premium Themes

Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.

Soho Light
Soho Dark
Viva Light
Viva Dark
Mira
Nano

Legacy Free Themes

Nova
Nova Alt
Nova Accent
Luna Blue
Luna Green
Luna Amber
Luna Pink
Rhea

Premium Create-React-App Templates

Beautifully crafted premium create-react-app application templates by the PrimeTek design team.

Sakai
Atlantis
Freya
Ultima
Diamond
Sapphire
Serenity
Babylon
Avalon
Apollo
Roma