Question

I don't know if this is just a goof syntax error, or if this is something I should legitimately be concerned about. I've searched online for this error and have found very little concerning it. So my guess is that this is either something so "no duh" that hardly anybody ends up with this error, or that it's so obscure that - again - hardly anybody ends up with it. Nonetheless, here we go: This is what I'm using: Ruby 2.1.1p76 Rails 4.0.5 SafeYAML 1.0.3 RubyMine 6.3 [should you need anymore information, please ask]

The error I'm getting exactly is: "Rails i18n locale file should have single root"

Here is a shortened version of my en.yml file (I'll include what I believe to be the problem areas)

    <%
      object_names = **{**   
        :administrator => 'Administrator',
        :activity_log => 'Site Activity',
        :answer => 'Answer',
        :approval => 'Approval',
        :user => 'Member',
        :video => 'Video',
        :vote => 'Like'
      }

      section_names = **{**
        :approvals => 'Items Awaiting Review',
        :advertisements => 'Advertisements',
        :ad_placements => 'Ad Placements',
        :awarded_badges => 'Badges',
        :badges => 'Badges',
        :videos => 'Videos'
      }

      anonymous = 'Anonymous**'
    %>

    en:
      homepage:
        mine: "My %{site_name}"
      site_name: "%{site_name}"
      site_condition_name: "%{site_condition_name}"

      titles:
        main: "%{site_name}"
        delimiters:
          minor:** ' **-** '
          major: ' | '
        scopes:
          popular: Popular
          newest: Newest
          active: Active

          my_feed: My Friends
          my_activity: What I've Done
          tracked_items: "Only <%= object_names[:tracked_item].pluralize %>"
          everyone: Everyone

          user: "By %{name}"
          view: "By %{view}"
          sent: "Sent <%= object_names[:message].pluralize %>"
          page: "Page %{page}"
          letter: "Starting With %{letter}"
          query: "%{query}"
          category: "%{category}"

      **meta_description:**
        main: "%{site_name} is a social network that connects people"

      footer:
        about: "About %{site_name}"
        about_alliance_health: About Alliance Health
        community_advocates: Community Advocates
        terms_of_use: Terms of Use

oh - wow. Ok, it looks like bold isn't going to work inside the code markers. But I'm sure you guys can decipher what's going on. Basically anything that's bold (or delimited with a double asterisk '**') is where the IDE is marking the code with this particular error. So, as you can see, it seems rather chaotic and nonsensical. But I often find that when such things happen, it's usually one tiny little character somewhere that's throwing everything else off.

Now, I'm no YAML expert - in fact, I hardly even know the stuff (which is something I'm planning on changing here in the near future) so this may be something along the "no duh" lines. However, it is interesting to note that the bulk of the error-marked syntax starts with the last single-quote of the word: " 'anonymous' ", all the way down to: " minor: ", skipping the first following single quote, and picking up again on the hyphen, afterwhich there are no more errors for the rest of the nearly 5,500 lines of this file.

Thanks to anybody who helps out. I've been dorking around with this for far too long, and with very little online information on this particular issue. So any help is much appreciated :)

Thanks!

Was it helpful?

Solution

So - I'm not sure this will ever help anybody ... but in the case that it may, this is how I re-engineered the script to avoid the errors. I simply removed the usual delimiters that were causing the parsing confusion. And @mu is too short, you were correct. This is an erb.yml file, though I'm not sure why the original creator left the dual extension off. At any rate - thank you to everybody who offered any suggestions and ideas :)

<%
  object_names = Hash.new
  object_names[:administrator] = %q<Administrator>
  object_names[:activity_log] = %q<Site Activity>
  object_names[:answer] = %q<Answer>
  object_names[:approval] = %q<Approval>
  object_names[:user] = %q<Member>
  object_names[:video] = %q<Video>
  object_names[:vote] = %q<Like>

  section_names = Hash.new
  section_names[:approvals] = %q<Items Awaiting Review>
  section_names[:advertisements] = %q<Advertisements>
  section_names[:ad_placements] = %q<Ad Placements>
  section_names[:awarded_badges] = %q<Badges>
  section_names[:badges] = %q<Badges>
  section_names[:videos] = %q<Videos>
%>

en:
  homepage:
    mine: "My %{site_name}"
  site_name: "%{site_name}"
  site_condition_name: "%{site_condition_name}"

  titles:
    main: "%{site_name}"
    delimiters:
      minor: ' - '
      major: ' | '
    scopes:
      popular: Popular
      newest: Newest
      active: Active

      my_feed: My Friends
      my_activity: What I've Done
      tracked_items: "Only <%= object_names[:tracked_item].pluralize %>"
      everyone: Everyone

      user: "By %{name}"
      view: "By %{view}"
      sent: "Sent <%= object_names[:message].pluralize %>"
      page: "Page %{page}"
      letter: "Starting With %{letter}"
      query: "%{query}"
      category: "%{category}"

  meta_description:
    main: "%{site_name} is a social network that connects people"

  footer:
    about: "About %{site_name}"
    about_alliance_health: About Alliance Health
    community_advocates: Community Advocates
    terms_of_use: Terms of Use
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top