2011-03-08 2 views
1

기본 로케일을 덴마크어로 설정하면이 오류가 발생합니다.레일스 number_to_currency 버그

로캘을 기본 영어로 변경했습니다. 나는 여전히 오류가 발생합니다.

개발 로그 :

Started GET "/" for 127.0.0.1 at 2011-03-08 22:53:48 +0100 
    Processing by PublicController#index as HTML 
    [1m[36mKonkurrancer Load (5.0ms)[0m [1mSELECT `konkurrancers`.* FROM `konkurrancers`[0m 
Rendered public/index.erb within layouts/application (107.0ms) 
Completed in 306ms 

ActionView::Template::Error (couldn't parse YAML at line 0 column 0): 
    13: <tr onclick="window.open('<%= vind.tracking %>')" onmouseout="this.style.background='white';" onmouseover="this.style.background='#99ff33';this.style.cursor='pointer'"> 
    14:  <td width="320px" style="padding-left: 5px;"><%= truncate(vind.name.force_encoding("UTF-8"), :length => 55) %></td> 
    15:  <td>4 ud af 5</td> 
    16:  <td><%= number_to_currency(vind.vaerdi, :locale => :da) %></td> 
    17:  <td>2 min</td> 
    18:  <td>Nyhedsbrev</td> 
    19:  <td><%= vind.udtraekkes.strftime("%d %B") %></td> 
    app/views/public/index.erb:16:in `block in _app_views_public_index_erb___358071530_34835700_285053873' 
    app/views/public/index.erb:12:in `each' 
    app/views/public/index.erb:12:in `_app_views_public_index_erb___358071530_34835700_285053873' 
    app/controllers/application_controller.rb:6:in `index' 

Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms) 
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (4.0ms) 
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (59.0ms) 

다 로케일 : 내 덴마크어 로케일을 삭제 한 내 YAML 파일의 끝 부분에 약간의 공간을 추가 않았다

da: 
    # active_support 
    date: 
    # See http://sproget.dk/svarbase/SV00000046/ and http://en.wikipedia.org/wiki/Date_formats 
    # either use traditional (2.10.03, 2. oktober 2003): "%e.%m.%y", "%e. %B %Y" 
    # or international ISO 8601 format (2003-10-20): "%Y-%m-%d" 
    # Note: some Windows distributions do not support %e - you may have to use %d instead 
    formats: 
     default: "%d.%m.%Y" 
     short: "%e. %b %Y" 
     long: "%e. %B %Y" 

    day_names: [søndag, mandag, tirsdag, onsdag, torsdag, fredag, lørdag] 
    abbr_day_names: [sø, ma, ti, 'on', to, fr, lø] # Note: unescaped 'on' is parsed as true 
    month_names: [~, januar, februar, marts, april, maj, juni, juli, august, september, oktober, november, december] 
    abbr_month_names: [~, jan, feb, mar, apr, maj, jun, jul, aug, sep, okt, nov, dec] 
    order: [ :day, :month, :year ] 

    time: 
    formats: 
     default: "%e. %B %Y, %H:%M" 
     short: "%e. %b %Y, %H:%M" 
     long: "%A, %e. %B %Y, %H:%M" 
    am: "" 
    pm: "" 

    support: 
    array: 
     # Rails 2.2 
     #sentence_connector: "og" 
     #skip_last_comma: true 
     # Rails 2.3 
     words_connector: ", " 
     two_words_connector: " og " 
     last_word_connector: " og " 
    select: 
     # default value for :prompt => true in FormOptionsHelper 
     prompt: "Vælg..." 

    # action_view 
    number: 
    format: 
     separator: "," 
     delimiter: "." 
     precision: 3 
     significant: false 
     strip_insignificant_zeros: false 

    currency: 
     format: 
     format: "%u %n" 
     unit: "DKK" 
     separator: "," 
     delimiter: "." 
     precision: 2 
     significant: false 
     strip_insignificant_zeros: false 

    percentage: 
     format: 
     delimiter: "" 

    precision: 
     format: 
     delimiter: "" 

    human: 
     format: 
     delimiter: "" 
     precision: 3 
     significant: true 
     strip_insignificant_zeros: true 
     # Rails 2.2 
     #storage_units: [Bytes, KB, MB, GB, TB] 
     # Rails 2.3 
     storage_units: 
     # Storage units output formatting. 
     # %u is the storage unit, %n is the number (default: 2 MB) 
     format: "%n %u" 
     units: 
      byte: 
      one: "Byte" 
      other: "Bytes" 
      kb: "KB" 
      mb: "MB" 
      gb: "GB" 
      tb: "TB" 
     decimal_units: 
     format: "%n %u" 
     units: 
      unit: "" 
      thousand: Tusind 
      million: Million 
      billion: Milliard 
      trillion: Billion 
      quadrillion: Billiard 

    datetime: 
    distance_in_words: 
     half_a_minute: "et halvt minut" 
     less_than_x_seconds: 
     one: "mindre end et sekund" 
     other: "mindre end %{count} sekunder" 
     x_seconds: 
     one: "et sekund" 
     other: "%{count} sekunder" 
     less_than_x_minutes: 
     one: "mindre end et minut" 
     other: "mindre end %{count} minutter" 
     x_minutes: 
     one: "et minut" 
     other: "%{count} minutter" 
     about_x_hours: 
     one: "cirka en time" 
     other: "cirka %{count} timer" 
     x_days: 
     one: "en dag" 
     other: "%{count} dage" 
     about_x_months: 
     one: "cirka en måned" 
     other: "cirka %{count} måneder" 
     x_months: 
     one: "en måned" 
     other: "%{count} måneder" 
     about_x_years: 
     one: "cirka et år" 
     other: "cirka %{count} år" 
     over_x_years: 
     one: "mere end et år" 
     other: "mere end %{count} år" 
     almost_x_years: 
     one: "næsten et år" 
     other: "næsten %{count} år" 
    prompts: 
     year: "År" 
     month: "Måned" 
     day: "Dag" 
     hour: "Time" 
     minute: "Minut" 
     second: "Sekund" 

    helpers: 
    select: 
     prompt: "Vælg..." 

    submit: 
     create: "Opret %{model}" 
     update: "Opdater %{model}" 
     submit: "Gem %{model}" 

    errors: 
    format: "%{attribute} %{message}" 

    messages: &errors_messages 
     inclusion: "er ikke i listen" 
     exclusion: "er reserveret" 
     invalid: "er ikke gyldig" 
     confirmation: "stemmer ikke overens med bekræftelse" 
     accepted: "skal accepteres" 
     empty: "må ikke udelades" 
     blank: "skal udfyldes" 
     too_long: "er for lang (maksimum %{count} tegn)" 
     too_short: "er for kort (minimum %{count} tegn)" 
     wrong_length: "har forkert længde (skulle være %{count} tegn)" 
     not_a_number: "er ikke et tal" 
     not_an_integer: "er ikke et heltal" 
     greater_than: "skal være større end %{count}" 
     greater_than_or_equal_to: "skal være større end eller lig med %{count}" 
     equal_to: "skal være lig med %{count}" 
     less_than: "skal være mindre end %{count}" 
     less_than_or_equal_to: "skal være mindre end eller lig med %{count}" 
     odd: "skal være ulige" 
     even: "skal være lige" 

    activerecord: 
    errors:s 
     template: 
     header: 
      one: "En fejl forhindrede %{model} i at blive gemt" 
      other: "%{count} fejl forhindrede %{model} i at blive gemt" 
     body: "Der var problemer med følgende felter:" 

     messages: 
     taken: "er allerede brugt" 
     record_invalid: "Validering fejlede: %{errors}" 
     <<: *errors_messages 

     full_messages: 
     format: "%{att 
+0

관련 로케일 파일의 내용을 게시 할 수 있습니까? (내가 잘못하지 않았다면'config/locales/da.yml') – zetetic

+0

나는 da.yml 로케일 파일을 게시했다. –

답변

0

.