Comments (2)
probably won't deal w/ this just yet; as a workaround for now, you can just add one more runtime extensions script to your page
ideally though it would be great to just have a single runtime dependency that includes i18n, i18nliner's extensions, and all the plugins' extensions
from i18nliner-js.
ideally though it would be great to just have a single runtime dependency that includes i18n, i18nliner's extensions, and all the plugins' extensions
This is what I did in my fork.
The readme for this project says:
You'll need to shoehorn i18n.js into your app, which (as of this writing) is not CJS-compatible
However, there is i18n-js which is CJS compatible. So I think you could make an endpoint in i18nliner, i18nliner/i18n
that would just require('i18n-js')
, then add the extensions to it and re-export it. I did that here:
https://github.com/Download/i18nline/blob/master/lib/i18n.js
You can repeat the same trick for react-i18nliner.
This solution requires end users to include 18nliner via react-i18nliner but I don't think that's so bad.
I don't think you should try to include all plugin's runtime extensions from i18nliner, because the runtime extensions need to be browserified/webpacked, and AFAIK there is no good way to do dynamic includes without bloating the web bundle. Best to make sure all require
calls have a literal string as their parameter so they are statically analyzable. This sort of rules out requiring stuff based on plugin configuration.
On another note, it's actually pretty tricky to get the configuration to the client, because the .18nrc file is only available on the server. Most of the options there apply only to the CLI, but there are some options related to the inferred key names that are needed on the client. If you configure these in .18nrc then the CLI will use the option, but you still have to do something to make sure this option is also set on the runtime... I am using the defaults to get around this because I haven't found a neat solution yet... My change of allowing config from package.json makes this problem worse, because you could potentially just require('./i18nrc')
from the client to serialize the settings (they would be included in the browserified/webpacked bundle), but it sucks to include the whole package.json...
from i18nliner-js.
Related Issues (20)
- inferred pluralization can cause key collisions
- broken symlinks cause check / export to fail HOT 1
- .i18nrc file, easy plugin registration mechanism
- load plugins first from .i18nrc HOT 2
- switch to recast
- underscoredKeyLength is ignored
- Parameterized i18nliner export HOT 2
- files with .jsx extensions is not being scanned to export HOT 2
- CallHelpers.keyifyUnderscored doesn't convert dashes to underscores
- upgrade speakingurl dependency HOT 1
- How to use with webpack/rollup? HOT 1
- How to use with custom template language?
- auto-pluralization doesn't work HOT 1
- grunt commands returns success code on failure
- output is inconsistent with i18nliner(.rb)
- extractor support for string concatenation in defaults
- rethink globby usage (or make globby faster?) HOT 6
- Export grunt command not registered
- whitespace should not be stripped from defaults HOT 1
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 i18nliner-js.