Formats supported languages by capitalizing them#27
Conversation
| {Object.entries(SUPPORTED_LANGUAGES).map(([name, lang]) => ( | ||
| <a href={`/${lang}/`}> | ||
| {Object.entries(this.formatLanguages).map(([name, lang]) => ( | ||
| <a key={name} href={`/${lang}/`}> |
There was a problem hiding this comment.
This line is being edited because React needs for each anchor to have a unique key.
| } | ||
|
|
||
| // TODO capitalize | ||
| export const SUPPORTED_LANGUAGES = { |
There was a problem hiding this comment.
Is there a reason why one wouldn't just modify this object directly?
Also this object seems backwards. Short codes as the value and the human string as the key?
🤔
There was a problem hiding this comment.
This might require additional work to refactor where the language is set in redux, but it seems like a better design?
There was a problem hiding this comment.
Your concerns on the object's structure, and future use are for sure valid and I invite the conversation to go over the issue outlined and scope of refactoring.
As for why not just modify the object directly, because it is currently being touched by a few other pieces in the code base (components and material-ui frame work all expecting "language": "lang-code"). I figured the swift direct approach to fix "language capitalization" (for display purpose) was to create a helper function to handle formatting for displaying purposes.
There was a problem hiding this comment.
I agree it seems backwards and we could probably flip it. @albertcui do you remember if this was done for a reason? Are we indexing into this object by the human name?
|
I think we should just update the object. OpenDota already has a copy of the correct strings, we should just paste those in: |
fixes #19