Skip to content

Commit

Permalink
fix: save country code (#324)
Browse files Browse the repository at this point in the history
Signed-off-by: “seriouszyx” <seriouszyx@foxmail.com>
  • Loading branch information
seriouszyx committed Nov 11, 2021
1 parent 3782906 commit cc933cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion web/src/SelectRegionBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SelectRegionBox extends React.Component {
>
{
Setting.CountryRegionData.map((item, index) => (
<Option key={index} value={item.name} label={item.name} >
<Option key={index} value={item.code} label={item.code} >
<img src={`${Setting.StaticBaseUrl}/flag-icons/${item.code}.svg`} alt={item.name} height={20} style={{marginRight: 10}}/>
{`${item.name} (${item.code})`}
</Option>
Expand Down
7 changes: 7 additions & 0 deletions web/src/UserListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ class UserListPage extends React.Component {
}

renderTable(users) {
// transfer country code to name based on selected language
var countries = require("i18n-iso-countries");
countries.registerLocale(require("i18n-iso-countries/langs/" + i18next.language + ".json"));
for (var index in users) {
users[index].region = countries.getName(users[index].region, i18next.language, {select: "official"})
}

const columns = [
{
title: i18next.t("general:Organization"),
Expand Down

0 comments on commit cc933cf

Please sign in to comment.