From f0cf4e4c635c372a2d810b80620a306c87a39c97 Mon Sep 17 00:00:00 2001 From: Florian Dupret <34862846+sephrat@users.noreply.github.com> Date: Wed, 28 Apr 2021 20:01:04 +0200 Subject: [PATCH] Rearrange strings hierarchy --- frontend/src/api/category.js | 12 +-- frontend/src/api/groups.js | 16 ++-- frontend/src/locales/messages/en-US.json | 91 ++++++++++--------- .../src/pages/Admin/ManageUsers/GroupCard.vue | 6 +- .../Admin/ManageUsers/GroupDashboard.vue | 6 +- .../pages/Admin/ManageUsers/TheUserTable.vue | 4 +- .../src/pages/Admin/ManageUsers/index.vue | 2 +- frontend/src/pages/Admin/Profile/index.vue | 4 +- frontend/src/pages/SearchPage/index.vue | 2 +- 9 files changed, 72 insertions(+), 71 deletions(-) diff --git a/frontend/src/api/category.js b/frontend/src/api/category.js index e82ad5303..633e7c481 100644 --- a/frontend/src/api/category.js +++ b/frontend/src/api/category.js @@ -26,8 +26,8 @@ export const categoryAPI = { const response = await apiReq.post( categoryURLs.getAll, { name: name }, - function() { return i18n.t('settings.category-creation-failed'); }, - function() { return i18n.t('settings.category-created'); } + function() { return i18n.t('category.category-creation-failed'); }, + function() { return i18n.t('category.category-created'); } ); if(response) { store.dispatch("requestCategories"); @@ -42,8 +42,8 @@ export const categoryAPI = { const response = await apiReq.put( categoryURLs.updateCategory(name), { name: newName }, - function() { return i18n.t('settings.category-update-failed'); }, - function() { return i18n.t('settings.category-updated'); } + function() { return i18n.t('category.category-update-failed'); }, + function() { return i18n.t('category.category-updated'); } ); if (response && !overrideRequest) { store.dispatch("requestCategories"); @@ -54,8 +54,8 @@ export const categoryAPI = { const response = await apiReq.delete( categoryURLs.deleteCategory(category), null, - function() { return i18n.t('settings.category-deletion-failed'); }, - function() { return i18n.t('settings.category-deleted'); } + function() { return i18n.t('category.category-deletion-failed'); }, + function() { return i18n.t('category.category-deleted'); } ); if (response && !overrideRequest) { store.dispatch("requestCategories"); diff --git a/frontend/src/api/groups.js b/frontend/src/api/groups.js index c26e8021a..02a217c60 100644 --- a/frontend/src/api/groups.js +++ b/frontend/src/api/groups.js @@ -15,16 +15,16 @@ function deleteErrorText(response) { console.log(response.data); switch(response.data.detail) { case 'GROUP_WITH_USERS': - return i18n.t('user.cannot-delete-group-with-users'); + return i18n.t('group.cannot-delete-group-with-users'); case 'GROUP_NOT_FOUND': - return i18n.t('user.group-not-found'); + return i18n.t('group.group-not-found'); case 'DEFAULT_GROUP': - return i18n.t('user.cannot-delete-default-group'); + return i18n.t('group.cannot-delete-default-group'); default: - return i18n.t('user.group-deletion-failed'); + return i18n.t('group.group-deletion-failed'); } } @@ -37,8 +37,8 @@ export const groupAPI = { return apiReq.post( groupsURLs.create, { name: name }, - function() { return i18n.t('user.user-group-creation-failed'); }, - function() { return i18n.t('user.user-group-created'); } + function() { return i18n.t('group.user-group-creation-failed'); }, + function() { return i18n.t('group.user-group-created'); } ); }, delete(id) { @@ -46,7 +46,7 @@ export const groupAPI = { groupsURLs.delete(id), null, deleteErrorText, - function() { return i18n.t('user.group-deleted'); } + function() { return i18n.t('group.group-deleted'); } ); }, async current() { @@ -57,7 +57,7 @@ export const groupAPI = { return apiReq.put( groupsURLs.update(data.id), data, - function() { return i18n.t('user.error-updating-group'); }, + function() { return i18n.t('group.error-updating-group'); }, function() { return i18n.t('settings.group-settings-updated'); } ); }, diff --git a/frontend/src/locales/messages/en-US.json b/frontend/src/locales/messages/en-US.json index e05c6bfda..ad517aff4 100644 --- a/frontend/src/locales/messages/en-US.json +++ b/frontend/src/locales/messages/en-US.json @@ -20,6 +20,15 @@ "sqlite-file": "SQLite File", "version": "Version" }, + "category": { + "category-created": "Category created", + "category-creation-failed": "Category creation failed", + "category-deleted": "Category Deleted", + "category-deletion-failed": "Category deletion failed", + "category-filter": "Category Filter", + "category-update-failed": "Category update failed", + "category-updated": "Category updated" + }, "general": { "apply": "Apply", "cancel": "Cancel", @@ -43,13 +52,11 @@ "get": "Get", "groups": "Groups", "image": "Image", - "image-updated": "Image updated", "image-upload-failed": "Image upload failed", "import": "Import", "monday": "Monday", "name": "Name", "no": "No", - "not-authorized": "Not authorized", "ok": "OK", "options": "Options:", "random": "Random", @@ -77,6 +84,25 @@ "wednesday": "Wednesday", "yes": "Yes" }, + "group": { + "are-you-sure-you-want-to-delete-the-group": "Are you sure you want to delete {groupName}?", + "cannot-delete-default-group": "Cannot delete default group", + "cannot-delete-group-with-users": "Cannot delete group with users", + "confirm-group-deletion": "Confirm Group Deletion", + "create-group": "Create Group", + "error-updating-group": "Error updating group", + "group": "Group", + "group-deleted": "Group deleted", + "group-deletion-failed": "Group deletion failed", + "group-id-with-value": "Group ID: {groupID}", + "group-name": "Group Name", + "group-not-found": "Group not found", + "groups": "Groups", + "groups-can-only-be-set-by-administrators": "Groups can only be set by administrators", + "user-group": "User Group", + "user-group-created": "User Group Created", + "user-group-creation-failed": "User Group Creation Failed" + }, "meal-plan": { "create-a-new-meal-plan": "Create a New Meal Plan", "dinner-this-week": "Dinner This Week", @@ -126,13 +152,13 @@ "home-page": "Home Page", "new-page-created": "New page created", "page-creation-failed": "Page creation failed", + "page-deleted": "Page deleted", + "page-deletion-failed": "Page deletion failed", "page-update-failed": "Page update failed", "page-updated": "Page updated", "pages-update-failed": "Pages update failed", "pages-updated": "Pages updated", - "recent": "Recent", - "page-deletion-failed": "Page deletion failed", - "page-deleted": "Page deleted" + "recent": "Recent" }, "recipe": { "add-key": "Add Key", @@ -162,6 +188,8 @@ "perform-time": "Cook Time", "prep-time": "Prep Time", "protein-content": "Protein Content", + "recipe-created": "Recipe created", + "recipe-creation-failed": "Recipe creation failed", "recipe-deleted": "Recipe deleted", "recipe-image": "Recipe Image", "recipe-image-updated": "Recipe image updated", @@ -174,17 +202,14 @@ "title": "Title", "total-time": "Total Time", "unable-to-delete-recipe": "Unable to Delete Recipe", - "view-recipe": "View Recipe", - "recipe-creation-failed": "Recipe creation failed", - "recipe-created": "Recipe created" + "view-recipe": "View Recipe" }, "search": { - "category-filter": "Category Filter", + "and": "and", "exclude": "Exclude", "include": "Include", "max-results": "Max Results", "or": "Or", - "and": "and", "search": "Search", "search-mealie": "Search Mealie (press /)", "search-placeholder": "Search...", @@ -207,9 +232,6 @@ }, "backup-and-exports": "Backups", "backup-info": "Backups are exported in standard JSON format along with all the images stored on the file system. In your backup folder you'll find a .zip file that contains all of the recipe JSON and images from the database. Additionally, if you selected a markdown file, those will also be stored in the .zip file. To import a backup, it must be located in your backups folder. Automated backups are done each day at 3:00 AM.", - "category-deleted": "Category Deleted", - "category-creation-failed": "Category creation failed", - "category-deletion-failed": "Category deletion failed", "change-password": "Change Password", "current": "Version:", "custom-pages": "Custom Pages", @@ -265,40 +287,31 @@ "theme-updated": "Theme updated", "warning": "Warning" }, + "toolbox": { + "assign-all": "Assign All", + "bulk-assign": "Bulk Assign", + "new-name": "New Name", + "no-unused-items": "No Unused Items", + "recipes-effected": "Recipes Effected", + "remove-unused": "Remove Unused", + "title-case-all": "Title Case All", + "toolbox": "Toolbox" + }, "webhooks": { "meal-planner-webhooks": "Meal Planner Webhooks", "test-webhooks": "Test Webhooks", "the-urls-listed-below-will-recieve-webhooks-containing-the-recipe-data-for-the-meal-plan-on-its-scheduled-day-currently-webhooks-will-execute-at": "The URLs listed below will receive webhooks containing the recipe data for the meal plan on it's scheduled day. Currently Webhooks will execute at", "webhook-url": "Webhook URL" - }, - "toolbox": { - "toolbox": "Toolbox", - "new-name": "New Name", - "recipes-effected": "Recipes Effected", - "title-case-all": "Title Case All", - "no-unused-items": "No Unused Items", - "remove-unused": "Remove Unused", - "assign-all": "Assign All", - "bulk-assign": "Bulk Assign" - }, - "category-created": "Category created", - "category-update-failed": "Category update failed", - "category-updated": "Category updated" + } }, - "this": {}, "user": { "admin": "Admin", - "are-you-sure-you-want-to-delete-the-group": "Are you sure you want to delete {groupName}?", "are-you-sure-you-want-to-delete-the-link": "Are you sure you want to delete the link {link}?", "are-you-sure-you-want-to-delete-the-user": "Are you sure you want to delete the user {activeName} ID: {activeId}?", - "cannot-delete-default-group": "Cannot delete default group", - "cannot-delete-group-with-users": "Cannot delete group with users", - "confirm-group-deletion": "Confirm Group Deletion", "confirm-link-deletion": "Confirm Link Deletion", "confirm-password": "Confirm Password", "confirm-user-deletion": "Confirm User Deletion", "could-not-validate-credentials": "Could Not Validate Credentials", - "create-group": "Create Group", "create-link": "Create Link", "create-user": "Create User", "current-password": "Current Password", @@ -306,17 +319,8 @@ "edit-user": "Edit User", "email": "Email", "error-cannot-delete-super-user": "Error! Cannot Delete Super User", - "error-updating-group": "Error updating group", "existing-password-does-not-match": "Existing password does not match", "full-name": "Full Name", - "group": "Group", - "group-deleted": "Group deleted", - "group-deletion-failed": "Group deletion failed", - "group-id-with-value": "Group ID: {groupID}", - "group-name": "Group Name", - "group-not-found": "Group not found", - "groups": "Groups", - "groups-can-only-be-set-by-administrators": "Groups can only be set by administrators", "incorrect-username-or-password": "Incorrect username or password", "link-id": "Link ID", "link-name": "Link Name", @@ -340,9 +344,6 @@ "user-created": "User created", "user-creation-failed": "User creation failed", "user-deleted": "User deleted", - "user-group": "User Group", - "user-group-created": "User Group Created", - "user-group-creation-failed": "User Group Creation Failed", "user-id": "User ID", "user-id-with-value": "User ID: {id}", "user-password": "User Password", diff --git a/frontend/src/pages/Admin/ManageUsers/GroupCard.vue b/frontend/src/pages/Admin/ManageUsers/GroupCard.vue index a27156a2e..d2f17c3fd 100644 --- a/frontend/src/pages/Admin/ManageUsers/GroupCard.vue +++ b/frontend/src/pages/Admin/ManageUsers/GroupCard.vue @@ -2,9 +2,9 @@
{{ group.name }} {{ - $t("user.group-id-with-value", { groupID: group.id }) + $t("group.group-id-with-value", { groupID: group.id }) }} diff --git a/frontend/src/pages/Admin/ManageUsers/GroupDashboard.vue b/frontend/src/pages/Admin/ManageUsers/GroupDashboard.vue index bb7f27710..f8158a6dd 100644 --- a/frontend/src/pages/Admin/ManageUsers/GroupDashboard.vue +++ b/frontend/src/pages/Admin/ManageUsers/GroupDashboard.vue @@ -24,7 +24,7 @@ v-bind="attrs" v-on="on" > - {{ $t("user.create-group") }} + {{ $t("group.create-group") }} @@ -34,7 +34,7 @@ - {{ $t("user.create-group") }} + {{ $t("group.create-group") }} @@ -43,7 +43,7 @@ diff --git a/frontend/src/pages/Admin/ManageUsers/TheUserTable.vue b/frontend/src/pages/Admin/ManageUsers/TheUserTable.vue index 826d6d4a2..f177082e7 100644 --- a/frontend/src/pages/Admin/ManageUsers/TheUserTable.vue +++ b/frontend/src/pages/Admin/ManageUsers/TheUserTable.vue @@ -72,7 +72,7 @@ dense v-model="editedItem.group" :items="existingGroups" - :label="$t('user.user-group')" + :label="$t('group.user-group')" > @@ -165,7 +165,7 @@ export default { }, { text: this.$t("user.full-name"), value: "fullName" }, { text: this.$t("user.email"), value: "email" }, - { text: this.$t("user.group"), value: "group" }, + { text: this.$t("group.group"), value: "group" }, { text: this.$t("user.admin"), value: "admin" }, { text: "", value: "actions", sortable: false, align: "center" }, ], diff --git a/frontend/src/pages/Admin/ManageUsers/index.vue b/frontend/src/pages/Admin/ManageUsers/index.vue index b795ebba0..efdee1587 100644 --- a/frontend/src/pages/Admin/ManageUsers/index.vue +++ b/frontend/src/pages/Admin/ManageUsers/index.vue @@ -21,7 +21,7 @@ - {{ $t("user.groups") }} + {{ $t("group.groups") }} mdi-account-group diff --git a/frontend/src/pages/Admin/Profile/index.vue b/frontend/src/pages/Admin/Profile/index.vue index 2c0b990ee..d25b1d003 100644 --- a/frontend/src/pages/Admin/Profile/index.vue +++ b/frontend/src/pages/Admin/Profile/index.vue @@ -55,11 +55,11 @@ > diff --git a/frontend/src/pages/SearchPage/index.vue b/frontend/src/pages/SearchPage/index.vue index e00fb4eff..7760ba5c0 100644 --- a/frontend/src/pages/SearchPage/index.vue +++ b/frontend/src/pages/SearchPage/index.vue @@ -26,7 +26,7 @@

- {{ $t("search.category-filter") }} + {{ $t("category.category-filter") }}