Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Small changes to enable localization
Browse files Browse the repository at this point in the history
- make a new method (so old code paths aren't affected)
- add in call to locale.translate
- add names for `dev` and `beta` to en-US file

The strings `Release` and `Beta` will now be translateable into other languages :)

Auditors: @prasanthp96
  • Loading branch information
bsclifton committed Aug 15, 2017
1 parent eb74751 commit 3b93063
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
12 changes: 9 additions & 3 deletions app/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ if (!channels.has(channel)) {
}

exports.channel = () => {
let channelMapping = {
'dev': 'Release',
'beta': 'Beta'
return channel
}

exports.formattedChannel = () => {
const locale = require('./locale')

const channelMapping = {
'dev': locale.translation('channelDev'),
'beta': locale.translation('channelBeta')
}
return Object.keys(channelMapping).includes(channel) ? channelMapping[channel] : channel
}
Expand Down
2 changes: 2 additions & 0 deletions app/extensions/brave/locales/en-US/app.properties
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,5 @@ connectionError=Server connection failed. Please make sure you are connected to
unknownError=Oops, something went wrong.
browserActionButton.title={{name}}
allowAutoplay=Allow {{origin}} to autoplay media?
channelDev=Release
channelBeta=Beta
5 changes: 4 additions & 1 deletion app/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,10 @@ var rendererIdentifiers = function () {
'connectionError',
'unknownError',
'allowAutoplay',
'autoplayMedia'
'autoplayMedia',
// Release channels
'channelDev',
'channelBeta'
]
}

Expand Down
5 changes: 3 additions & 2 deletions app/sessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ const setVersionInformation = (immutableData) => {
['libchromiumcontent', () => { return process.versions['chrome'] }],
['V8', () => { return process.versions.v8 }],
['Node.js', () => { return process.versions.node }],
['Update Channel', Channel.channel],
['Update Channel', Channel.formattedChannel],
['OS Platform', () => platformUtil.formatOsPlatform(os.platform())],
['OS Release', os.release],
['OS Architecture', os.arch]
Expand Down Expand Up @@ -784,8 +784,9 @@ module.exports.loadAppState = () => {

immutableData = module.exports.runPostMigrations(immutableData)
}
immutableData = setVersionInformation(immutableData)

locale.init(immutableData.getIn(['settings', settings.LANGUAGE])).then((locale) => {
immutableData = setVersionInformation(immutableData)
app.setLocale(locale)
resolve(immutableData)
})
Expand Down

0 comments on commit 3b93063

Please sign in to comment.