Skip to content

Commit 6ca09dc

Browse files
committedJun 14, 2020
feat: adding i18n
1 parent f6cbef0 commit 6ca09dc

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed
 

‎docs/config/language.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
id: language
3+
title: language
4+
---
5+
6+
To localize and update the messages used in Grid.js.
7+
8+
- `optional`
9+
- Type: `{ [key: string]: string | (...args) => string }`
10+
- Example: [Internationalization](./examples/i18n.md)
11+
12+
```js
13+
new Grid({
14+
// ...
15+
language: {
16+
'search': {
17+
'placeholder': '🔍 Search...'
18+
},
19+
'pagination': {
20+
'previous': '⬅️',
21+
'next': '➡️',
22+
'showing': '😃 Displaying',
23+
'results': () => 'Records'
24+
}
25+
}
26+
});
27+
```
28+
29+
<br/>
30+
31+
:::tip
32+
See [en_US](https://github.com/grid-js/gridjs/blob/master/src/i18n/en_US.ts) for a full list of messages.
33+
:::

‎docs/config/search.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ To enable or disable the global search plugin
1717
|----------------------------|------------------------------|---------|---------------------|
1818
| enabled | to enable/disable the plugin | boolean | `true` or `false` |
1919
| keyword `optional` | to initiate with a keyword | string | `John` |
20-
| placeholder `optional` | search input placeholder | string | `Type a keyword...` |
2120
| server `optional` | to enable server integration | string | [Server-side search](./examples/server-side-search.md) |
2221
| debounceTimeout `optional` | search debounce timout | number | `1000` (1 second) |
2322

@@ -32,8 +31,13 @@ new Grid({
3231
['Nisen', 'nis900@gmail.com', '313 333 1923']
3332
],
3433
search: {
35-
enabled: true,
36-
placeholder: 'Search...'
34+
enabled: true
3735
}
3836
});
3937
```
38+
39+
<br/>
40+
41+
:::tip
42+
You can customize the search placeholder using the `language` config. See [Internationalization](./examples/i18n.md).
43+
:::
File renamed without changes.

‎sidebars.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = {
1212
'config/from',
1313
'config/columns',
1414
'config/server',
15+
'config/language',
1516
'config/width',
1617
'config/autoWidth',
1718
'config/search',

0 commit comments

Comments
 (0)
Please sign in to comment.