Supported File Types (Strings)

.YAML - Symfony (Strings)

Content is machine translated from English by Phrase Language AI.

File Extensions 

.yml, .yaml

API Extension 

yml_symfony

Import 

Yes

Export 

Yes

Plural forms support 

Yes

Description support 

No

Symfony is a high-performance PHP framework composed of various predefined PHP components. Localization for applications built with Symfony can take place with file formats, such as .XLIFF, .YAML, and PHP Arrays. The Symfony development team recommends the use of .YAML for small localization projects and .XLIFF for larger or more complex ones. Compared with the XML-based .XLIFF, .YAML is more human-readable, with data nesting achieved using indentation rather than explicit tags.Per .YAML convention, while preparing .YAML for translation, ensure indentation is correct using regular spaces and not TABs.

Plurals

Plural forms rules for the  Symfony i18n framework follow the ICU message format. Before ICU message formats can be used in a project, it must be enabled by selecting "Enable ICU Message format support" in the Advanced tab in the Project settings window.

Once enabled, use the select functions syntax to pass multiple parameters adding the plural rule:

file:translations/messages+intl-icu.en.yaml

key: >-

  {files, plural,

     =0 {No messages received}

     one {One message received}

     =other {# messages received}

  }

Add multiple rules for different numbers:

=0
=1
=2
=n

The YAML document is reconstructed and all plural forms are placed under the appropriate key.

Code Sample

---
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)
Was this article helpful?

Sorry about that! In what way was it not helpful?

The article didn’t address my problem.
I couldn’t understand the article.
The feature doesn’t do what I need.
Other reason.

Note that feedback is provided anonymously so we aren't able to reply to questions.
If you'd like to ask a question, submit a request to our Support team.
Thank you for your feedback.