VulcanJS / Vulcan

🌋 A toolkit to quickly build apps with React, GraphQL & Meteor
http://vulcanjs.org
MIT License
7.98k stars 1.89k forks source link

Better i18n support (language switching, localized content, etc.) #1981

Closed SachaG closed 6 years ago

SachaG commented 6 years ago

I've started working on better i18n on the i18n2 branch: https://github.com/VulcanJS/Vulcan/tree/i18n2

Overview

The main feature is the ability to localize user content, in other words support multiple languages for, e.g. a movie title or description.

Data Storage

Instead of storing the title field as a String, it will now be stored as an Object of the form {en: 'Die Hard', fr: 'Piège de cristal'}.

The cool thing with GraphQL is that the API can still return a String, meaning you wouldn't have to update any of your front-end code to support multiple languages.

Issues/Questions:

Internationalizing a Field

For string fields, change type: String to type: getIntlString() in your schema.

Issues/Questions:

Selecting a Locale

This is still a WIP, but there are currently two ways:

Issues/Questions:

SmartForm

Works out of the box:

https://d3vv6lp55qjaqc.cloudfront.net/items/1S0p2e2v3m1c1e2H1201/Screen%20Shot%202018-05-09%20at%2011.07.33.png?X-CloudApp-Visitor-Id=43642&v=7b45abd0

Links

See also previous threads:

SachaG commented 6 years ago

See http://docs.vulcanjs.org/internationalization.html