Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Developer Documentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
brienne
Developer Documentation
Commits
46c1828d
Unverified
Commit
46c1828d
authored
7 years ago
by
bgm
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
developers.md: tidy up formatting
parent
0e2a5491
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/translation/developers.md
+4
-5
4 additions, 5 deletions
docs/translation/developers.md
with
4 additions
and
5 deletions
docs/translation/developers.md
+
4
−
5
View file @
46c1828d
...
...
@@ -8,7 +8,7 @@ If you are an extension developer, there is additional documentation in the [Ext
The strings hard-coded into PHP should be wrapped in ts() function calls. Here are a few examples:
```
```
php
$string
=
ts
(
'Hello, World!'
);
$group
=
array
(
''
=>
ts
(
'- any group -'
))
+
$this
->
_group
;
...
...
@@ -16,7 +16,7 @@ $group = array('' => ts('- any group -')) + $this->_group;
You can also use placeholders for variables:
```
```
php
$string
=
ts
(
"A new '%1' has been created."
,
array
(
1
=>
$contactType
));
...
...
@@ -26,7 +26,7 @@ Note that variables should themselves be translated by your code before passing
A few examples to avoid:
```
```
php
// Bad: Avoid escaped quotes: this is harder to read:
$string
=
ts
(
'A new \'%1\' has been created.'
,
array
(
1
=>
$contactType
));
...
...
@@ -45,7 +45,7 @@ $string = ts("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin
Another common error is to use
`ts()`
to aggregate strings or as a "clever" way of writing shorter code:
```
```
php
// Bad: incorrect aggregation
// This will be extremely confusing to translations
// and might give some really bad results in some languages.
...
...
@@ -59,4 +59,3 @@ if ($is_early) {
$string
=
ts
(
"Good morning %2, how are you?"
,
array
(
1
=>
$name
));
}
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment