i18next-resource-store-loader's Issues
empty .gitkeep file make parser error
Structure
|-- src
|-- assets
|-- i18n
|-- base
|-- en
|-- .gitkeep
|-- translatrion.json
|-- index.js
empty .gitkeep file make parser error
but {} .gitkeep file is OK
[Question] Usage with react native expo
I'm new with i18n and all and wants to implement it in react native expo but could not find any resources providing information on using it. Can anyone answer how to bundle translations with this module in react native module?
Lodash as peerDependency
What do you think about setting lodash as peerdependency? I have a project which has lodash as dependency and adding your package produce two version of it. Also you use only one function from lodash. There may be an opportunity to get rid of it completely?
Support for react-native
Is there anyway to use this loader in react-native
Dashes in directory names
It doesn't work in case we have dirs with dashes, like zh-cn
. The problem might be in using dir name as JavaScript property name.
Use index.js for configuration
The newly added Include and exclude configurations could also be part of the index.js file which is needed anyways. It could hold a real json-object and be the place for future configurations as well.
Confused about index.js
Why do you need to load the bundle via an empty index.js file?
Module not found: Error: Can't resolve 'locales/locales.js'
Hi,
First, thanks for the work !
I tried including it in my application, but webpack complains :
ERROR in ./app/index.js
Module not found: Error: Can't resolve 'locales/locales.js' in 'D:_projets\sso\login\app'
@ ./app/index.js 6:16-75
@ multi (webpack)-dev-server/client?http://localhost:8080 ./app/index.js
webpack: Failed to compile.
Here is my webpack.config.js :
const webpack = require('webpack');
var path = require('path');
export default {
context: APP,
entry: {
app: './app/index.js'
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
}
};
My files :
- app
- locales
- en.json
- fr.json
- locals.js
- index.js
- locales
- package.json
- webpack.config.js
And my index.js :
var $ = require("jquery");
var i18next = require("i18next");
var i18nextBrowserLanguageDetector = require("i18next-browser-languagedetector");
var resBundle = require(
"i18next-resource-store-loader!locales/locales.js"
);
i18next
.use(Backend)
.use(i18nextBrowserLanguageDetector)
.init({
fallbackLng: 'en',
debug: false,
resources: resBundle
}, function(err, t) {
// init set content
translate();
});
var translate = function() {
$(".header").localize();
$(".content").localize();
}
package.json :
{
"name": "my-app",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"babel-polyfill": "6.23.0",
"babel-preset-es2015": "6.24.1",
"babel-register": "6.24.1",
"i18next": "^8.4.0",
"i18next-browser-languagedetector": "^1.0.1",
"i18next-resource-store-loader": "^0.1.1",
"jquery": "3.2.1",
"jquery-i18next": "^1.2.0",
"webpack": "^2.6.1"
},
"devDependencies": {
"babel-core": "6.24.1",
"babel-loader": "7.0.0",
"webpack": "^2.6.1",
"webpack-dev-server": "^2.4.5"
},
"scripts": {
"start": "webpack-dev-server"
}
}
proposal: major version - ordered directories (multiple overrides), json or yaml content
These are features I'll need so I'm going to build it either way. I'm wondering if you'll want the changes:
- Allow for multiple locale directories e.g.
dirs[0]
is a base dir, whereasdirs[5]
would be the most specialized dir - json or yaml content parsing - default to json, but allow for a type to specify yaml parsing.
I'll fork and build it, I can PR it and see if you are interested. If you have any other thoughts, please let me know.
loader with webpack
Hi,
I was wondering if there is a way to use the resource-store-loader with webpack. Is there a way to require the loader using the webpack config files?
On a separate note, I run into an error when using it with a symlink. I have a locales directory which is being loaded into my app via bower install from a git repo. I have been using a symlink to modify the translation.json files from the repo locally, and have those changes picked up by my app. However, when I load the translation.json files into i18next, using the resource store loader, I get an error from the index.js file in my symlink-ed directory: "Module build failed: SyntaxError: Unexpected token #". If I instead point to a non-symlinked directory, it works fine. Any way to make a symlink work?
It tries to parse the .git directory ^^
Thanks!
question: overrideDir in a different module (webpacked browser app)
Context
widgets
base (in-house) widget library with localizationapp1
(of many) useswidgets
and overrides some text
As I look at the code, it seems like overrideDir
expects a relative path. I see no reason I couldn't provide overrideDir=../../app1/i18n
, do you? I was concerned about a webpacked app finding files, but perhaps this is a non-issue?
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.