Coder Social home page Coder Social logo

Comments (12)

reemhamz avatar reemhamz commented on June 15, 2024

Hey there @Demivan! Wondering if support for Nuxt is underway. I'm trying to introduce Nuxt for one of our projects here and having Fluent support would be grande.

from fluent-vue.

Demivan avatar Demivan commented on June 15, 2024

I will be starting on it tomorrow. I was busy with my main job, so didn't have time to work on it before.
@reemhamz Are you planning to use Nuxt 2 or 3?

from fluent-vue.

reemhamz avatar reemhamz commented on June 15, 2024

@Demivan no worries! Thanks for taking the time to work on this. Currently just Nuxt2 since Nuxt3 is still in Beta, but once that version is stable and up to par, I'd be happy to migrate to Nuxt3, but that's a later problem.

from fluent-vue.

Demivan avatar Demivan commented on June 15, 2024

I have added a simple Nuxt 2 example: https://github.com/fluent-vue/examples/tree/main/nuxt-2

Implementing something like https://github.com/nuxt-community/i18n-module will take much more time. I'd rather work on making v-t directive compatible with SSR for now. When Nuxt 3 is stable I should be able to use nuxt-kit to implement analog of i18n-module that is Nuxt 2 and Nuxt 3 compatible.

from fluent-vue.

Demivan avatar Demivan commented on June 15, 2024

SSR support wasn't that bad. :) I have merged it to that example.

I will extract Nuxt build module to a separate package later.

from fluent-vue.

0xMANFRE avatar 0xMANFRE commented on June 15, 2024

Reimplement @nuxtjs/i18n for fluent-vue. Probably when @nuxt/i18n is updated to Nuxt 3

@Demivan is the Nuxt 3 module still worked on?
The pluralisation syntax of vue-i18n and @nuxtjs/i18n is terrible and has zero flexibility compared to Fluent or even MessageFormat.
I would love to switch to a future @nuxtjs/fluent or @fluent-vue/nuxt when it will become available.

from fluent-vue.

Demivan avatar Demivan commented on June 15, 2024

@0xMANFRE @nuxtjs/i18n is huge and has lots of features. It will be few times bigger than fluent-vue itself. I don't have time to reimplement everything.
But basic integration of fluent-vue into Nuxt is easy. You add unplugin-fluent-vue Vite plugin and create a custom Nuxt plugin that initializes fluent-vue. Code is SSR compatible already.

from fluent-vue.

Demivan avatar Demivan commented on June 15, 2024

By the way, I plan to support MessageFormat 4 when the syntax is finalized.

from fluent-vue.

0xMANFRE avatar 0xMANFRE commented on June 15, 2024

But basic integration of fluent-vue into Nuxt is easy. You add unplugin-fluent-vue Vite plugin and create a custom Nuxt plugin that initializes fluent-vue. Code is SSR compatible already.

The documentation provides only a Vite config file.
Is there a working Vue 3 example that has external locale files and a locale switcher? I can't seem to find it.

from fluent-vue.

Demivan avatar Demivan commented on June 15, 2024

There is no Nuxt 3 example. I will create it and link it here.

from fluent-vue.

Demivan avatar Demivan commented on June 15, 2024

Added Nuxt 3 example https://github.com/fluent-vue/examples/tree/main/nuxt-3. Check the plugins and modules folders for implementation. You still need some way of selecting the current locale on the server, but that really depends on your site (is it per domain, path or read from cookie)

What is not working is SSR for the v-t directive. I almost never use it, but I will work on the SSR implementation this week.

from fluent-vue.

Demivan avatar Demivan commented on June 15, 2024

Nuxt 3 integration is done. Docs can be found here: https://fluent-vue.demivan.me/integrations/nuxt

from fluent-vue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.