论坛首页 Ruby版 rails

gettext 无法检出Controller中的字符串

浏览 300 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
最后更新时间:2007-12-28
使用Instant Rails 1.7, gettext 1.10。

各步骤均按照"Ruby-GetText-Package HOWTO for Ruby on Rails"进行了设置。
Application.rb中配置如下:
require 'user_system'

# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  # Pick a unique cookie name to distinguish our session data from others'
  session :session_key => '_myproj_session_id'
  
  # global layout
  layout "myproj"
  
  # authentication
  include Localization
  include UserSystem
  helper :user
  model :user
  before_filter :login_required
  
  init_gettext "myproj"
  
  puts _("hello world")  # for test only
end


使用Rake updatepo时,可以检出Model, View及ApplicationController(上面的"hello world"),但其他Controller中的字符串就检不出来了。

感觉像是除application.rb之外,其他的Controller文件没有被找到。在其中加入:
init_gettext("mycontroller")

也没用。

rake task定义:
desc "Update pot/po files."
task :updatepo do
  require 'gettext/utils'
  GetText.update_pofiles("myproj", Dir.glob("{app,lib,bin}/**/*.{rb,rhtml}"), "myproj 1.0.0")
end


有哪位知道怎么回事么?
   
最后更新时间:2007-12-28
问题已经解决。

原来代码:
flash[:notice] = _("ユーザー「#{@user.name}」を変更しました。")


修正后:
flash[:notice] = _("ユーザーを変更しました。")
   
0 请登录后投票
论坛首页 Ruby版 rails

跳转论坛:
JavaEye推荐