Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

the "locales" directory tries to load from curdir, not from __dirname #24

Closed
brettcave opened this Issue · 3 comments

2 participants

@brettcave

If I have a node application in /path/to/myapp, with /path/to/myapp/app.js as the runner and /path/to/myapp/locales with i18n language definitions in, then i18n works if I:

cd /path/to/myapp
node app.js

however, if i start the app from outside the directory, i18n does not load up locales, searching within the current dir:

cd /path/to
node myapp/app.js

No languages will load in the 2nd instance.

@mashpie
Owner

for now you might want to change default setting of your directory, i.e.:

i18n.configure({
  locales: ['en', 'de'],
  register: global,
  directory: '/path/to/myapp/locales',
});

Or just set that dynamic by using __dirname in your configure statement.
I'll leave that issue open as I think, using __dirname/locales as default setting sound like a good option.
Thanks!

@mashpie mashpie was assigned
@brettcave

Hi mashpie,

I had a look at the source and saw the directory config option, which I did not come across in the documentation (i.e. reading the README file). It works great when setting it to __dirname/locales manually.

From an implementation, I agree that defaulting would be better to use __dirname/locales as default, as I am assuming most i18n users would use it this way.

Thanks

@mashpie
Owner

agreed - 9 months later - sry for delay

@mashpie mashpie closed this in 9669904
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.