FIX: Translation of plugin directory column on mobile (#13516)

This commit is contained in:
Mark VanLandingham 2021-06-24 10:11:24 -05:00 committed by GitHub
parent 0adeddde61
commit 180c0c4dc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 14 deletions

View File

@ -6,7 +6,9 @@ import I18n from "I18n";
registerUnbound("mobile-directory-item-label", function (args) { registerUnbound("mobile-directory-item-label", function (args) {
// Args should include key/values { item, column } // Args should include key/values { item, column }
const count = args.item.get(args.column.name); const count = args.item.get(args.column.name);
return htmlSafe(I18n.t(`directory.${args.column.name}`, { count })); const translationPrefix =
args.column.type === "automatic" ? "directory." : "";
return htmlSafe(I18n.t(`${translationPrefix}${args.column.name}`, { count }));
}); });
registerUnbound("directory-item-value", function (args) { registerUnbound("directory-item-value", function (args) {

View File

@ -1,7 +1,19 @@
{{user-info user=item.user}} {{user-info user=item.user}}
{{#each columns as |column|}} {{#each columns as |column|}}
{{#if (directory-column-is-automatic column=column)}} {{#if (directory-column-is-user-field column=column)}}
{{#if (get item.user.user_fields column.user_field_id)}}
<div class="user-stat">
<span class="value user-field">
{{directory-item-user-field-value item=item column=column}}
</span>
<span class="label">
{{column.name}}
</span>
</div>
{{/if}}
{{else}}
<div class="user-stat"> <div class="user-stat">
<span class="value"> <span class="value">
{{directory-item-value item=item column=column}} {{directory-item-value item=item column=column}}
@ -13,18 +25,6 @@
{{mobile-directory-item-label item=item column=column}} {{mobile-directory-item-label item=item column=column}}
</span> </span>
</div> </div>
{{else}}
{{#if (get item.user.user_fields column.user_field_id)}}
<div class="user-stat">
<span class="value user-field">
{{directory-item-user-field-value item=item column=column}}
</span>
<span class="label">
{{column.name}}
</span>
</div>
{{/if}}
{{/if}} {{/if}}
{{/each}} {{/each}}