summaryrefslogtreecommitdiff
path: root/doc/development
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2017-10-31 16:08:11 -0500
committerMike Greiling <mike@pixelcog.com>2017-10-31 16:08:11 -0500
commit1cf167fc3e61c6c78e3bf2ba15a02f7ab317294c (patch)
tree05fda8866fb5634be495b526d06f00f02b18ea35 /doc/development
parentc73c1a20e3c5a66a71758c4809faf2f69df25392 (diff)
parent0134079430f0179c527d388539c0986352bca9bd (diff)
downloadgitlab-ce-1cf167fc3e61c6c78e3bf2ba15a02f7ab317294c.tar.gz
Merge branch 'master' into sh-headless-chrome-support
* master: (84 commits) Migrate Gitlab::Git::Wiki#page to Gitaly Load participants async Normalize LDAP DN when looking up identity Improve the maintenance policy page add changelog fix spec failure Allow promoting project milestones to group milestones fix specs Be able to bundle gems with newer rubies Upgrade Ruby to 2.3.5 fixed up upload feature after master merge fix missing issue assignees Migrate Gitlab::Git::Wiki#delete_page to Gitaly Enable eslint Make `#hashed_storage?` require feature argument Adds callback function to inital cluster request Fix example typo. Upload files through the multi-file editor get branch name from the DOM Resolve "Convert autosize.js library to be a Yarn managed library" ...
Diffstat (limited to 'doc/development')
-rw-r--r--doc/development/fe_guide/index.md4
-rw-r--r--doc/development/i18n/externalization.md40
2 files changed, 34 insertions, 10 deletions
diff --git a/doc/development/fe_guide/index.md b/doc/development/fe_guide/index.md
index 73366eb9f3f..8f956681693 100644
--- a/doc/development/fe_guide/index.md
+++ b/doc/development/fe_guide/index.md
@@ -106,6 +106,10 @@ Frontend security practices.
## [Accessibility](accessibility.md)
Our accessibility standards and resources.
+## [Internationalization (i18n) and Translations](../i18n/externalization.md)
+Frontend internationalization support is described in [this document](../i18n/).
+The [externalization part of the guide](../i18n/externalization.md) explains the helpers/methods available.
+
[rails]: http://rubyonrails.org/
[haml]: http://haml.info/
diff --git a/doc/development/i18n/externalization.md b/doc/development/i18n/externalization.md
index 167260b6e0e..7c38260406d 100644
--- a/doc/development/i18n/externalization.md
+++ b/doc/development/i18n/externalization.md
@@ -180,15 +180,43 @@ aren't in the message with id `1 pipeline`.
## Working with special content
+
+### Just marking content for parsing
+
+- In Ruby/HAML:
+
+ ```ruby
+ _('Subscribe')
+ ```
+
+- In JavaScript:
+
+ ```js
+ import { __ } from '../../../locale';
+ const label = __('Subscribe');
+ ```
+
+
+Sometimes there are some dynamic translations that can't be found by the
+parser when running `bundle exec rake gettext:find`. For these scenarios you can
+use the [`_N` method](https://github.com/grosser/gettext_i18n_rails/blob/c09e38d481e0899ca7d3fc01786834fa8e7aab97/Readme.md#unfound-translations-with-rake-gettextfind).
+
+There is also and alternative method to [translate messages from validation errors](https://github.com/grosser/gettext_i18n_rails/blob/c09e38d481e0899ca7d3fc01786834fa8e7aab97/Readme.md#option-a).
+
### Interpolation
- In Ruby/HAML:
```ruby
- _("Hello %{name}") % { name: 'Joe' }
+ _("Hello %{name}") % { name: 'Joe' } => 'Hello Joe'
```
-- In JavaScript: Not supported at this moment.
+- In JavaScript:
+
+ ```js
+ import { __, sprintf } from '../../../locale';
+ sprintf(__('Hello %{username}'), { username: 'Joe' }) => 'Hello Joe'
+ ```
### Plurals
@@ -234,14 +262,6 @@ Sometimes you need to add some context to the text that you want to translate
s__('OpenedNDaysAgo|Opened')
```
-### Just marking content for parsing
-
-Sometimes there are some dynamic translations that can't be found by the
-parser when running `bundle exec rake gettext:find`. For these scenarios you can
-use the [`_N` method](https://github.com/grosser/gettext_i18n_rails/blob/c09e38d481e0899ca7d3fc01786834fa8e7aab97/Readme.md#unfound-translations-with-rake-gettextfind).
-
-There is also and alternative method to [translate messages from validation errors](https://github.com/grosser/gettext_i18n_rails/blob/c09e38d481e0899ca7d3fc01786834fa8e7aab97/Readme.md#option-a).
-
## Adding a new language
Let's suppose you want to add translations for a new language, let's say French.