Symfony
There are several ways to localize your Symfony application. One resource file format that can be used to externalize your segments is YAML.
While YAML is a well-defined standard, the parser used in Symfony is known for implementing just a subset of this standard. So, using Symfony's documentation over common YAML documentation is important to get things right.
If you need information on handling your Ruby on Rails i18n YAML files, please look at this guide: Ruby on Rails Localization.
Format
- Symfony uses a flat YAML structure. The Symfony YAML parser cannot interpret a hierarchical structure.
- The keys can be constructed using the source language text or generic keys. Lingohub recommends using generic keys.
- Key-value pairs are delimited with a colon
:
. - Values can be surrounded by single or double quotes.
- Comments start with a hash sign
#
and are ignored by all known parsers. However, in the Lingohub context, all comment lines are parsed directly preceding a key-value pair (with no blank lines in between) and are treated as segment descriptions. - The placeholder syntax is as follows:
%{placeholder}
- YAML array syntax is not allowed by the Symfony YAML parser.
- Lingohub cannot guarantee that it will use the same quoting and escaping as imported when exporting a file, but it will always produce a syntactically correct file.
Examples
Additional example files can be accessed here.
# a generic key
author.name.not_blank: Please enter an author name.
# placeholder example
users.salutation: "Hello %{username}"
# source language text used as key
"Symfony is great": J'aime Symfony
References
Updated 14 days ago