Gloc bug?

Hi,

I use Gloc plugin to create some localisation and it works great on my
local webbrick server. Unfortunately It doesn’t work anymore when I
upload the gloc dir to vendor/plugins on my host. I always get this
error:

“uninitialized constant GLoc”

The error occures when environment.rb is executing this:

GLoc.set_config :default_language => :nl
GLoc.clear_strings_except :fr, :nl
GLoc.set_kcode
GLoc.load_localized_strings

Did I miss something? I’m getting really frustrated because my whole app
uses Gloc

greetings,

Temmesta

Hi,

Sounds like the plugin isn’t being initialised. So you’re sure it’s in
vendor/plugins/gloc/* ?
Maybe you should modify gloc’s init.rb and just add a line to output
loaded or something so that you know if it’s being called or not. Ur
host might’ve set things up differently somehow (?). If it’s not being
called you could just manually add it to the load path and require it.

Golly

I’m happy that you replied so quick :). I’m absolutely sure it’s in
vendor/plugins/gloc . I’m a rails newbie so I’m not sure how I can
output
something from the init.rb. I can’t do puts ‘blablabla’ because I won’t
be able
to see server output with my dreamhost account. So then I tried to to
add this in my environment.rb :

config.load_paths += %W(
{RAILS_ROOT}/vendor/plugins/gloc
{RAILS_ROOT}/vendor/plugins/gloc/lib
)

this didn’t work :(. I also tried other plugins and they work so I’m not
sure
it’s a problem with my host. Any suggestions?

Temesta

David B. wrote:

Hmm, it’s really wierd that other plugins are loading but GLoc isn’t…
ok, try just adding the gloc paths to the load path and manually
require it then. Again it’s very odd that that’s happening.

And also u can u can just use puts to see if the init file is being
loaded but you can output text to a file and check that instead. good
luck :slight_smile:

Golly

I tried everything you said but it still doesn’t work :(. I could give
you temporary acces to my files so you could take a quick look at it. I
would really appreciate it if you want to do this. Let me know something
and I’ll e-mail you a login and passw. I’ll create simple gloc test
controller & view so you can see it doesn’t work.

greetings,

Temesta

Hmm, it’s really wierd that other plugins are loading but GLoc isn’t…
ok, try just adding the gloc paths to the load path and manually
require it then. Again it’s very odd that that’s happening.

And also u can u can just use puts to see if the init file is being
loaded but you can output text to a file and check that instead. good
luck :slight_smile:

Golly

yeah ok thats cool, just email me then at japgolly at_ gmail.com
I’ll take a look when I get time. :wink:

Golly

The error occures when environment.rb is executing this:

GLoc.set_config :default_language => :nl
GLoc.clear_strings_except :fr, :nl
GLoc.set_kcode
GLoc.load_localized_strings

GLoc.set_config :default_language => :es
GLoc.clear_strings_except :en, :es
GLoc.set_kcode
GLoc.load_localized_strings

I am using Rails 2.0.2 and put the initialization in environment.rb. I
get an error:

/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
`gem_original_require’:
/Users/billdavenport/Projects/gloc/config/environment.rb:13: syntax
error, unexpected tCONSTANT, expecting ‘)’ (SyntaxError)
GLoc.set_config :default_language => :es

Not sure what’s going on. I have the block outside of my
Initializer.run

Do you have the following in your
RAILS_ROOT/vendor/plugins/gloc/init.rb
require ‘gloc’
require ‘gloc-ruby’
require ‘gloc-rails’
require ‘gloc-rails-text’

Bill Davenport wrote:

The error occures when environment.rb is executing this:

GLoc.set_config :default_language => :nl
GLoc.clear_strings_except :fr, :nl
GLoc.set_kcode
GLoc.load_localized_strings

GLoc.set_config :default_language => :es
GLoc.clear_strings_except :en, :es
GLoc.set_kcode
GLoc.load_localized_strings

I am using Rails 2.0.2 and put the initialization in environment.rb. I
get an error:

/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
`gem_original_require’:
/Users/billdavenport/Projects/gloc/config/environment.rb:13: syntax
error, unexpected tCONSTANT, expecting ‘)’ (SyntaxError)
GLoc.set_config :default_language => :es

Not sure what’s going on. I have the block outside of my
Initializer.run

I have this in my /vendor/plugins/gloc/init.rb

Copyright © 2005-2007 David B.

require ‘gloc’
require ‘gloc-ruby’
require ‘gloc-rails’
require ‘gloc-rails-text’

require ‘gloc-dev’ if ENV[‘RAILS_ENV’] == ‘development’

GLoc.set_language_mode :simple
GLoc.load_gloc_default_localized_strings

V. Vincesf wrote:

Do you have the following in your
RAILS_ROOT/vendor/plugins/gloc/init.rb
require ‘gloc’
require ‘gloc-ruby’
require ‘gloc-rails’
require ‘gloc-rails-text’

Seems that I had deleted a ) in my environment.rb file.

However, a new error has cropped up when I do a script/server.

/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:266:in
`load_missing_constant’: uninitialized constant GLoc (NameError)

bill

V. Vincesf wrote:

Do you have the following in your
RAILS_ROOT/vendor/plugins/gloc/init.rb
require ‘gloc’
require ‘gloc-ruby’
require ‘gloc-rails’
require ‘gloc-rails-text’