Add client-side translation facilities, localize Bike search components #1353
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds i18n-js ruby gem and npm package to generate client-side translations from the Rails translation file.
Usage
t()
translation helper function with the appropriate keyspace for the given module. For example, forExternalRegistrySearchResult
, we can either invokeI18n.t
with a full scope or use the following:[source]
[source]
[source]
by convention, client-side translations are nested within the
javascript
key in translation files.Configuration
Client-side translations are generated in an object loaded from
public/javascripts/translation.js
and populated with entries from translation files (only those found within thejavascript
key space):[source]
[source]
Generation
The JS translation file can be generated manually with
bin/rake i18n:js:export
.This patch adds JS translation file generation as a step to
bin/rake prepare_translations
:[source]
Before
After
Closes #963