Ruby Forum Rails I18n > Gloc bug?

Posted by Maarten Porters (temesta)
on 29.11.2006 17:05
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
Posted by David Barri (golly)
on 29.11.2006 23:13
(Received via mailing list)
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
Posted by Maarten Porters (temesta)
on 30.11.2006 13:46
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
Posted by David Barri (golly)
on 07.12.2006 04:31
(Received via mailing list)
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 :)

Golly
Posted by Maarten Porters (temesta)
on 09.12.2006 14:15
David Barri 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 :)
> 
> 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
Posted by David Barri (golly)
on 09.12.2006 16:19
(Received via mailing list)
yeah ok thats cool, just email me then at japgolly at_ gmail.com
I'll take a look when I get time. ;)

Golly
Posted by Bill Davenport (bill_davenport)
on 02.05.2008 18:41
> 
> 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
Posted by V. Vincesf (vincesf)
on 02.05.2008 18:56
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
Posted by Bill Davenport (bill_davenport)
on 02.05.2008 20:02
I have this in my /vendor/plugins/gloc/init.rb

# Copyright (c) 2005-2007 David Barri

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'
> 
> 
Posted by Bill Davenport (bill_davenport)
on 02.05.2008 21:21
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'
> 
>