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

passing variables #90

Closed
dudo opened this issue Sep 9, 2014 · 6 comments
Closed

passing variables #90

dudo opened this issue Sep 9, 2014 · 6 comments
Labels
Milestone

Comments

@dudo
Copy link
Contributor

dudo commented Sep 9, 2014

I'm wondering if we can pass variables like we can with the locale files, using #{var} in the yaml file.

Settings.foo.bar(var: 'baz')

?

@dudo
Copy link
Contributor Author

dudo commented Dec 24, 2015

I just googled this issue... and here is my original request. Kinda funny...

@pkuczynski
Copy link
Member

I am not entirely sure what would you like to achieve here? Settings is for reading values, so why would you expect bar to be a method which you can call?

@dudo
Copy link
Contributor Author

dudo commented May 12, 2016

Are you familiar with the I18n locales? Same reason. Being able to inject
something into the middle of a value.

On Thursday, May 12, 2016, Piotr Kuczynski notifications@github.com wrote:

I am not entirely sure what would you like to achieve here? Settings is
for reading values, so why would you expect bar to be a method which you
can call?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#90 (comment)

@pkuczynski
Copy link
Member

Do you mean calling t('welcome.text', myvar)? then i18n YAML file is static, but they use I18n module method to inject variables:

http://guides.rubyonrails.org/i18n.html#passing-variables-to-translations

Unless I am missing something here?

@dudo
Copy link
Contributor Author

dudo commented May 12, 2016

Sure. But I use rails config to have different words/values per
environment. Locales don't work for me there, unless I chunked them
together under the env name, I guess...

Config uses erb... But no thoughts on passing an argument, huh? I guess it
could be overkill. Thanks for the time, you can close.

On Thursday, May 12, 2016, Piotr Kuczynski notifications@github.com wrote:

Do you mean calling t('welcome.text', myvar)? then i18n YAML file is
static, but they use I18n module method to inject variables:

http://guides.rubyonrails.org/i18n.html#passing-variables-to-translations

Unless I am missing something here?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#90 (comment)

@pkuczynski
Copy link
Member

I believe if you need extrapolate the setting value, you should to that on the code level, as I can only imagine the value you need to pass would have to be provided in run-time...

We could obviously add a method like Config.read('welcome.text', myvar), which you could call instead of Config.welcome.text, if thats what you are looking for? But I am not entirely sure of this is the right approach?

I will close for now but feel free to add something if you want....

@pkuczynski pkuczynski added this to the 1.3 milestone May 12, 2016
@pkuczynski pkuczynski modified the milestones: 1.3, 1.x overwrite arrays Sep 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants