Skip to content

Commit e91d1e4

Browse files
committed
[update] localization updated, locale, setlocale added
1 parent 38676c5 commit e91d1e4

File tree

5 files changed

+89
-37
lines changed

5 files changed

+89
-37
lines changed

docs/api/config/booking-locale.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
sidebar_label: locale
3+
title: locale
4+
description: You can learn about the locale in the documentation of the DHTMLX JavaScript Booking library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Booking.
5+
---
6+
7+
# locale
8+
9+
### Description
10+
11+
@short: Optional. An object of a custom locale of Booking
12+
13+
### Usage
14+
15+
~~~jsx
16+
locale?: object;
17+
~~~
18+
19+
### Default config
20+
21+
By default, Booking uses the [English](/guides/localization/#default-locale) locale. You can set it to the custom locale as well.
22+
23+
:::tip
24+
To change the current locale dynamically, you can use the [`setLocale()`](/api/methods/booking-setlocale-method) method
25+
:::
26+
27+
### Example
28+
29+
~~~jsx
30+
const { data } = getData();
31+
const widget = new booking.Booking("#root", {
32+
data,
33+
locale: de,
34+
});
35+
~~~
36+
37+
**Related articles**:
38+
- [setLocale()](/api/methods/booking-setlocale-booking)
39+
- [Localization](/guides/localization)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
sidebar_label: setLocale()
3+
title: setLocale() Method
4+
description: You can learn about the setLocale() method in the documentation of the DHTMLX JavaScript Booking library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Booking.
5+
---
6+
7+
# setLocale()
8+
9+
### Description
10+
11+
@short: Applies a new locale to Booking
12+
13+
### Usage
14+
15+
~~~jsx
16+
setLocale(null | locale?: object): void;
17+
~~~
18+
19+
### Parameters
20+
21+
- `null` - (optional) resets to the default locale (English)
22+
- `locale` - (optional) the object of data of the new locale to be applied
23+
24+
### Example
25+
26+
~~~jsx {}
27+
// create Booking
28+
const booking = new booking.Booking("#root", {
29+
data,
30+
// initial configuration parameters
31+
});
32+
33+
// apply the "de" locale to Booking
34+
booking.setLocale(de);
35+
36+
// apply the default locale to Booking
37+
booking.setLocale(); // or setLocale(null);
38+
~~~
39+
40+
**Related articles**:
41+
- [locale](/api/config/booking-locale)
42+
- [Localization](/guides/localization)

docs/api/methods/booking_methodname_method.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

docs/guides/localization.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ Example:
198198
To apply a custom locale, you need to:
199199

200200
- create a custom locale object (or modify the default one) and provide translations for all text labels (it can be any language you need)
201-
- apply the new locale via its [`locale`](/api/config/locale-property) property or use the [`setLocale()`](/api/methods/setlocale-method) method
201+
- apply the new locale via its [`locale`](/api/config/locale-property) property or use the [`setLocale()`](/api/methods/booking-setlocale-method) method
202202

203203
~~~jsx
204-
// create Pivot
204+
// create Booking
205205
const widget = new booking.Booking("#root", {
206206
data,
207207
});
@@ -216,3 +216,7 @@ widget.setLocale(ko);
216216
In this snippet you can see how to switch through the *EN* and *DE* locales:
217217

218218
<iframe src="" frameborder="0" class="snippet_iframe" width="100%" height="600"></iframe>
219+
220+
**Related articles**:
221+
- [locale](/api/config/booking-locale)
222+
- [setLocale()](/api/methods/booking-setlocale-methods)

sidebars.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = {
3030
collapsible: true,
3131
collapsed: true,
3232
items: [
33-
"api/methods/booking_methodname_method",
33+
"api/methods/booking-setlocale-method",
3434
]
3535
},
3636
// Booking internal methods
@@ -94,6 +94,7 @@ module.exports = {
9494
"api/config/booking-filtershape",
9595
"api/config/booking-formshape",
9696
"api/config/booking-infoshape",
97+
"api/config/booking-locale",
9798
"api/config/booking-slotgap",
9899
"api/config/booking-slotsize",
99100
]

0 commit comments

Comments
 (0)