Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
kemar committed Jul 3, 2020
1 parent 8522036 commit e9fcf91
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,25 @@ make translations

Look at the included `Makefile` for an example.

## Elsewhere
# Usage of `translate` without Vue

### Support for Pug templates
For convenience `translate` can be imported directly in JavaScript files for cases where you need the translations from `translations.json` outside of `vue-gettext` (see [#113](https://github.com/Polyconseil/vue-gettext/pull/113)):

```js
import {translate} from 'vue-gettext';

const {gettext: $gettext} = translate;

let str = $gettext('Hello');
```

# Elsewhere

## Support for Pug templates

If you are using a template language, i.e. [Pug.js](https://pugjs.org/api/getting-started.html) in [Single File Component](https://vuejs.org/v2/guide/single-file-components.html) within a webpack setup (using vue-loader), have a look at [vue-webpack-gettext](https://github.com/kennyki/vue-webpack-gettext).

## Credits
# Credits

This plugin was inspired by:

Expand All @@ -462,6 +474,6 @@ This plugin was inspired by:
- [`angular-gettext`](https://angular-gettext.rocketeer.be)
- [`vue-i18n`](https://github.com/kazupon/vue-i18n)

## License
# License

[MIT](http://opensource.org/licenses/MIT)
2 changes: 2 additions & 0 deletions src/translate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import plurals from './plurals'

const SPACING_RE = /\s{2,}/g

// Default configuration if only the translation is passed.
let _config = {
language: '',
Expand Down Expand Up @@ -180,4 +181,5 @@ export default {
_config = config
}
},

}

0 comments on commit e9fcf91

Please sign in to comment.