Formats
- Rails flavored YAML
- iOS .strings
- Gettext
- JSON
- Simple JSON
- Android flavored XML
- ES6 module
- Java Properties
- Java Properties flavored XML
- Laravel PHP
Rails flavored YAML
API document format
rails_yml
Accent gotcha
- Must be valid YAML with double quoted attribute and double quoted value
- The exported file will be indented with 2 spaces
- The first line of the file must be
---
- The second line of the file must be the language identification (eg: fr, en, fr_CA…)
Example
---
'fr':
'activerecord':
'date_format':
'default': '%H:%M:%S'
'long': '%A %d %B %Y %H:%M'
'month_year': '%B %Y'
'short': '%H:%M'
iOS .strings
API document format
strings
Example
"app.name" = "TODO List";
"app.login.text" = "Enter your credentials below to login";
Gettext
- Support for top of the file comment
- Support for headers (with substitution of the Language header with the export operation)
API document format
gettext
Example
## `msgid`s in this file come from POT (.pot) files.
msgid ""
msgstr ""
"Language: en;"
"Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;"
msgid "can't be blank"
msgstr "can’t be blank"
JSON
API document format
json
Accent gotcha
- Must be valid JSON with double quoted attribute and double quoted value
- The exported file will be indented with 2 spaces
- Tip: Use jsonlint.com to validate the JSON data
Example
{
"key": "value",
"other_key": [
"array",
"are",
"supported",
{
"full": "nested support"
}
]
}
Simple JSON
API document format
simple_json
Use simple_json
format when you want a flat JSON file. Useful when using a tools like aigu or Java Enum to JSON.
Android flavored XML
API document format
android_xml
Example
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Comment are supported -->
<string name="app.name">"TODO List"</string>
<string name="app.login.text">"Enter your credentials below to login"</string>
</resources>
ES6 module
API document format
es6_module
Accent gotcha
- The file must starts with export default and end with a closing curly brace + a semicolon
- Must be valid JSON with double quoted attribute and double quoted value
- The exported file will be indented with 2 spaces
- Internally, we just remove
export default
add pass the structure in theJSON
format. - Tip: Use jsonlint.com to validate the JSON data (ie. without the
export default
part)
Example
export default {
addon: {
channel: 'My channel'
}
};
Java Properties
API document format
java_properties
Example
# Comment are supported
app.name = TODO List
# Other comment
app.login.text = Enter your credentials below to login
Java Properties flavored XML
API document format
java_properties_xml
Example
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>Comment are supported</comment>
<entry key="app.name">TODO List</entry>
<entry key="app.login.text">Enter your credentials below to login</entry>
</properties>
Laravel PHP
API document format
laravel_php
Example
<?php
return [
'required'=>'Le champ :attribute est obligatoire.',
'required_if'=>'Le champ :attribute est obligatoire quand la valeur de :other est :value.',
'required_with'=>'Le champ :attribute est obligatoire quand :values est présent.',
'same'=>'Les champs :attribute et :other doivent être identiques.',
'size'=>[
'numeric'=>'La taille de la valeur de :attribute doit être :size.',
'file'=>'La taille du fichier de :attribute doit être de :size kilobytes.',
'string'=>'Le texte de :attribute doit contenir :size caractères.'
]
];