Skip to content

Merge request branch cloud not load with non-english preference setting

Summary

When a user change user perference language to non-english, branch list return empty list in merge requests page.

Steps to reproduce

  1. set your user settting to Chinese (non-english)
  2. Open Merge Requests tab
  3. Create a new merge request

What is the current bug behavior?

Branch selector return a empty branch list.

What is the expected correct behavior?

Branch selector load the list of branch in this repo.

Relevant logs and/or screenshots

image

This is the response when the language was set to 'english'.

{  
   "Branches":[  
      "'test'",
      "100%branch",
      "1942eed5cc108b19c7405106e81fa96125d0be22",
      "add-balsamiq-file",
      "add-ipython-files",
      "add-pdf-file"
   ]
}

This is the response when the language was set to 'chinese'.

{  
   "分支":[  
      "'test'",
      "100%branch",
      "1942eed5cc108b19c7405106e81fa96125d0be22",
      "add-balsamiq-file",
      "add-ipython-files",
      "add-pdf-file"
   ]
}

Output of checks

Produce on GitLab CE v10.8.1

This bug also happens on GitLab.com.

Possible fixes

Relevant file

app/controllers/projects_controller.rb

app/assets/javascripts/compare_autocomplete.js

app/assets/javascripts/gl_dropdown.js

Relevant commit: https://gitlab.com/gitlab-org/gitlab-ce/commit/244f511eece07e906ec82bebf3ccb2f69a15ea92

The controller returns a localized json response, and fontend do not select it with localized key.

For example, backend returns {"分支":[]}, frontend showsresp['branches'] to users.

The simplest way to fix it is localizing the key in frontend. (!19348 (closed))

But I think that design may lead to localize on both side(frontend and backend.)

Edited by WayJam So