You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/howto/specify-locale.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Specify a locale
2
2
3
-
`locale` is a two letter [ISO639](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code that `git-revision-date-localized` uses to display dates in your preferred language.
3
+
`locale` is aa two letter [ISO639](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code (f.e. `en`) or [5-letter language code with added territory/region/country](https://www.mkdocs.org/user-guide/localizing-your-theme/#supported-locales) (`en_US`) that `git-revision-date-localized` uses to display dates in your preferred language.
4
4
5
5
For example:
6
6
@@ -68,6 +68,7 @@ plugins:
68
68
If no `locale` is specified anywhere, the fallback is English with the US date format (`en`).
69
69
70
70
!!! info "Supported locales"
71
+
71
72
- When used in combination with `type: date` or `type: datetime`, translation is done using [babel](https://github.com/python-babel/babel) which supports [these locales](http://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html)
72
73
73
74
- When used in combination with `type: timeago` then [timeago.js](https://github.com/hustcc/timeago.js) is added to your website, which supports [these locales](https://github.com/hustcc/timeago.js/tree/master/src/lang). If you specify a locale not supported by timeago.js, the fallback is English (`en`)
Copy file name to clipboardExpand all lines: docs/options.md
+14-8Lines changed: 14 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,27 +53,33 @@ Default is `UTC`. Specify a time zone database name ([reference](https://en.wiki
53
53
54
54
## `locale`
55
55
56
-
Default is `None`. Specify a two letter [ISO639](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code to display dates in your preferred language. Note this plugin supports many different ways to [specify the locale](howto/specify-locale.md), but if not specified anywhere the fallback is English (`en`).
56
+
Default is `None`. Specify a two letter [ISO639](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code (f.e. `en`) or [5-letter language code with added territory/region/country](https://www.mkdocs.org/user-guide/localizing-your-theme/#supported-locales) (`en_US`) to display dates in your preferred language. Note this plugin supports many different ways to [specify the locale](howto/specify-locale.md), but if not specified _anywhere_ the fallback will be English (`en`). `locale` is used to translate timestamps to dates when `type: date` or `type: datetime` (using [babel](https://github.com/python-babel/babel)) as well as to translate datetimes to a relative timeago string when `type: timeago` (using [timeago.js](https://github.com/hustcc/timeago.js)).
57
57
58
58
Example outputs:
59
59
60
60
```yaml
61
-
April 27, 2021 # `locale: en` with `type: date` (default)
62
-
April 27, 2021 13:11:28 # `locale: en` with `type: datetime`
63
-
2 weeks ago # `locale: en` with `type: timeago`
64
-
27 de marzo de 2021 # `locale: es` with `type: date`
65
-
27 de marzo de 2021 13:57:28 # `locale: es` with `type: datetime`
66
-
hace 2 semanas # `locale: es` with `type: timeago`
61
+
# `locale: en`
62
+
April 27, 2021 # with `type: date` (default)
63
+
April 27, 2021 13:11:28 # with `type: datetime`
64
+
2 weeks ago # with `type: timeago`
65
+
# `locale: es`
66
+
27 de marzo de 2021 # with `type: date`
67
+
27 de marzo de 2021 13:57:28 # with `type: datetime`
68
+
hace 2 semanas # with `type: timeago`
67
69
```
68
70
69
71
=== ":octicons-file-code-16: mkdocs.yml"
70
72
71
73
```yaml
72
74
plugins:
73
75
- git-revision-date-localized:
74
-
locale: en
76
+
locale: en_US
75
77
```
76
78
79
+
!!! note when using `type: timeago`
80
+
81
+
When using `type: timeago` then [timeago.js](https://github.com/hustcc/timeago.js) is added to your website, which supports [these locales](https://github.com/hustcc/timeago.js/tree/master/src/lang). If you specify a locale not supported by timeago.js, the fallback is English (`en`). It might happen that your specific locale is supported by babel (used by date formats) but not by timeago. In that case open an issue with this plugin.
0 commit comments