How does localization work for applications based on Ruby on Rails, and what file format is it associated with?
File Extensions | .yml, .yaml |
API Extension | yml |
Import | Yes |
Export | Yes |
Pluralization supported? | Yes |
Descriptions supported? | No |
Ruby on Rails is an open-source framework designed to simplify the development of web applications using the Ruby programming language. Ruby on Rails has a built-in module for localization that uses YAML as the standard file format (along with RB). Phrase supports translation and localization with YAML files.
Prior to translation, please do a sanity check of the YAML file, and make sure it complies with all YAML conventions, such as indentation-based data nesting.
Code Sample
---
English:
boolean_key: true
empty_string_translation: ''
key_with_description: Check it out! This key has a description! (At least in some
formats)
key_with_line-break: |-
This translations contains
a line-break.
nested:
deeply:
key: Wow, this key is nested even deeper.
key: This key is nested inside a namespace.
null_translation:
pluralized_key:
one: Only one pluralization found.
other: Wow, you have %s pluralizations!
zero: You have no pluralization.
sample_collection:
- first item
- second item
- third item
simple_key: Just a simple key with a simple message.
unverified_key: This translation is not yet verified and waits for it. (In some
formats we also export this status)
Learn More
FAQs
How does Phrase handle arrays included in YAML files?
If your file contains keys in the array format, the Translation Editor will display the translation as a string. There is no content validation for keys of that type, so please make sure that translators do not change the syntax. You can change the type of that key to Array in the key settings to automatically exclude it from translation orders.