evertonrobertoauler / cli-universal-demo

80 stars 18 forks source link

language change print out in html #27

Closed chriseugenerodriguez closed 7 years ago

chriseugenerodriguez commented 7 years ago

@evertonrobertoauler really appreciate you helping me on translation issue, anyway I have language print out in html when I change language?

evertonrobertoauler commented 7 years ago

yes, but it prints the default language, that is 'en'

you can get the user language on the server with the accept-language header, just change the server.ts and app.component.ts as the following gists:

https://gist.github.com/evertonrobertoauler/20c572bf6f49123dc3debabeba097e44

https://gist.github.com/evertonrobertoauler/3c208d3f2bf7bf68748eb569f58bed79

screenshot from 2017-07-14 22-07-35

chriseugenerodriguez commented 7 years ago

@evertonrobertoauler hey thanks for this info. I managed to change these two files, but no luck. I added it to repo too if you could check.

evertonrobertoauler commented 7 years ago

@premiumwd here it is working just fine, i didn't change any file, I cloned your repo as it is right now.

0948fd5 (HEAD -> master, origin/master, origin/HEAD) server side translations change

screenshot from 2017-07-15 00-40-12

chriseugenerodriguez commented 7 years ago

@evertonrobertoauler so did you load it initially in spanish, or did you use dropdown and change language? I used dropdown to change language. How did you change language and get it to print out initially? I am changing language with dropdown and viewing source. Thanks a lot for your help bro.

evertonrobertoauler commented 7 years ago

It did load initially in pt because in the server code I'm getting the accept-language header that the browser sends with the request. I didn't need to use the use the dropdown.

chriseugenerodriguez commented 7 years ago

how did you load it initially in pt?