Ich würde also gerne einen längeren Textblock in eine YAML-Locale-Datei in Rails einfügen können. Allerdings gibt der YAML-Parser Syntaxfehler für Blöcke aus, die eigentlich in Ordnung sind! Ich habe mir das Ruby YAML Kochbuch durchgelesen und es scheint, dass die folgenden Beispiele alle funktionieren sollten, aber das tun sie nicht.
config/locales/tx.yml
Dieser funktioniert gut:
tx:
states:
show:
state_population: "2009 est. pop.: 24,782,302 (cit. <a href=\"http://quickfacts.census.gov/qfd/states/48000.html\">Census.gov</a>"
state_pop_per_upper_chamber_member: "Each senator serves a four-year term and represents approx. 774,447 Texans"
...ist aber hässlich.
Keines davon funktioniert...
tx:
states:
show:
state_population: |
2009 est. pop.: 24,782,302 (cit. <a href="http://quickfacts.census.gov/qfd/states/48000.html">Census.gov</a>
state_pop_per_upper_chamber_member: "Each senator serves a four-year term and represents approx. 774,447 Texans"
tx:
states:
show:
state_population: >
2009 est. pop.: 24,782,302 (cit. <a href="http://quickfacts.census.gov/qfd/states/48000.html">Census.gov</a>
state_pop_per_upper_chamber_member: "Each senator serves a four-year term and represents approx. 774,447 Texans"
tx:
states:
show:
state_population: |
"2009 est. pop.: 24,782,302 (cit. <a href=\"http://quickfacts.census.gov/qfd/states/48000.html\">Census.gov</a>"
state_pop_per_upper_chamber_member: "Each senator serves a four-year term and represents approx. 774,447 Texans"
tx:
states:
show:
state_population: |
2009 est. pop.\: 24,782,302 (cit. <a href="http://quickfacts.census.gov/qfd/states/48000.html">Census.gov</a>
state_pop_per_upper_chamber_member: "Each senator serves a four-year term and represents approx. 774,447 Texans"