Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Customize file path? #47

aseemk opened this Issue · 2 comments

2 participants


Hey there,

Great work on this library. It's very impressive in its breadth and depth and general thoroughness and quality. (That was a lot of "and"s!) Easily the best of the various ones I've looked at.

I only have one nitpick. =) If I'm using the JSON format, it feels very redundant to have my strings files be at [directory]/[locale]/messages.json. It also makes our workflow slightly harder to manage since sharing the files for multiple locales requires either renaming them or sharing folders as zips.

Would you be open to an option that allowed tweaking the structure in the case of JSON files at least? (It probably makes sense for plist too.)

Thanks much!

Edit: realized I never gave an example of what I'd tweak it to: just [directory]/[locale].json.


@aseemk thanks!

To make sure I understand, you can use translation_directory to set the base path, but you want to avoid having a per-locale directory structure and just want en.json, es.json, etc.

I think we can make an optional configuration setting which is a function and returns the name of the translation file. The default implementation would match what we do today and if a user provides a function, it could do a flat directory like you want.

Maybe something like

options = {
  "translation_file_path": function(dir, locale) {
      return path.join(dir, locale + '.json');

How does that sound?


Conceptually, that sounds good. This option seems to overlap with the directory option though, if I'm returning an absolute path. Maybe just return a relative path, and only take the locale as an input?

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.