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

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

diff --git a/app/assets/javascripts/discourse/app/helpers/directory-item-helpers.js b/app/assets/javascripts/discourse/app/helpers/directory-item-helpers.js
index 1007a50..29339de 100644
--- a/app/assets/javascripts/discourse/app/helpers/directory-item-helpers.js
+++ b/app/assets/javascripts/discourse/app/helpers/directory-item-helpers.js
@@ -6,7 +6,9 @@ import I18n from "I18n";
 registerUnbound("mobile-directory-item-label", function (args) {
   // Args should include key/values { item, column }
   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) {
diff --git a/app/assets/javascripts/discourse/app/templates/mobile/components/directory-item.hbs b/app/assets/javascripts/discourse/app/templates/mobile/components/directory-item.hbs
index 3f75ed7..8560f19 100644
--- a/app/assets/javascripts/discourse/app/templates/mobile/components/directory-item.hbs
+++ b/app/assets/javascripts/discourse/app/templates/mobile/components/directory-item.hbs
@@ -1,7 +1,19 @@
 {{user-info user=item.user}}
 
 {{#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">
       <span class="value">
         {{directory-item-value item=item column=column}}
@@ -13,18 +25,6 @@
         {{mobile-directory-item-label item=item column=column}}
       </span>
     </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}}
 {{/each}}
 

GitHub sha: 180c0c4dc3ffddbe19081f0b655cce9d2b1475eb

This commit appears in #13516 which was approved by eviltrout. It was merged by markvanlan.