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

Showing better names for channels in about:brave page #10387

Merged
merged 2 commits into from
Aug 15, 2017

Conversation

prasanthp96
Copy link
Contributor

@prasanthp96 prasanthp96 commented Aug 10, 2017

I have modified the function that returns the channel name. I have included a map which has the mapping of the channel names as asked in the issue

Fix #10239

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.

Test Plan:
See #10239

Reviewer Checklist:

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@prasanthp96 prasanthp96 changed the title Showing better names for channels in about:brave page Fix brave/browser-laptop#10239 Showing better names for channels in about:brave page Aug 10, 2017
@codecov-io
Copy link

codecov-io commented Aug 10, 2017

Codecov Report

Merging #10387 into master will increase coverage by 0.02%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master   #10387      +/-   ##
==========================================
+ Coverage   54.31%   54.33%   +0.02%     
==========================================
  Files         245      245              
  Lines       21148    21156       +8     
  Branches     3259     3260       +1     
==========================================
+ Hits        11486    11495       +9     
+ Misses       9662     9661       -1
Flag Coverage Δ
#unittest 54.33% <66.66%> (+0.02%) ⬆️
Impacted Files Coverage Δ
app/locale.js 35.57% <ø> (ø) ⬆️
app/sessionStore.js 63.3% <50%> (+0.55%) ⬆️
app/channel.js 85% <71.42%> (-7.31%) ⬇️

@luixxiul luixxiul added this to the 0.21.x (Nightly Channel) milestone Aug 10, 2017
@prasanthp96
Copy link
Contributor Author

@luixxiul how to resolve the failing check in my commit ?

@luixxiul
Copy link
Contributor

@prasanthp96 the Travis build has always failed and you don't have to worry about that. If you find your change breaks existing tests, please fix it. If you are not sure, please just leave it.

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start 😄

Since these strings will be human readable, we're going to want to localize them.

  1. You can put the string in app/extensions/brave/locales/en-US/app.properties. It could look like:
channelDev=Release
channelBeta=Beta

Anything in the en-US .properties file will be automatically submitted to our translators 😄 This will let folks translate "Release" to their native language

  1. This file can be updated to include l10n.js and then use the translate method. You can see an example in app/extensions.js

So it would end up being like:

let channelMapping = {
  'dev': l10n.translate('channelDev')

@@ -784,8 +784,9 @@ module.exports.loadAppState = () => {

immutableData = module.exports.runPostMigrations(immutableData)
}
immutableData = setVersionInformation(immutableData)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this had to be moved; translations are only available AFTER the locale finishes initializing 😄

@@ -20,6 +20,16 @@ exports.channel = () => {
return channel
}

exports.formattedChannel = () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing method was left alone since telemetry also uses it (and the values in that case shouldn't change)

'autoplayMedia'
'autoplayMedia',
// Release channels
'channelDev',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New translatable strings must be entered here in order to be accessible by the locale.translate() method. The name here matches the name in en-US/app.properties

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prasanthp96 I added a commit which I'd like you to check out 😄 The strings are now translatable. Let me know what you think!

prasanthp96 and others added 2 commits August 15, 2017 15:17
- 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
@bsclifton bsclifton modified the milestones: 0.19.x (Beta Channel), 0.21.x (Nightly Channel) Aug 15, 2017
@bsclifton bsclifton merged commit 8776cd9 into brave:master Aug 15, 2017
bsclifton added a commit that referenced this pull request Aug 15, 2017
Showing better names for channels in about:brave page
bsclifton added a commit that referenced this pull request Aug 15, 2017
Showing better names for channels in about:brave page
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants