`
lzqustc
  • 浏览: 210329 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

can't convert Array into String

阅读更多

The default ./config/environment.rb file in Rails 2.2.2 has the following suggestion for setting a value for the load_path of I18n:

 

config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')] 
  config.i18n.default_locale = :"zh-CN" 

 

Using this syntax causes I18n to crash while loading the locale files. Exception is:

 


can't convert Array into String (TypeError)
 .../i18n-0.0.1/i18n/backend/simple.rb:176:in `extname'
 .../i18n-0.0.1/i18n/backend/simple.rb:176:in `load_file'
 .../i18n-0.0.1/i18n/backend/simple.rb:13:in `load_translations'
 .../i18n-0.0.1/i18n/backend/simple.rb:13:in `each'
 .../i18n-0.0.1/i18n/backend/simple.rb:13:in `load_translations'
 .../i18n-0.0.1/i18n/backend/simple.rb:79:in `init_translations'
 .../i18n-0.0.1/i18n/backend/simple.rb:94:in `lookup'
 .../i18n-0.0.1/i18n/backend/simple.rb:33:in `translate'
 .../i18n-0.0.1/i18n.rb:160:in `t'

 

This is caused by the call to '<<' instead of '=' or '+=', changing the suggestion to the following solves the problem:

 

config.i18n.load_path += Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')] 
config.i18n.default_locale = :"en" 
reference:
分享到:
评论

相关推荐

    A JSON parser in C++

    JSON++ can also convert JSON documents into lossless XML documents. Contributors http://github.com/hjiang http://github.com/elanthis http://github.com/r-lyeh If you've made substantial ...

    [原创]自己工作中常用的模板库,简化你的工作

    Even if BOOST is very powerful,it can't still meet all requirements. e.g. convert runtime data into compile period data needed by metaprogramming. /***************************************************...

    paseto-dotnet:ase Paseto.NET,.NET的Paseto(与平台无关的安全令牌)实现

    Paseto.NET,.NET的 (与平台安全令牌)实现特征v1.local v1.public ... // Convert it into byte arraybyte [] privateKey = new byte [ 64 ];byte [] publicKey = new byte [ 32 ];Ed25519 . KeyPairFromSeed ( out p

    ImageDatabase-Demonstration:该项目将图像存储为二进制文件,并从服务器检索图像并将其加载到PictureBox控件中。

    图像数据库演示 该项目将图像存储为二进制文件,并从... // Convert image into a byte array try { cntDatabase . Open (); string insertQuery = @" INSERT INTO Images(Image) VALUES(@Image) " ; // @Image is a

    TICQClient Version

    )[+] Added new items to languages constant array[-] Example wasn‘t showing messages received in RTF format02-July-2002, Version 0.5[+] Added visible/invisible list support: look at AddContactVisible,...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    link ▶Don't use an #include when a forward declaration would suffice. When you include a header file you introduce a dependency that will cause your code to be recompiled whenever the header file ...

    php将日期格式转换成xx天前的格式

    // convert a date into a string that tells how long ago // that date was.... eg: 2 days ago, 3 minutes ago. function ago($d) { $c = getdate(); $p = array('year', 'mon', 'mday', 'hours', 'minutes', '...

    MySQL and JSON A Practical Programming Guide 2018

    Inserting into an Array Using TRUNCATE Before Adding New Data Using JSON_INSERT Using JSON_REPLACE JSON_REMOVE JSON_SET JSON_UNQUOTE The Three JSON_MERGE Functions JSON_MERGE JSON_MERGE_PRESERVE JSON_...

    UE(官方下载)

    You can use these functions to insert a file into the active file, insert a string into the file at every specified increment, sample colors from anywhere on your screen, and more. Using Bookmarks ...

    C#简单实现SNMP的方法

    // Community length // Copy community string into pdu Array.Copy(community.getBytes(), 0, pdu, 7, community.Length); // Set object ID pdu[7 + community.Length] = 0x06; // Type pdu[8 + community....

    VB编程资源大全(英文源码 数据库)

    &lt;END&gt;&lt;br&gt;46,adoxml.zip Use ADO to convert database records into an XML file. All users must have MSXML.dll version 3.0, and Internet Explorer 5.5. &lt;END&gt;&lt;br&gt;47,DataCntl.zip Simple application ...

    Java邮件开发Fundamentals of the JavaMail API

    be protocol agnostic, you can't overcome the limitations of the underlying protocols. If a capability isn't supported by a chosen protocol, the JavaMail API doesn't magically add the capability on ...

    sqlserver转PG经验总结及PG的一些特性

    SELECT array_to_string(ARRAY['dfa', 'dfas', 'fds'], '?'); -- 使用 lpad 添加前导零 SELECT lpad('9', 6, '0'); ``` #### 四、PostgreSQL 特性介绍 除了以上提到的差异外,PostgreSQL 还拥有一些高级特性: 1...

    WPTools.v6.29.1.Pro

    can be selected to be compiled into main WPTools package. - also see FAQ: http://www.wpcubed.com/forum/viewforum.php?f=15 - and support forum: http://www.wpcubed.com/forum/ - WPTools 6 PRO and ...

    rx第三方控件

    User can type data into an edit box or can bring up dialog or popup window by clicking a button. TMemoryTable implements BDE in-memory table as a dataset component (with Delete operation). ...

    RxLib控件包内含RxGIF,全部源码及DEMO

    User can type data into an edit box or can bring up dialog or popup window by clicking a button. TMemoryTable implements BDE in-memory table as a dataset component (with Delete operation). ...

    VB编程资源大全(英文源码 其它)

    You can also set the length of the returned string. Great of coming up with random passwords for your applications.&lt;END&gt;&lt;br&gt;42,norepeat.zip A simple program that generates non repeating numbers ...

    Senfore_DragDrop_v4.1

    doesn't extract the files and the files thus can't be copied/moved. This is caused by a quirk in WinZip; Apparently WinZip doesn't like IDataObject.GetData to be called before IDropTarget.Drop is ...

    Microsoft Library MSDN4DOS.zip

    BOUND Check Array Index Against Bounds BSF Bit Scan Forward BSR Bit Scan Reverse BT Bit Test BTC Bit Test and Complement BTR Bit Test and Reset BTS Bit Test and Set CALL Call Procedure CBW/CWDE ...

Global site tag (gtag.js) - Google Analytics