Giter Club home page Giter Club logo

Comments (5)

fgatti675 avatar fgatti675 commented on May 19, 2024 1

That would be awesome @PupoSDC !

from firecms.

fgatti675 avatar fgatti675 commented on May 19, 2024 1

Closing this for lack of activity

from firecms.

fgatti675 avatar fgatti675 commented on May 19, 2024

Hi @fabarea that would be great!
We currently don't have any localization framework in place. Do you have any suggestions?

from firecms.

fabarea avatar fabarea commented on May 19, 2024

I have made good experience with i18next and react-i18next. In the main index.ts you would find something like that:

// to be put quite "high" in the import list to have the i18 framework initialize early.
import './i18next-init'

In 18next-init.ts:

import i18next from 'i18next'
import common_en from './translations/en/common.json'
import common_es from './translations/es/common.json'

i18next.init({
  interpolation: { escapeValue: false }, // React already does escaping
  lng: 'fr', // language to use
  resources: {
    en: {
      translation: common_en
    }
    es: {
      translation: common_es
    },
    ...
  }
})

Then, it whatever file you can have something like that:

import i18next from 'i18next'

console.log(i18next.t('hello'))

Example for the productionCollution.ts

...
import i18next from 'i18next'

const productCollection = buildCollection({
  name: i18next.t('products'), // <------ 
  relativePath: 'products',
  schema: productSchema,
  textSearchDelegate: productsSearchDelegate,
  additionalColumns: [productAdditionalColumn],
  subcollections: [localeCollection],
  defaultSize: 'xs'
})

from firecms.

PupoSDC avatar PupoSDC commented on May 19, 2024

Hi @fgatti675, If this is low priority for you, I would like to give this a try. react-18next is also my favourite framework for this, so i would use that. I can Provide translation to Portuguese, and eventually, my company would appreciate having in german ;)

from firecms.

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.