Skip to main content Skip to docs navigation

Locales

Introduction

The locale files offer a simple way to globally or individually set the localization options without the need to hand code that everytime.

Creating plugins

There are a few examples in the source like this

      
const name = 'ru';

const localization = {
  today: 'Перейти сегодня',
  //...
  locale: 'ru',
  startOfTheWeek: 1
};

export { localization, name };
      
    

Using a locale

Load the locale file.

      
<script src="/path/to/locale.js"></script>
      
    

You can then either set the global default or you can it indvidually.

      
//load the RU locale
tempusDominus.loadLocale(tempusDominus.locales.ru);

//globally
tempusDominus.locale(tempusDominus.locales.ru.name);//set the default options to use Russian from the plugin

//picker
const datetimepicker1 = new tempusDominus.TempusDominus(document.getElementById('datetimepicker1'));
datetimepicker1.locale(tempusDominus.locales.ru.name);