Comments (3)
+1 to this. As we've multiple ways for this implementation, as next steps, would be great if you can share how the API will be for a user that want to add multi-languague.
I'd keep the API as it's right now for users who don't need multi language.
from carto-react.
We can use a specific library to do that, there are some of them out there [1] and it seems react-intl is the most used.
It allows to include non-intrusive code to translate text and use different files for each supported language. The unique change is to change the current messages to message ids to be referenced from the language files.
[1] https://lokalise.com/blog/react-i18n-intl/
from carto-react.
I guess C4R exports a props interface to change the texts, so the responsibility is derived from the app and the multi-language is out.
An example:
<CategoryWidgetUI
...
texts={{
unlock: 'Unlock',
lock: 'Lock',
clear: 'Clear',
allSelected: (data) => `${data.length ? data.length : 'All'} selected`,
}}
/>
The CategoryWidgetUI
has a prop texts
(the name maybe change) where you pass the text or a function if the text dependent on a variable.
react-intl
is an excellent library to use from an external app.
from carto-react.
Related Issues (20)
- FormulaWidget issue with mode global disabled HOT 14
- [RFC] Add a territory selector widget HOT 3
- [RFC] Save custom geometries created with the SpatialFilter HOT 2
- [RFC] Support for Drop a Pin HOT 3
- [RFC] Comparative Widgets HOT 5
- [RFC] Save the state of the filters HOT 3
- [RFC] Spatial Filter HOT 11
- GeoJSON support in useCartoLayerProps HOT 1
- queryParameters HOT 7
- Remote executeModel doesn't work for POST requests HOT 4
- quadbinZoom error HOT 2
- Hygen is not working HOT 3
- [RFC] Widget size control HOT 1
- [RFC] Export AnimatedNumber component HOT 1
- [Bug] BarWidgetUI
- [RFC] Site Selection - Information element for widgets
- executeSQL function doesn't return the status error
- Allow passing decimal precision as a prop for CategoryWidgetUI HOT 4
- [Bug] ComparativeCategoryWidgetUI progress bar missing background color
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from carto-react.