Skip to content

Commit

Permalink
fix search return localized values
Browse files Browse the repository at this point in the history
  • Loading branch information
sg3des committed Jul 5, 2018
1 parent 05c1410 commit 3e0e49f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion i18n.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ func (i18n *I18n) ConfigureQorResource(res resource.Resourcer) {
for key, translation := range translations {
if (keyword == "") || (strings.Index(strings.ToLower(translation.Key), keyword) != -1 ||
strings.Index(strings.ToLower(translation.Value), keyword) != -1) {

if _, ok := matchedTranslations[key]; !ok {
var t = matchedTranslation{
Key: key,
Expand All @@ -336,6 +337,12 @@ func (i18n *I18n) ConfigureQorResource(res resource.Resourcer) {
}
}

if localeTranslations, ok := translationsMap[editingLocale]; ok {
if v, ok := localeTranslations[key]; ok {
t.EditingValue = v.Value
}
}

matchedTranslations[key] = t
keys = append(keys, key)
}
Expand Down Expand Up @@ -365,7 +372,7 @@ func (i18n *I18n) ConfigureQorResource(res resource.Resourcer) {
}

if pagination.CurrentPage > 0 {
pagination.Pages = pagination.Total / pagination.PerPage
pagination.Pages = pagination.Total/pagination.PerPage + 1
}

context.Searcher.Pagination = pagination
Expand Down

0 comments on commit 3e0e49f

Please sign in to comment.