Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
fb684774
Commit
fb684774
authored
Sep 29, 2013
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better wording
parent
b45b16d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
i18n.md
docs/guide/i18n.md
+7
-4
No files found.
docs/guide/i18n.md
View file @
fb684774
...
@@ -41,7 +41,11 @@ Basic message translation
...
@@ -41,7 +41,11 @@ Basic message translation
### Strings translation
### Strings translation
Yii basic message translation that works without additional PHP extension and
Yii basic message translation that works without additional PHP extension.
```
php
echo
\Yii
::
t
(
'app'
,
'This is a string to translate!'
);
```
### Named placeholders
### Named placeholders
...
@@ -60,9 +64,8 @@ $sum = 42;
...
@@ -60,9 +64,8 @@ $sum = 42;
echo
\Yii
::
t
(
'app'
,
'Balance: {0}'
,
$sum
);
echo
\Yii
::
t
(
'app'
,
'Balance: {0}'
,
$sum
);
```
```
> **Tip**: When messages are extracted and passed to translator, he sees strings only. For the code above extracted message will be
> **Tip**: Try keep message strings meaningful and avoid using too many positional parameters. Remember that
> "Balance: {0}". It's not recommended to use positional placeholders except when there's only one and message context is
> translator has source string only so it should be obvious about what will replace each placeholder.
> clear as above.
Advanced placeholder formatting
Advanced placeholder formatting
-------------------------------
-------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment