Skip to content

Commit

Permalink
Update release process.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmariuzzo committed Feb 11, 2019
1 parent 19e96b4 commit 42be28f
Show file tree
Hide file tree
Showing 3 changed files with 1,565 additions and 44 deletions.
63 changes: 32 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ npm install lang.js@next
```js
var lang = new Lang({
messages: source, // required
locale: "fr", // optional
fallback: "zn" // optional
});
locale: 'fr', // optional
fallback: 'zn' // optional
})
```

### Messages source format
Expand Down Expand Up @@ -60,15 +60,15 @@ See the sample used in tests located at: `test/fixture/messages.json`.
Set messages source. Check [messages source format](#messages-source-format).

```js
lang.setMessages(source);
lang.setMessages(source)
```

### `getLocale`

Get the current locale, if none set, the default locale will be returned (`en`).

```js
lang.getLocale();
lang.getLocale()
// > "en"
```

Expand All @@ -77,15 +77,15 @@ lang.getLocale();
Set the current locale.

```js
lang.setLocale("ht");
lang.setLocale('ht')
```

### `getFallback`

Get the fallback locale.

```js
lang.getFallback();
lang.getFallback()
// > de
```

Expand All @@ -96,22 +96,22 @@ Set the fallback locale for messages not found using the default locale.
```js
var lang = new Lang({
messages: {
"en.greetings": {
hi: "Hi",
hello: "Hello"
'en.greetings': {
hi: 'Hi',
hello: 'Hello'
},
"it.greetings": {
hi: "Salve"
'it.greetings': {
hi: 'Salve'
}
}
});
})

lang.setLocale("it");
lang.get("greetings.hello");
lang.setLocale('it')
lang.get('greetings.hello')
// > "greetings.hello"

lang.setFallback("en");
lang.get("greetings.hello");
lang.setFallback('en')
lang.get('greetings.hello')
// > "Hello"
```

Expand All @@ -120,16 +120,16 @@ lang.get("greetings.hello");
Indicate if a given key is defined on the messages source.

```js
lang.has("greetings.hi");
lang.has('greetings.hi')
```

### `get`

Get a translation message.

```js
lang.get("greetings.hi");
lang.get("forum/thread.hello");
lang.get('greetings.hi')
lang.get('forum/thread.hello')
```

### `trans`
Expand All @@ -141,10 +141,10 @@ This method act as an alias of [`get()`](#get).
Get the plural or singular form of the message specified based on an integer value.

```js
lang.choice("fruits.apple", 1);
lang.choice('fruits.apple', 1)
// > "apple"

lang.choice("fruits.apple", 4);
lang.choice('fruits.apple', 4)
// > "apples"
```

Expand All @@ -153,25 +153,25 @@ You may even create more complex pluralization rules which specify translation s
```js
var lang = new Lang({
messages: {
"en.fruits": {
apple: "{0} There are none|[1,19] There are some|[20,*] There are many"
'en.fruits': {
apple: '{0} There are none|[1,19] There are some|[20,*] There are many'
}
}
});
})

lang.choice("fruits.apple", 0);
lang.choice('fruits.apple', 0)
// > "There are none"

lang.choice("fruits.apple", 1);
lang.choice('fruits.apple', 1)
// > "There are some"

lang.choice("fruits.apple", 3);
lang.choice('fruits.apple', 3)
// > "There are some"

lang.choice("fruits.apple", 20);
lang.choice('fruits.apple', 20)
// > "There are many"

lang.choice("fruits.apple", 22);
lang.choice('fruits.apple', 22)
// > "There are many
```

Expand Down Expand Up @@ -202,5 +202,6 @@ To run the tests use the following commands:
We do deployment using `np`:

```bash
np 2.0.0-beta.n --tag=next --any-branch
npm run release:next
npm run release:stable
```
Loading

0 comments on commit 42be28f

Please sign in to comment.