swagger-api / swagger-api/swagger-ui
[improvement] Translation: automatic and manual language selection
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Problem description:
* To enable translation you should include one of language-files in your index.html * after <script src='lang/translator.js' type='text/javascript'></script>. * For example - <script src='lang/ru.js' type='text/javascript'></script>
This is unacceptable in today's internet. Every end user should see his language.
So:
-
swagger-uishould provide some query parameter (e.g.lang) to set set user's language and apply corresponding translation. (This is needed for integration purposes.) -
If the parameter is not specified,
swagger-uishould determine user's language automatically using the following variables (actually, all of them in the specified order) and apply corresponding translation: -
End user should be able to change the language using
swagger-ui.
Additional information:
swagger-ui version affected: commit 1f2a5d7
swagger file: not required
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with dist/lang/translator.js, especially the documented language-file loading flow, and inspect the index.html integration described in the issue. Trace how translations are currently selected and loaded. Done means supporting an explicit lang query parameter, the listed browser-language fallbacks, and an end-user language change while applying the corresponding translation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, internationalization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100