gadicc / meteor-messageformat

MessageFormat i18n support for Meteor, with reactive templates
55 stars 22 forks source link

fetchLocale should use relative URL #258

Open monitz87 opened 7 years ago

monitz87 commented 7 years ago

There is a function called fetchLocale in packages/core/lib/msgfmt-client.js that creates a script from which I assume all the strings are read and loaded into the msgfmt object. That script's url is generated with Meteor.absoluteUrl, which is fine for production, but creates problems when working locally.

For instance, I'm trying to test my app on my iPhone, by connecting to my computer's IP address (where the app is running). Since the server is running on my computer, the script's url is http://localhost:3000/msgfmt/locale/all/0, so when my phone tries to fetch it, it finds nothing and so no strings are found. Maybe using a relative path is the way to go.

Cheers

gadicc commented 7 years ago

Hi @monitz87, sorry for the late reply. You should set your ROOT_URL environment variable to reflect your computer's network IP address. I think that's preferable to adding code to msgfmt that behaves differently in development, and will also solve similar issues you might have with other packages in the future.

monitz87 commented 7 years ago

Thanks, I will try that