Comments (17)
You can check the 2 examples starters that updated with ng2-translate, maybe that will help you since they both use SystemJS: https://github.com/ocombe/ng2-play/tree/ng2-translate & https://github.com/ocombe/angular2-seed/tree/ng2-translate
from core.
I think this might be a solution:
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
},
'ng2-translate': {'defaultExtension': 'js'},
'rxjs': {'defaultExtension': 'js'}
},
map: {
ng2-translate': 'node_modules/ng2-translate',
'rxjs': 'node_modules/rxjs'
}
});
from core.
Hello,
what is your building system: gulp, webpack, ... ?
Do you use SystemJS ? If so can you give me your config for SystemJS ?
from core.
Actually the config is quite simple:
<script>
System.config({
packages: {
'app': { defaultExtension: 'js' }
}
});
System.import('app/app');
</script>
What about have a single bundle?
from core.
Yes I will have to do that eventually, it would help people setup their projects :)
from core.
Hello,
I have similar issue. I'm using SystemJS and gulp to build app:
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app/boot').then(null, console.error.bind(console));
</script>
I have this error:
Uncaught ReferenceError: require is not defined
GET http://localhost:4000/ng2-translate/ng2-translate 404 (Not Found)
Error: XHR error (404 Not Found) loading http://localhost:4000/ng2-translate/ng2-translate(…)
GET http://localhost:4000/ng2-translate/ng2-translate 404 (Not Found)
What do you think?
from core.
That you need to define the default extension for ng2 translate as well: https://github.com/ocombe/ng2-translate#installation
System.config({
packages: {
"/ng2-translate": {"defaultExtension": "js"}
}
});
from core.
Thank you for fast respond.
Unfortunately this not fixed my problem, SystemJS doesn't recognize ng2-translate package when I'm concatenating all libraries to common file. I tried to copy ng2-translate folder to my build version and now not recognize rxjs. So I'm also copying rxjs folder to build version and now works fine. I need to find reason this situation.
I have one more question, do you base on any other library to translation from angular1 like: angular-translate or something?
from core.
No other library, just Angular 2 & RxJS (which is required by angular 2 anyway)
from core.
Yes I know rxjs is required, I'm using it in other components but ng2-translate doesn't recognize it and I have no idea why. Probably there is something wrong with my SystemJS config.
from core.
Yes I based on them, but you're using node_modules libraries directly and in System.config you are maping ng2-translate and rxjs. I use different approach, I'm concatenate all node_module libraries to one file and load them in one request. And then ng2-translate is not loaded by SystemJS.
Btw thank you for your help :)
from core.
Ok so that is the problem, you cannot concatenate libraries manually because of the interdependence between modules, you need to use SystemJS builder to do that for you, it will make sure that your references go to the right bundled module.
from core.
I may be seeing a similar issue with my deployment of the module, although I am able to reference the ng2-translate files correctly. The issue arises after the package is deployed and referenced correctly, but the following errors are observed:
GET http://localhost:7000/Application_1/dist/dev/rxjs/add/observable/fromArray.js 404 (Not Found)
GET http://localhost:7000/Application_1/dist/dev/rxjs/add/operator/share.js 404 (Not Found)
Error: XHR error (404 Not Found) loading http://localhost:7000/Application_1/dist/dev/rxjs/add/observable/fromArray.js(…) -> SystemJS module load failure
I have a bit of a strange outlier case where my project looks like this:
Root/
---Application_1/
------dist/
---------dev/
------------app/
------------boot.js
------------Index.html
------app/
---------Index.html
---------boot.ts
node_modules/
Node is hosting from the root directory, so the URL to browse my dist is http://localhost:7000/Application_1/dist/dev. Angular 2 is loading perfectly, as is Polymer, but for some reason as soon as I add ng2-translate, it can find the root files but won't load those components of RXJS.
Sorry for the bother, i18n is a major aspect of our software so we need to find a viable solution in Angular 2.
from core.
No problem. Are you using beta3? (I haven't tested it yet).
What version of RxJS do you use?
Can you load RxJS components from within your application?
from core.
My packages are as follows:
"angular2": "2.0.0-beta.2"
"rxjs": "5.0.0-beta.0"
I (believe) I can load RxJS components from within the application, I have the angular2-seed working correctly, and have my own custom components all being loaded properly.
from core.
Works perfectly! Much obliged, we're still getting used to SystemJS
from core.
Ok nice!
If necessary you can now find a bundle file in the bundles folder.
from core.
Related Issues (20)
- setTranslation is confusing the translation
- bump angular 17 HOT 3
- Translation keys are ignored when dot format and nested format are mixed
- How to handle import TranslateModule.forChild in module when creating a standalone component in an NgModule Application HOT 8
- How to use ngx-translate in Angular 17, Knowing that AppModule is not implemented? HOT 2
- Support for Angular v17 HOT 28
- ngx-translate creates billions of tiny files HOT 1
- Using ngx-translate in a standalone component HOT 3
- 'EventEmitter' and 'DefaultLangChangeEvent' is declared but its value is never read.
- Angular 17 SSR. Standalone implementation - NullInjectorError: No provider for _TranslatePipe! HOT 1
- I am trying to add Arabic language. I have configured package correctly but some labels are translated some are not
- Latency when loading the website, because Translation Key appears when user opens our website HOT 1
- Add opption to pass callback in translate pipe
- ncaught SyntaxError: Cannot use import statement outside a module (at scripts.js:16887:1) main.ts:13 Error: Unexpected value 'TranslateModule' imported by the module 'AppModule'. Please add an @NgModule annotation. at verifySemanticsOfNgModuleDef (core.mjs:28868:5) at core.mjs:28878:5 at Array.forEach (<anonymous>) at verifySemanticsOfNgModuleDef (core.mjs:28876:43) at AppModule.get (core.mjs:28833:23) at getInjectorDef (core.mjs:333:1) at walkProviderTree (core.mjs:5550:1) at core.mjs:5500:6 at core.mjs:4701:1 at Array.forEach (<anonymous>)
- Wrong TranslateHttpLoader after upgrade app to Angular 17
- ngx-translate not working with interceptor in Ionic Capacitor app
- Error: [$injector:unpr] Unknown provider: translateProvider <- translate
- Configuration: defaultLanguage in TranslateModule.forRoot as a Provider HOT 1
- ngx-translate.com is pointing another website HOT 3
- Ngx-translate: ..assets/i18n/ja.json: 404 Not Found after deployment
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 core.