npm.io
1.0.2 • Published 6 years ago

next-i18n-keys

Licence
MIT
Version
1.0.2
Deps
3
Size
6 kB
Vulns
0
Weekly
0
Stars
1

Welcome to next-i18n-keys

Version Documentation License: MIT

Auto generate next.js page's i18n keys

Homepage

Install

yarn install

Configuration

// next.config.js
const NextI18nKeysWebpackPlugin = require('next-i18n-keys');

// ...
  config.plugins.push(
    // ...
    new NextI18nKeysWebpackPlugin({
      // RegExp of placeholder in source file
      matchReg: /'\^__I18N_KEYS__\
// pages/*.js
Page.getInitialProps = async () => {
  // a object of i18n data
  const data = await fetch('https://...');
  // placeholder of keys, will be replaced by plugin
  const keys = '^__I18N_KEYS__

Author

Sora Liu 475212506@qq.com

Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ️ if this project helped you!

License

Copyright 2019 Sora Liu 475212506@qq.com.
This project is MIT licensed.

/
, funcList: ['i18next.t', 'i18n.t'], }), // ... ); // ...
__CODE_BLOCK_2__

Author

Sora Liu 475212506@qq.com

Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ️ if this project helped you!

License

Copyright 2019 Sora Liu 475212506@qq.com.
This project is MIT licensed.

; const i18n = keys.reduce((obj, key) => (obj[key] = data[key], obj), {}); return { i18n, }; }

Author

Sora Liu 475212506@qq.com

Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ️ if this project helped you!

License

Copyright 2019 Sora Liu 475212506@qq.com.
This project is MIT licensed.

/, funcList: ['i18next.t', 'i18n.t'], }), // ... ); // ... __CODE_BLOCK_2__

Author

Sora Liu 475212506@qq.com

Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ️ if this project helped you!

License

Copyright 2019 Sora Liu 475212506@qq.com.
This project is MIT licensed.