Comments (4)
@AdamRamberg, check out this commit here in the fbt-npm-app repo for an example on splitting dictionaries by locale. I'm using webpack's dynamic import syntax in the Example react app for this.
I'm just appending to the "translation dictionary" (which FBT's init
is hanging onto) as seen here.
Incorporating this logic into translate.js itself should be straightforward.
Note: You'll need the babel-plugin-fbt
module version 0.9.13
for the --plugins
CLI option if you intend to use the babel transform for dynamic import.
from fbt.
First of all, thanks for making fbt open source! 🙏
Much obliged :)
in the application gets passed to the fbt's init function. This means that we need to load all translations at once!
Well that's what the demo currently does, but even with the way the the transform
script is currently written, you could elect to create a separate dictionary for each language and init
whenever you want to load a new one (or your async pull request comes back etc etc). If it'd be helpful I can update https://github.com/jrwats/fbt-npm-app to do this.
But even better... I'll gladly review any pull request you'd like to make to ease the pain using the translation script. It'd be nice, for instance, if you could run the script once instead of per locale.
from fbt.
Ah alright! Great to hear that init
supports being called once per locale.
I agree that it would be really nice if you only need to run the translation script once. I'm currently pretty swamped with work so I will not make any promises, but if I find the time I will for sure make a PR.
Not closing the issue since it might be nice to keep it open until the translation script has been worked on.
from fbt.
@jrwats Awesome! Thanks!
Shouldn't be too hard to implement the splitting by locale in translate.js. I will take a stab at it and make PR.
from fbt.
Related Issues (20)
- Documentation: how to format plural Localizable.strings in iOS
- Provide simple debug mode HOT 5
- No published version of babel-plugin-fbt since 0.13.0-beta HOT 2
- Remove fbjs dependency HOT 2
- Feature: publish eslint rules to help promote better Fbt API usage practices HOT 1
- Fix Support for Shared Enum Typescript/ES6 Import/export syntax with Babel 7 HOT 3
- Can't install FBT with npm HOT 1
- node-fetch vulnerability transitive from isomorphic-fetch HOT 3
- Unable to install react-native-fbt in expo SDK 45 bare workflow #33797 HOT 7
- Bug: unable to extract `intlList`
- Vite support HOT 1
- React 18 support
- unexpected pluralization behavior
- RTC-Folly outdated with lastest react native version (0.70.1) HOT 2
- Ols
- react-native-fbt not working on lastest React Native version (0.70.6) HOT 3
- Make `fbt` work with other compilers like SWC HOT 2
- New release? HOT 1
- fbt.plural manifest is wrong in --react-native-mode
- Copyright and footer logo needs to be updated
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 fbt.