Skip to content
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

amaGama returns a 404 with same language pairs #4759

Closed
jason-p-pickering opened this issue May 25, 2016 · 12 comments
Closed

amaGama returns a 404 with same language pairs #4759

jason-p-pickering opened this issue May 25, 2016 · 12 comments

Comments

@jason-p-pickering
Copy link
Contributor

jason-p-pickering commented May 25, 2016

Use case-Improvement of template language messages. In this case, the user is translating the template languages (in English) to English.

When translating in the /en/ project, a request is issued to Amagama.

An error message results in Pootle due to the 404

selection_676

Perhaps an HTTP 204 would be more appropriate?

@unho
Copy link
Member

unho commented May 25, 2016

amaGama itself avoids handling translation from same language to same language: https://github.com/translate/amagama/blob/master/amagama/tmdb.py#L441-L443 Perhaps this is not dealt with in the best way on the amaGama side, but the point is that Pootle should avoid sending requests for getting translation suggestion from a language to the same language.

@leonardcj
Copy link
Contributor

You might ask why this matters, but the use-case is actually important. I routinely "translate" new projects into the lang-en project as a review for i18n issues. Pootle conveniently allows me to flag strings as "Needs Work", with the understanding that the work needed is on i18n, not L10n.

@unho
Copy link
Member

unho commented May 25, 2016

My understanding is that in that particular use-case results from amaGama are unnecessary.

@dwaynebailey
Copy link
Member

dwaynebailey commented May 26, 2016

There are three aspects here:

  1. Response code for non-results. I think @jason-p-pickering is right here that 404 is probably wrong, but I'm not sure if 204 is better.
  2. Pootle shouldn't be asking amaGama for results when the pairs are the same. Though I'd want to at least check the en_US:en_GB are not see as en:en pairs, same for pt and fr that might be asking for regional dialects.
  3. Pootle should handle 404 better as there might be other times when amaGama returns a 404.

@unho unho changed the title Amagana returns a 404 when with common language pairs amaGama returns a 404 with same language pairs May 26, 2016
@jason-p-pickering
Copy link
Contributor Author

@dwaynebailey , I think maybe a 400 Bad Request is better in this case?

@dwaynebailey
Copy link
Member

Just for reference https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

400 might be better, but I haven't looked carefully at the available options.

@phlax phlax added this to the 2.8.0 milestone May 27, 2016
@unho unho closed this as completed in fa7c118 May 30, 2016
@unho
Copy link
Member

unho commented May 30, 2016

Landed the fix in fa7c118 to prevent querying amaGama if source and target language are the same. amaGama issues still to be addressed on amaGama side.

@dwaynebailey
Copy link
Member

Reopening this. Pootle will still fail if it gets a 404 as far as I can understand, so this is a workaround but its not fixing the core issue that Pootle won't fail correctly if amaGama is broken in some way.

@dwaynebailey dwaynebailey reopened this May 31, 2016
@unho
Copy link
Member

unho commented May 31, 2016

No, it won't fail. It will catch the error and will just display the message seen in the screenshot in the first message in the issue. See https://github.com/translate/pootle/blob/master/pootle/static/js/editor/app.js#L1056-L1079 for the shared handling code.

@jason-p-pickering
Copy link
Contributor Author

jason-p-pickering commented May 31, 2016

From a translation perspective, I think if Amagama fails for whatever
reason, Pootle should simply swallow the error (possibly logging the
occurrence in the JavaScript console) but not continually display the error
message to the translator. The memory there is to help the translator, but
if the service does not work, then I don't think we should penalize the
translator to see the error message each and every time it occurs.

I am not sure if this is what happens but from a usability standpoint, this
would seem to make sense.

@unho
Copy link
Member

unho commented May 31, 2016

Created translate/amagama#3210 to track the amaGama side of things.

@unho
Copy link
Member

unho commented May 31, 2016

Created #4771 to track the bigger issue with XHR request failures on Pootle.

As a result I will be closing this issue.

@unho unho closed this as completed May 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants