Addons-frontend: Wrong Link to Dictionary for Hindi Language

Created on 4 Mar 2019  路  16Comments  路  Source: mozilla/addons-frontend

Describe the problem and steps to reproduce it:

Go to https://addons.mozilla.org/en-US/firefox/language-tools/

What happened?

Check the Dictionary listed for Hindi Language, right now its Hiligaynon spell checker which is wrong

What did you expect to happen?

Correct Dictionary for Hindi Language should be listed.

Anything else we should know?

image

assigned good first bug mentor assigned welcome p3 verified fixed

Most helpful comment

I am working on this. will submit a PR soon.

All 16 comments

I think this is a bug in the display of languages so I'm going to move it to the frontend. Looks like the code is outputting something in the wrong place, despite the target locale of the spell checker not matching the locale for that row in the table.

The issue is related to the regex used to match languages variants that is too permissive. Here is a quick fix for this issue:

diff --git a/src/amo/pages/LanguageTools/index.js b/src/amo/pages/LanguageTools/index.js
index 50cb73ebf..dd499d083 100644
--- a/src/amo/pages/LanguageTools/index.js
+++ b/src/amo/pages/LanguageTools/index.js
@@ -200,7 +200,7 @@ export class LanguageToolsBase extends React.Component<Props> {
                       return addon.target_locale === language.locale;
                     }

-                    const re = new RegExp(`${language.locale}(-\\w+)?`);
+                    const re = new RegExp(`^${language.locale}(-\\w+)?$`);

                     return addon.target_locale && re.test(addon.target_locale);
                   });

I am working on this. will submit a PR soon.

Mentor: @willdurand

Can I take up this bug?

@Shubhamchinda yep

Hi @Shubhamchinda
Please go on, Getting Started this will help you in setting up the project, if you have any issues, feel free to ask :)

Hi, if anybody has not taken up this issue. Can i work on it. I read that @willdurand asked to create a test case for this issue. Can anybody tell me how to create one.

@willdurand Okay, Thanks I'll write the test case and let you know when it's done.
Thanks @suhailsinghbains .

Hi @sashaktpathak Shubhamchinda is working on this, so, it cannot be transfered to you without consent. Please feel free to go issues

@willdurand Can you please take a look at it?

@willdurand Can you please take a look at it?

I am not sure I understand the test case you wrote. Could you explain it to me? The test case should fail in any case, given that the issue should be fixed. Thanks!

@willdurand I worked on it again, I hope I did it correct this time. Let me know if its' still not correct.

@willdurand Right now -dev and -stage have a Hindi(India) dictionary available.

only one Hindi

I believe this needs a check after it lands on prod.

I believe this needs a check after it lands on prod.

@ioanarusiczki that looks good. I suppose we could upload the Hiligaynon spell checker in -dev/stage and make sure it does not appear here.

@willdurand It's one Hindi now on prod which takes users to Hindi Spell Checker

only one hindi

Was this page helpful?
0 / 5 - 0 ratings