New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@seb-l/i18n-xlsx-loader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@seb-l/i18n-xlsx-loader

Directly import an XLSX file in your project as source for i18n locales messages.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

i18n-xlsx-loader

Directly import an XLSX file in your project as source for i18n locales messages.

This loader extract the locales messages from an Xlsx file then convert them in javascript exported objects named after the locale name.

Each sheet name is used as root attribute in the final locale js object.

Example:

Sheet Name: common

keyfren
sidebar.hideSidebarMasquer la barre latéraleHide Sidebar

Sheet Name: login

keyfren
form.passwordMot de passePassword

will result to:

export const fr = {
  common: {
    sidebar: {
      hideSidebar: 'Masquer la barre latérale'
    }
  },
  login: {
    form: {
      password: 'Mot de passe'
    }
  }
}

export const en = {
  common: {
    sidebar: {
      hideSidebar: 'Hide Sidebar'
    }
  },
  login: {
    form: {
      password: 'Password'
    }
  }
}

Install

yarn add @seb-l/i18n-xlsx-loader -D

or

npm install @seb-l/i18n-xlsx-loader -D

Usage

Update your Webpack configuration

In your webpack.config.js file:

const path = require('path')

{
  ...,
  module: {
    rules: [
      {
        test: path.resolve('locales/translations.xlsx'),
        use: {
          loader: '@seb-l/i18n-xlsx-loader'
        },
      },
    ],
  },
  ...
}

Using with webpack-extend (for a Nuxt app in this example):

const path = require('path')

{
  ...
  extend (config, { isDev, isClient }) {
    config.module.rules.push(
      {
        test: path.resolve('locales/translations.xlsx'),
        loader: '@seb-l/i18n-xlsx-loader',
      }
    )
  }
  ...
}

In the file you want to use your translations in

import { fr, en } from '@/locales/translations.xlsx'

Keywords

FAQs

Package last updated on 12 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc