meteor-messageformat icon indicating copy to clipboard operation
meteor-messageformat copied to clipboard

fetchLocale should use relative URL

Open monitz87 opened this issue 8 years ago • 2 comments

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

monitz87 avatar Apr 06 '17 19:04 monitz87

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.

gadicc avatar May 02 '17 18:05 gadicc

Thanks, I will try that

monitz87 avatar May 02 '17 22:05 monitz87