You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Internationalization.md
+27-22Lines changed: 27 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,10 @@ If you want to create multilingual compatible templates, you have to pay a speci
13
13
14
14
Thelia provides several Smarty functions to help you.
15
15
16
-
### {intl}
17
-
18
-
The {intl} function translates a string into the current language.
16
+
### `{intl}`
19
17
18
+
The `{intl}` function translates a string into the current language.
19
+
```
20
20
{intl l="This is a string to translate"}
21
21
22
22
or
@@ -26,8 +26,8 @@ The {intl} function translates a string into the current language.
26
26
or
27
27
28
28
{intl l="Hello, %name, how do you do ?" name={$name}}
29
-
30
-
We have here three typical uses of {intl}
29
+
```
30
+
We have here three typical uses of `{intl}`
31
31
32
32
#### `l`
33
33
@@ -59,39 +59,40 @@ For examples, in the `layout.tpl` file of the default front-office template, you
59
59
When using `{intl}` in a Javascript string, the translated string may contain simple and/or double quotes, that should be escaped to prevent a syntax error.
60
60
61
61
To do so, use the `js` parameter, that will escape single and double quotes :
62
-
62
+
```js
63
63
var myString ='{intl l="A string with 'simple' and \"double\" quotes" js=1}';
64
-
64
+
```
65
65
The result will be :
66
-
66
+
```js
67
67
var myString ='A string \'simple\' and \"double\" quotes';
68
-
68
+
```
69
69
You may also use the escape:'html' Smarty modifier :
70
-
70
+
```js
71
71
var myString ='{intl l="A string with 'simple' and \"double\" quotes"|escape:'html'}';
72
+
```
72
73
73
74
The result will be in this case :
74
-
75
+
```js
75
76
var myString ='A string with 'simple' and "double" quotes';
76
-
77
+
```
77
78
The 'quotes' modifier could also be used, with some care as it escapes only simple quotes :
78
-
79
+
```js
79
80
var myString ='{intl l="A string with 'simple' and \"double\" quotes"|escape:'quotes'}';
80
-
81
+
```
81
82
will gives :
82
-
83
+
```js
83
84
var myString ='A string with \'simple\' and "double" quotes';
84
-
85
+
```
85
86
#### Translating your templates
86
87
87
88
Translations is done through the back-office -> Configuration -> Translation. The string are automatically collected in your template, and you'll be able to enter the translation for any language defined in your store (see Configuration, -> Languages & URLs).
88
89
89
-
### {format_date}
90
+
### `{format_date}`
90
91
91
92
Use this function to format a date according to the current locale standards.
92
93
93
94
#### Examples
94
-
95
+
```
95
96
Return the given date using the locale date format as date and time
96
97
{format_date date=$dateTimeObject}
97
98
@@ -103,6 +104,7 @@ Use this function to format a date according to the current locale standards.
103
104
104
105
Return the given date as a time string, using the locale date
105
106
{format_date date=$dateTimeObject output="time"}
107
+
```
106
108
107
109
#### Parameters
108
110
@@ -114,18 +116,19 @@ Use this function to format a date according to the current locale standards.
114
116
-`datetime`: the date and the time (default)
115
117
116
118
117
-
### {format_number}
119
+
### `{format_number}`
118
120
119
121
Use this function to format a number according to the current locale standards, or a specific format.
## How to contribute new or update Thelia translations
110
110
111
111
Translations are contributed by Thelia users worldwide. The translation work is coordinated at [Crowdin](http://crowdin.com).
112
-
The Thelia project is located at <http://translate.thelia.net/>.
112
+
The Thelia project is located at [http://translate.thelia.net/](http://translate.thelia.net/).
113
113
114
-
Translations for **non english** languages should only be done on <http://translate.thelia.net/>, not in a Thelia development website and submitted to us with a pull request on GitHub.
114
+
Translations for **non english** languages should only be done on [http://translate.thelia.net/](http://translate.thelia.net/), not in a Thelia development website and submitted to us with a pull request on GitHub.
115
115
During the development stage, only english strings should be used inside Thelia and submitted with a pull request.
116
116
Prior to any release, Thelia maintainers will make an announcement and we'll have a couple of weeks
117
117
of string freeze in order to give people time to complete the translations.
In most cases, Thelia automatically sets the previous URLs, so that `{navigate to='previous'}` will generate the URL to the previous page visited by your customer.
1
+
In most cases, Thelia automatically sets the previous URLs, so that `{navigate to='previous'}` will generate the URL to the previous page visited by your customer.
2
2
But in some cases, you may want to define yourself the URL of the previous page, so that your customers will go back to this specific page instead of the page they have visited before.
3
3
4
4
The `{set_previous_url}` function allows setting the URLs of the page thant will become the previous page :
5
5
`{set_previous_url path='path/to/some/page'}`
6
-
To get possible `{set_previous_url}` parameters, please see the [{url}](./{url}) function.
7
-
6
+
To get possible `{set_previous_url}` parameters, please see the [`{url}`](./%7Burl%7D) function.
7
+
8
8
You may also want to prevent a page to become the “previous page”. To do so, use the `ignore_current` parameter, and put this call somewhere in the page :
9
-
`{set_previous_url ignore_current=1}`
10
-
9
+
`{set_previous_url ignore_current=1}`
10
+
11
11
A typical example is the `login` and/or `register` page, where the user should go back where it was before entering its credentials (cart or order page), and not te register/login page itself.
0 commit comments