silverstripe-framework/docs/en/02_Developer_Guides/01_Templates/08_Translations.md
Aaron Carlino 6888901468
NEW: Update docs to be compliant with Gatsby site (#9314)
* First cut

* Temporarily disable composer.json for netlify build

* POC

* New recursive directory query, various refinements

* Fix flexbox

* new styled components plugin

* Apply frontmatter delimiters

* Mobile styles, animation

* Search

* Redesign, clean up

* Nuke the cache, try again

* fix file casing

* Remove production env file

* ID headers

* Move app to new repo

* Add frontmatter universally

* Hide children changelogs

* Add how to title

* New callout tags

* Revert inline code block change

* Replace note callouts

* Fix icons

* Repalce images

* Fix icon

* Fix image links

* Use proper SQL icon
2019-11-18 17:58:33 +13:00

36 lines
1.1 KiB
Markdown

---
title: Translations
summary: Definition of the syntax for writing i18n compatible templates.
icon: globe
---
# Translations
Translations are easy to use with a template, and give access to SilverStripe's translation facilities. Here is an
example:
```ss
<%t Foo.BAR 'Bar' %>
<%t Member.WELCOME 'Welcome {name} to {site}' name=$Member.Name site="Foobar.com" %>
```
`Member.WELCOME` is an identifier in the translation system, for which different translations may be available. This
string may include named placeholders, in braces.
`'Welcome {name} to {site}'` is the default string used, if there is no translation for Member.WELCOME in the current
locale. This contains named placeholders.
`name=$Member.Name` assigns a value to the named placeholder `name`. This value is substituted into the translation
string wherever `{name}` appears in that string. In this case, it is assigning a value from a property `Member.Name`
`site="Foobar.com"` assigns a literal value to another named placeholder, `site`.
## Related
* [i18n](../i18n)
## API Documentation
* [i18n](api:SilverStripe\i18n\i18n)