Ruby on Rails
The most common library for localizing Ruby on Rails applications is rails-i18n. While other formats are supported, YAML is the standard choice for Rails localization.
Format
- Key-value pairs are delimited by a colon
:. - Values can be enclosed in single or double quotes.
- LingoHub supports YAML block scalars, such as
|for multi-line values. - LingoHub supports the hierarchical structure typically used by Rails I18n.
- The first level of the file must define the language code (e.g.,
en) according to ISO 639-1. LingoHub uses this information to determine the language of the translations. - Comments beginning with a hash sign
#are parsed and assigned as segment descriptions if they directly precede a key-value pair. - The default placeholder syntax is
%{name}. - LingoHub supports the parsing and export of YAML array structures.
- The default encoding for Rails I18n files is UTF-8.
- LingoHub produces syntactically correct YAML files upon export, although the specific quoting or array syntax may differ from the imported file.
LingoHints can be included in a comment:
en:
header:
# <lh>{"status": "DRAFT","qc": {"min": "3","max": "20"},"labels": ["q3-2024"],"not_translatable": false}</lh>
hello_user: Hello %{user}Example
Additional example files are available on GitHub.
en:
header:
hello_user: Hello %{user}
welcome: "Welcome to LingoHub! This is your %{visit_count} visit."
about:
features_list:
- Reach billions with your apps.
- Support for Android and iOS.
- Seamless GitHub integration.
status_options: ['new', 'processed', 'completed']
description: |
This is a multi-line
value in YAML.References
Updated about 1 month ago
