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

Reloading padrino's locale #775

Closed
ujifgc opened this Issue Jan 31, 2012 · 14 comments

Comments

Projects
None yet
4 participants
@ujifgc
Member

ujifgc commented Jan 31, 2012

Application locale .yml is not reloaded on change. Is there a way to reload it or should I touch restart.txt every time app translation is changed?

@DAddYE

This comment has been minimized.

Show comment
Hide comment
@DAddYE

DAddYE Jan 31, 2012

Member

Add in boot.rb in Padrino.after_load

I18n.reload if Padrino.env == :development
Member

DAddYE commented Jan 31, 2012

Add in boot.rb in Padrino.after_load

I18n.reload if Padrino.env == :development
@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Jan 31, 2012

Member

It works only if I touch any .rb file after changing .yml. As far as I can see from padrino-core/reloader.rb, reloader rotation only has .rb files.

Member

ujifgc commented Jan 31, 2012

It works only if I touch any .rb file after changing .yml. As far as I can see from padrino-core/reloader.rb, reloader rotation only has .rb files.

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Jan 31, 2012

Member

Okay, I ended up with

  # hookers
  before do
    I18n.reload!  if Padrino.env == :development
  end

in my class Admin < Padrino::Application. It's not pretty, but does the job.

Member

ujifgc commented Jan 31, 2012

Okay, I ended up with

  # hookers
  before do
    I18n.reload!  if Padrino.env == :development
  end

in my class Admin < Padrino::Application. It's not pretty, but does the job.

@nesquena nesquena closed this Jan 24, 2013

@dariocravero

This comment has been minimized.

Show comment
Hide comment
@dariocravero

dariocravero Jan 24, 2013

Contributor

Should we document this somewhere in the guides for future reference?

Contributor

dariocravero commented Jan 24, 2013

Should we document this somewhere in the guides for future reference?

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Jan 24, 2013

Member

No. It's a dirty hack. We should fix reloader to track locale files in development environment.

Member

ujifgc commented Jan 24, 2013

No. It's a dirty hack. We should fix reloader to track locale files in development environment.

@dariocravero

This comment has been minimized.

Show comment
Hide comment
@dariocravero

dariocravero Jan 24, 2013

Contributor

Yes, you're right. I guess that we need to look after two things in here:

  • trigger I18n.reload! if a file in I18n.load_path changed, and
  • add a file to I18n.load_path if a new file was added to Dir[File.join(settings.root, '/locale/**/*.{rb,yml}')] on every app. Perhaps we can use load_file for that end?

I'm reopening this issue then @nesquena. @ujifgc @nesquena @DAddYE thoughts?

Ref.:

padrino-core/lib/padrino-core/application.rb:105:          I18n.load_path << settings.locale_path
padrino-core/lib/padrino-core/application.rb:192:        set :locale_path, Proc.new { Dir[File.join(settings.root, '/locale/**/*.{rb,yml}')] }
Contributor

dariocravero commented Jan 24, 2013

Yes, you're right. I guess that we need to look after two things in here:

  • trigger I18n.reload! if a file in I18n.load_path changed, and
  • add a file to I18n.load_path if a new file was added to Dir[File.join(settings.root, '/locale/**/*.{rb,yml}')] on every app. Perhaps we can use load_file for that end?

I'm reopening this issue then @nesquena. @ujifgc @nesquena @DAddYE thoughts?

Ref.:

padrino-core/lib/padrino-core/application.rb:105:          I18n.load_path << settings.locale_path
padrino-core/lib/padrino-core/application.rb:192:        set :locale_path, Proc.new { Dir[File.join(settings.root, '/locale/**/*.{rb,yml}')] }

@dariocravero dariocravero reopened this Jan 24, 2013

@nesquena

This comment has been minimized.

Show comment
Hide comment
@nesquena

nesquena Jan 24, 2013

Member

Ah my bad then, yeah the "right" way to fix this is potentially to augment the reloader.

Member

nesquena commented Jan 24, 2013

Ah my bad then, yeah the "right" way to fix this is potentially to augment the reloader.

@dariocravero

This comment has been minimized.

Show comment
Hide comment
@dariocravero

dariocravero Jan 24, 2013

Contributor

Ok, I'll take a stab at it then!

Contributor

dariocravero commented Jan 24, 2013

Ok, I'll take a stab at it then!

@dariocravero

This comment has been minimized.

Show comment
Hide comment
@dariocravero

dariocravero Jan 25, 2013

Contributor

News on this. @DAddYE looks like I18n will load if you change a ruby file lol.

We've been talking with Davide and we're going to work on a reloader's structure that supports different kind of resources (a big one is coming here with hot code push too ;)). It will use the current stuff for ruby and an internal watcher for the rest. An API will allow us to customise this as well as to allow people to implement their own. Will keep you informed of progress.
In the meantime, I'm moving this to 0.12 although it may make it before! :)

Contributor

dariocravero commented Jan 25, 2013

News on this. @DAddYE looks like I18n will load if you change a ruby file lol.

We've been talking with Davide and we're going to work on a reloader's structure that supports different kind of resources (a big one is coming here with hot code push too ;)). It will use the current stuff for ruby and an internal watcher for the rest. An API will allow us to customise this as well as to allow people to implement their own. Will keep you informed of progress.
In the meantime, I'm moving this to 0.12 although it may make it before! :)

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Jan 26, 2013

Member

Excellent, thank you.

Member

ujifgc commented Jan 26, 2013

Excellent, thank you.

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Sep 26, 2013

Member

Any progress on this? If any, could you push the feature branch to padrino-framework repo?

Member

ujifgc commented Sep 26, 2013

Any progress on this? If any, could you push the feature branch to padrino-framework repo?

@dariocravero

This comment has been minimized.

Show comment
Hide comment
@dariocravero

dariocravero Sep 30, 2013

Contributor

No, there's no progress on this yet. I'm sorry about that. Perhaps we'll
have to reschedule it not to delay 0.12? @DAddYE?

Darío

On 26 September 2013 08:20, Igor Bochkariov notifications@github.comwrote:

Any progress on this? If any, could you push the feature branch to
padrino-framework repo?


Reply to this email directly or view it on GitHubhttps://github.com/padrino/padrino-framework/issues/775#issuecomment-25148059
.

Contributor

dariocravero commented Sep 30, 2013

No, there's no progress on this yet. I'm sorry about that. Perhaps we'll
have to reschedule it not to delay 0.12? @DAddYE?

Darío

On 26 September 2013 08:20, Igor Bochkariov notifications@github.comwrote:

Any progress on this? If any, could you push the feature branch to
padrino-framework repo?


Reply to this email directly or view it on GitHubhttps://github.com/padrino/padrino-framework/issues/775#issuecomment-25148059
.

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Sep 30, 2013

Member

I'm gonna dig into the reloader next few weeks.

Member

ujifgc commented Sep 30, 2013

I'm gonna dig into the reloader next few weeks.

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Oct 2, 2013

Member

Closing in favor of #1427

Member

ujifgc commented Oct 2, 2013

Closing in favor of #1427

@ujifgc ujifgc closed this Oct 2, 2013

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