Skip to content

unplugin for fluent-vue. Adds support for custom blocks in Vue SFC and external ftl files.

License

Notifications You must be signed in to change notification settings

fluent-vue/unplugin-fluent-vue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

9743932 · Mar 23, 2023
Mar 17, 2023
Jul 20, 2022
Mar 23, 2023
Mar 23, 2023
Mar 23, 2023
Jul 20, 2022
Jul 20, 2022
Sep 17, 2022
Mar 23, 2023
Jul 20, 2022
Mar 22, 2023
Mar 22, 2023
Mar 23, 2023
Mar 22, 2023
Feb 13, 2023
Jul 26, 2022
Jul 31, 2022
Jul 26, 2022
Jul 26, 2022
Jul 30, 2022
Jul 26, 2022

Repository files navigation

unplugin-fluent-vue

GitHub Workflow Status codecov Standard - JavaScript Style Guide GitHub license

fluent-vue plugin for Vite, Webpack and Rollup (thanks to unplugin).

It adds support for defining Fluent messages in Vue SFCs and external ftl files.

Installation

npm install unplugin-fluent-vue --save-dev

Usage

Vite

// vite.config.js
import { defineConfig } from 'vite'
import {
  ExternalFluentPlugin,
  SFCFluentPlugin,
} from 'unplugin-fluent-vue/vite'

export default defineConfig({
  plugins: [
    vue(),
    // Choose one of the following:
    SFCFluentPlugin({ // define messages in SFCs
      blockType: 'fluent', // default 'fluent' - name of the block in SFCs
      checkSyntax: true, // default true - whether to check syntax of the messages
    }),
    ExternalFluentPlugin({ // define messages in external ftl files
      baseDir: path.resolve('src'), // required - base directory for Vue files
      ftlDir: path.resolve('src/locales'), // required - directory with ftl files
      locales: ['en', 'da'], // required - list of locales
      checkSyntax: true, // default true - whether to check syntax of the messages
    }),
  ],
})

Docs: https://fluent-vue.demivan.me/integrations/unplugin.html