-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Verify Translation in Development #9878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
app/controllers/home_controller.rb
Outdated
| redirect_to '/change_locale/zh-CN' | ||
| end | ||
|
|
||
| def switch_off_translation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
app/controllers/home_controller.rb
Outdated
| end | ||
|
|
||
| def switch_off_translation | ||
| UserTag.remove_if_exists(current_user.uid,'translation-helper') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 4) spaces for indentation.
app/controllers/home_controller.rb
Outdated
| end | ||
|
|
||
| def switch_on_translation | ||
| UserTag.create_if_absent(current_user.uid,'translation-helper') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space missing after comma.
app/controllers/home_controller.rb
Outdated
| end | ||
|
|
||
| def switch_off_translation | ||
| UserTag.remove_if_exists(current_user.uid,'translation-helper') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space missing after comma.
Codecov Report
@@ Coverage Diff @@
## main #9878 +/- ##
==========================================
+ Coverage 78.24% 82.12% +3.88%
==========================================
Files 98 98
Lines 5947 5964 +17
==========================================
+ Hits 4653 4898 +245
+ Misses 1294 1066 -228
|
|
@imajit Nice work! |
58eaa73 to
200ef11
Compare
|
The tests commit fails , is this because the code the tests are checking is not there in the code-base yet ? |
app/controllers/home_controller.rb
Outdated
| end | ||
| end | ||
|
|
||
| def switch_on_translation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should name this
| def switch_on_translation | |
| def switch_on_translation_helper |
Is this only for development mode? If so, couldn't we use an existing route somehow -- https://github.com/publiclab/plots2/blob/main/test/functional/user_tags_controller_test.rb#L8-L15 maybe? To add the tag? though i guess it's 2 steps.
If the code is not there yet, then yes! But you can then add the code and the test would then begin to pass. That would be "Test Driven Development" - a nice pattern! |
config/routes.rb
Outdated
| post 'comment/react/delete/:id' => 'comment#react_delete' | ||
| post 'comment/react/update/:id' => 'comment#react_update' | ||
|
|
||
| get 'switch_on_translation' => 'home#switch_on_translation' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if possible if we could use existing routes, we'd be able to skip some of the tests because we wouldn't be introducing a whole new route, you know? That would keep codebase complexity down a bit, which is really helpful in the long run on a big project like this.
|
|
|
This is looking great! As to another place, it's only in development mode, but maybe it'd confuse people? What if we put it in the navbar menu? And don't worry about CodeCov, i'm working on that in #9905 Thanks! |
|
The top Nav-bar right ? the one with the search bar |
|
Would it be possible to put it in the same dropdown as under the profile
picture (the small grey circle to the right side)? Thank you!
…On Sat, Jul 17, 2021 at 5:43 AM Ajit Mujumdar ***@***.***> wrote:
This is how it looks in top-nav
[image: ezgif com-gif-maker(2)]
<https://user-images.githubusercontent.com/38528640/126032897-5c9367d2-3152-4d49-b1da-fc8a7db23128.gif>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#9878 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAF6JZRVCBPZNMRQUUC77DTYFGFXANCNFSM47XCTCRQ>
.
|
| @output[:errors] << I18n.t('user_tags_controller.value_cannot_be_empty') | ||
| end | ||
| if params[:translationswitch] | ||
| redirect_to URI.parse('/change_locale/zh-CN').path and return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use && instead of and.
| end | ||
|
|
||
| if params[:translationswitch] | ||
| redirect_to URI.parse('/change_locale/en').path and return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use && instead of and.
|
Code Climate has analyzed commit 0047d80 and detected 2 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
|
Looks good to me! @jywarren, the |
|
Excellent, thank you so much!!! |
* Added check verify translation button * Adding spaces * Added route tests * Reusing existing routes * Removed tests * Moved button to Top-Nav * Moved button to profile dropdown Co-authored-by: imajit <[email protected]>
* Added check verify translation button * Adding spaces * Added route tests * Reusing existing routes * Removed tests * Moved button to Top-Nav * Moved button to profile dropdown Co-authored-by: imajit <[email protected]>



Fixes #9686

To review of FTOs easily, now the contributor can quickly change the required files and run it on Gitpod. As some of the FTOs related to translation need UI checks, in PR contributors can add the Gitpod UI screenshots.
I read about this method to show the button in development mode only, not sure if this is the best practice, also some numbers are attached to the link whenever the button is pressed, it doesn't affect the result though not sure how it is getting added each time.