Yes and yes. I removed the first ‘/’ and I did find the folder in ‘www/assets’ so both of those are check. I cannot get the pipes to work though, even though I tried with both lower- and uppercase keys. All I am getting is the input key as the output when I call the pipe like this:
{{ ‘HOME.TITLE’ | translate }}
results in:
HOME.TITLE
I had added the TranslateService to the providers array in the app.module.ts, which I now removed, I changed my imports to what yours where (I imported all of that through ng-translate/ng-translate before). I set the language and success! I finally got confirmation that it is actually looking for a language! Now it is just saying that it can’t find the file, but I should be able to fix that with some tweaking of the path.
OK so what I had to do was keep the first ‘/’ in my path string, making it like the following ‘/assets/i18n’. Must’ve been some imports and config that was incorrect. It is now working as expected. Kudos to you @jrierab, thank you very much for all the help!
Exactly, the issue you had, “KEY instead of translation displayed”, I had it on real device (or ionic run) but not while debugging (ionic serve)…but yep maybe that is just something related to my project at the end
I tried to run it in the emulator, and I am not getting the same error as before, instead nothing shows up, not even the key. I think it could be about missing permissions on the device perhaps? Or a missing step in the build process where the file doesn’t get loaded?
Well I can’t tell, in my case to solve that issue I really had to remove the first ‘/’…
Maybe in your case it’s something else. Like do you still have got somewhere some compilations error (even when there is a compilation error the build process continue and run the app). Have a look at your build logs.
Alright, update on the issue. So IN THE DEBUGGER (using ionic serve) I need to use a forward slash at the start of the translation path. HOWEVER, when running on the emulator, I must remove the forward slash, and it works. Probably has to do with how different devices handle path maybe? If someone could double check this on an android device, that would be great.
NOTE: I am running the ionic serve debugging instance on chrome, have yet to try safari (CORS issues, too lazy to fix)
Yep that seemed to do the trick, using ‘./assets/i18n’ made it work on both emulator (using xcode to build it, not ionic emulate, but ionic build iOS and then using xcode and targeting emulator) and the browser using ionic serve!
Coolio! Same for me actually. ‘./assets/i18n’ works with “ionic serve” and “ionic build android” tested on my real phone device. Gonna witch to that too. Thx