README.md in i18n-js-3.0.11 vs README.md in i18n-js-3.1.0
- old
+ new
@@ -337,11 +337,16 @@
```
You can also interpolate values:
```javascript
-I18n.t("hello", {name: "John Doe"});
+// You need the `translations` object setup first
+I18n.translations["en"] = {
+ greeting: "Hello %{name}"
+}
+
+I18n.t("greeting", {name: "John Doe"});
```
You can set default values for missing scopes:
```javascript
// simple translation
I18n.t("some.missing.scope", {defaultValue: "A default message"});
@@ -574,18 +579,20 @@
}
}
I18n.l("date.formats.ordinal_day", "2009-09-18", { day: '18th' }); // Sep 18th
```
-If you prefer, you can use the `I18n.strftime` function to format dates.
+If you prefer, you can use the `I18n.toTime` and `I18n.strftime` functions to format dates.
```javascript
var date = new Date();
+I18n.toTime("date.formats.short", "2009-09-18");
+I18n.toTime("date.formats.short", date);
I18n.strftime(date, "%d/%m/%Y");
```
-The accepted formats are:
+The accepted formats for `I18n.strftime` are:
%a - The abbreviated weekday name (Sun)
%A - The full weekday name (Sunday)
%b - The abbreviated month name (Jan)
%B - The full month name (January)
@@ -810,9 +817,16 @@
If sprockets is loaded after this gem, the preprocessor for
making JS translations file cache to depend on content of locale files will not be hooked.
So ensure sprockets is loaded before this gem like moving entry of sprockets in Gemfile or adding "require" statements for sprockets somewhere.
**Note:** See issue [#404](https://github.com/fnando/i18n-js/issues/404) for more details and discussion of this issue.
+
+### JS `I18n.toCurrency` & `I18n.toNumber` cannot handle large integers
+
+The above methods use `toFixed` and it only supports 53 bit integers.
+Ref: http://2ality.com/2012/07/large-integers.html
+
+Feel free to find & discuss possible solution(s) at issue [#511](https://github.com/fnando/i18n-js/issues/511)
## Maintainer
- Nando Vieira - <http://nandovieira.com.br>