Closed SierraGolf closed 9 years ago
I'm not sure why you are using that "onBeforeAction" just on the server and why you put TAPi18n language configuration there. Also I guess there actually is a route named "foobar" :-)
It wouldn't be bad to have a sample project showing the problem!
closed by accident
I will create an example project. Btw. bare with me, because I am kinda new to this javascript frontend world.
About your questions:
I guess my question is why does the app think I want to access http://localhost:3000/foobar when I call http://localhost:3000?_escaped_fragment_=foobar, but only when I add the i18n support (router+conf)?
as for TAPi18n you can configure a I18NConf listener:
I18NConf.onLanguageChange(function(oldLang, newLang) {
TAPi18n.setLanguage(newLang);
});
This listener will be simply called everytime I18NConf.setLanguage
is called manually or anytime is called automatically by Iron Router i18n (e.g. when accessing a route with lang code and/or recognized as a i18n route).
As for the issue I'll have a look into it, if you can prepare a minimal sample app to show it it would be an helping hand.
P.S. it's strange that if confirmed would be a strange behavior but why are you using http://localhost:3000/?_escaped_fragment_=foobar
instead of http://localhost:3000/foobar?_escaped_fragment_=
, a web crawler would use the second one.
Yeah, you are right the example is artificial. To be honest I did not know at the time that there would not be a value for the parameter _escaped_fragment_
and I just put something random there to test the behaviour. Testing with an empty value works as it should and query parameters generally work also as expected. However I did not test with actual hash fragments, because I don't have any (yet).
About the tip with the language change listener. Where is the recommended place to put this? Client, server or both? Btw. I remember now why I did not use it in the first place. In my project the default language for I18nConf is set to "de" and in TAPi18n the default language is hard-coded to "en".
This means when I call my app with localhost:3000/de I18nConf does not detect a change and does not trigger the listener, but my TAPi18n still defaults to "en".
I'd say both, client and server.
As for TAPi18n having the hardcoded language to "en" I'd just initially set the language to de in a Meteor.startup block and still use the I18NConf listener. There is a ticket I've opened to integrate tapi18n with i18n conf https://github.com/TAPevents/tap-i18n/issues/62
About this issue, since we figured out that it is not really a real life problem, feel free to close this issue.
About the listener problem. When I set the language to "de" in the start block any page request will be using de as language independent from the url language.
Hi,
I am having problems bringing together iron-router-i18n with spiderable. If I do not use iron-router-i18n spiderable works as expected. With iron-router-i18n all the language awesomeness works, but I lose the spiderable server-side rendering.
So this is what happens:
This is my configuration:
I am using it together with tap:i18n.
Upon initialisation of my client I do this:
... and my router.js looks like this:
Am I missing some configuration? If the above information is not enough, I can provide an example project to demonstrate the problem.