Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom resource path #28

Closed
ghost opened this issue Dec 20, 2016 · 8 comments
Closed

custom resource path #28

ghost opened this issue Dec 20, 2016 · 8 comments

Comments

@ghost
Copy link

ghost commented Dec 20, 2016

@rborn Please allow us to pass a I18n source folder path when requiring the plugin so that we can have it follow our own directory conventions instead of having to use a hardcoded path; thank you (:

@rborn
Copy link
Collaborator

rborn commented Dec 20, 2016

@vbresults could you give me more details on what you need? thank you

@ghost
Copy link
Author

ghost commented Dec 20, 2016

@rborn source path is hardcoded to app/i18n

This suggestion is to amend this, so that while by default it is still app/i18n, it can be changed, like so:

require("nativescript-i18n")({
  path: "resources/i18n"
});

// searches 'app/resources/i18n' for source strings instead of 'app/i18n'

@rborn
Copy link
Collaborator

rborn commented Dec 20, 2016

@vbresults Not sure how to achieve this, there is a before-build hook that creates the iOS strings before the app it's built, so we need to know beforehand the path of the files :(

A way would be to try to set something in package.json but I'm not sure if this approach it's good and/or possible.

@rborn
Copy link
Collaborator

rborn commented Dec 20, 2016

@vbresults please have a look in the custom_lang_path branch.

To set the custom path you need to alter your project's package.json file like in the demo app and of course to move the file in the new path.

Keep in mind that the new path is relative to the app's root.

Play with it and let me know, and once it's fine I'll merge it and push it to npm 😄

@ghost
Copy link
Author

ghost commented Dec 20, 2016

@rborn Thank you; is there any chance for it to follow this spec? NativeScript/NativeScript#2609

@rborn
Copy link
Collaborator

rborn commented Dec 21, 2016

@vbresults so you'd like to have the i18n folder inside the app/App_Resources folder? Or am I getting it wrong?

@ghost
Copy link
Author

ghost commented Dec 21, 2016

@rborn Edit: Your package.json idea is better, will try it out

@rborn
Copy link
Collaborator

rborn commented Dec 21, 2016

@vbresults related to the edited reply, until we have something official from NS I wouldn't venture in implementing something like this (application.paths).
Also the package.json could be a good way for #11 :)

Let me know how it goes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant