Skip to content

Commit 2a887d8

Browse files
committed
Prepare v3.1.0
1 parent 943b2a6 commit 2a887d8

File tree

3 files changed

+26
-17
lines changed

3 files changed

+26
-17
lines changed

timeago/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 3.1.0
4+
- Add warning when using a locale that has not been added.
5+
```dart
6+
timeago.format(parsedDate, locale: 'ru');
7+
8+
// Locale [ru] has not been added, using [en] as fallback. To add a locale use [setLocaleMessages]
9+
```
10+
- Add missing locales to web example
11+
- Add urdu messages @ibnshamas
12+
- Fix uk messages @alexnikitchuk
13+
- Fix pt_BR messages @araruna
14+
- Fix ar messages @yousef.su
15+
- Fix nl messages @vincentderidder
16+
317
## 3.0.2
418
- Update `sv` short messages @Kal-Elx
519

timeago/README.md

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,6 @@ A library useful for creating fuzzy timestamps. (e.g. "5 minutes ago")
66

77
[![Build Status](https://img.shields.io/github/workflow/status/andresaraujo/timeago.dart/Build?color=orange&label=actions&logo=github&logoColor=orange&style=for-the-badge)](https://github.com/andresaraujo/timeago.dart/actions)
88

9-
[![support](https://img.shields.io/badge/platform-web%7Cflutter%7Cdart%20vm-ff69b4.svg?style=flat-square)](https://github.com/andresaraujo/timeago.dart)
10-
11-
## About v2
12-
13-
- v2 of this library does not depend on package `intl` anymore, It didn't make sense for the small amount
14-
of text and now we can use the same code for browser, Flutter and server.
15-
16-
- API is now a lot simpler, no need to create instance just use the `format` method.
17-
18-
- Allows to add and override locales messages with `setLocaleMessages`
19-
20-
- All v1 locale messages are available to use, currently library only loads by default `en`, `en_short`, `es` and `es_short`.
21-
To add the remaining just call `setLocaleMessages`, see example.
229

2310
## Usage
2411

@@ -36,7 +23,12 @@ main() {
3623
}
3724
```
3825

39-
### Adding new locales
26+
##### IMPORTANT
27+
You need to add the locales you are going to use in your app otherwise you will get the default english messages.
28+
29+
Currently, it has only **english** preloaded and **spanish**. But the library provides messages for several locales, see [locale messages](lib/source/messages).
30+
31+
### Adding locales
4032

4133
```dart
4234
main() {
@@ -45,14 +37,17 @@ main() {
4537
// Add a new locale messages
4638
timeago.setLocaleMessages('fr', timeago.FrMessages());
4739
48-
// Override a locale message
49-
timeago.setLocaleMessages('en', CustomMessages());
40+
// You can override locale messages, with you own like this
41+
// where [MyCustomMessages] is a class that extends LookupMessages
42+
timeago.setLocaleMessages('en', MyCustomMessages());
5043
5144
print(timeago.format(fifteenAgo)); // 15 min ago
5245
print(timeago.format(fifteenAgo, locale: 'fr')); // environ 15 minutes
5346
}
5447
```
5548

49+
For a complete example of adding all provided locales see [example](example/main.dart)
50+
5651
### Live Demo
5752

5853
[Here](http://andresaraujo.github.io/timeago.dart/)

timeago/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: timeago
22
description: >
33
A library useful for creating fuzzy timestamps. (e.g. "15 minutes ago")
4-
version: 3.0.2
4+
version: 3.1.0
55
homepage: https://github.com/andresaraujo/timeago.dart
66

77
environment:

0 commit comments

Comments
 (0)