diff --git a/STYLEGUIDE.md b/STYLEGUIDE.md index 276ee2c9..cf799480 100644 --- a/STYLEGUIDE.md +++ b/STYLEGUIDE.md @@ -239,23 +239,28 @@ activist is a global platform and must function in countless different regions a > > - This is the source from which all the other languages are translated from > - Edits to the other files should be made on activist's [public localization project on Weblate](https://hosted.weblate.org/projects/activist/activist) -> - Do not put the JSON dictionaries into different levels! +> - Do not convert the JSON dictionaries into nested sub-objects! > - The purpose of the flat dictionaries is so that we can search for the key in the codebase and easily find its uses and where it's defined > - Do not include periods in aria-labels (screen reader user will configure their own preferences for a hard stop) Localization keys should be defined based on the file in which they're used within the platform and the content that they refer to (`CONTENT_REFERENCE` below). Please use the following rules as a guide if you find yourself needing to create new localization keys: +- Please use the `i18nMap` object for all texts within the frontend + - This object returns the sequence of object methods as a string and allows ESLint to be used to check key accuracy + - Ex: Using the `i18nMap` object: + - ✅ `i18nMap._global.about` + - ❌ `"_global.about"` - Separate directories and references by `.` and PascalCase/camelCase file name components by `_` in keys - - Ex: `"components.search_bar.CONTENT_REFERENCE"` for the `SearchBar` component + - Ex: `i18nMap.components.search_bar.CONTENT_REFERENCE` for the `SearchBar` component - Even though Nuxt allows for us to nest components in directories, avoid repetition in the directory path used to define the localization key - Ex: If you're defining a key within `CardAbout`: - - ✅ `"components.card_about.CONTENT_REFERENCE"` - - ❌ `"components.card.card_about.CONTENT_REFERENCE"` + - ✅ `i18nMap.components.card_about.CONTENT_REFERENCE` + - ❌ `i18nMap.components.card.card_about.CONTENT_REFERENCE` - Define keys based on the lowest level file in which they're used - Use `_global` to indicate that a key is used in multiple places in a given directory - Ex: You're creating a key that's used by multiple cards: - - ✅ `"components.card._global.CONTENT_REFERENCE"` - - ❌ `"components.card.INDIVIDUAL_COMPONENT.CONTENT_REFERENCE"` + - ✅ `i18nMap.components.card._global.CONTENT_REFERENCE` + - ❌ `i18nMap.components.card.INDIVIDUAL_COMPONENT.CONTENT_REFERENCE` - Please end all aria-label keys with `_alt_text` so the localization team knows that they're for screen readers - If you need a capitalized and lower case version of a word, signify the lower case version with `_lower` at the end of the key - For pages with long texts please follow the below naming criteria: @@ -274,7 +279,7 @@ Localization keys should be defined based on the file in which they're used with - This makes sure that content writers and the i18n team are only working with language that's actively in use > [!NOTE] -> The activist community also maintains the [i18n-check project](https://github.com/activist-org/i18n-check-action?tab=readme-ov-file#contentions) that enforces all of the above in pull requests. Do your best and we'll help you out during the PR process! You can also join us in the [localization room on Matrix](https://matrix.to/#/!DzbdYyfhjinQBWXgQe:matrix.org?via=matrix.org) if you have questions :) +> The activist community also maintains the [i18n-check project](https://github.com/activist-org/i18n-check) that enforces all of the above in pull requests. Do your best and we'll help you out during the PR process! You can also join us in the [localization room on Matrix](https://matrix.to/#/!DzbdYyfhjinQBWXgQe:matrix.org?via=matrix.org) if you have questions :) diff --git a/frontend/components/EmptyState.vue b/frontend/components/EmptyState.vue index a2515546..310566c4 100644 --- a/frontend/components/EmptyState.vue +++ b/frontend/components/EmptyState.vue @@ -8,36 +8,36 @@
{{ - $t("components.empty_state.organizations_header") + $t(i18nMap.components.empty_state.organizations_header) }} {{ - $t("components.empty_state.groups_header") + $t(i18nMap.components.empty_state.groups_header) }} {{ - $t("components.empty_state.events_header") + $t(i18nMap.components.empty_state.events_header) }} {{ - $t("components.empty_state.resources_header") + $t(i18nMap.components.empty_state.resources_header) }} {{ - $t("components.empty_state.faq_header") + $t(i18nMap.components.empty_state.faq_header) }} {{ - $t("components.empty_state.team_header") + $t(i18nMap.components.empty_state.team_header) }} {{ - $t("components.empty_state.affiliates_header") + $t(i18nMap.components.empty_state.affiliates_header) }} {{ - $t("components.empty_state.tasks_header") + $t(i18nMap.components.empty_state.tasks_header) }} {{ - $t("components.empty_state.discussions_header") + $t(i18nMap.components.empty_state.discussions_header) }}
{{ - $t("components.empty_state.message_no_permission") + $t(i18nMap.components.empty_state.message_no_permission) }}
{{ - $t("components.empty_state.message_with_permission") + $t(i18nMap.components.empty_state.message_with_permission) }}
diff --git a/frontend/components/btn/BtnShareIcon.vue b/frontend/components/btn/BtnShareIcon.vue index 26d58ab9..d53a473a 100644 --- a/frontend/components/btn/BtnShareIcon.vue +++ b/frontend/components/btn/BtnShareIcon.vue @@ -40,7 +40,7 @@ v-if="contentCopied" class="text-accepted-green hover:text-accepted-green dark:text-accepted-green dark:hover:text-accepted-green" :iconName="IconMap.SQUARE_CHECK" - :text="$t('components.btn_share_icon.url_copied')" + :text="$t(i18nMap.components.btn_share_icon.url_copied)" :iconSize="iconSize" />
@@ -59,6 +59,7 @@ import { ref, type Component } from "vue"; import { IconMap } from "~/types/icon-map"; import { toast } from "vue-sonner"; import { useI18n } from "vue-i18n"; +import { i18nMap } from "~/types/i18n-map"; const vueSocials: { [key: string]: Component } = { SEmail, diff --git a/frontend/components/card/CardConnect.vue b/frontend/components/card/CardConnect.vue index ab47958f..144eef77 100644 --- a/frontend/components/card/CardConnect.vue +++ b/frontend/components/card/CardConnect.vue @@ -3,7 +3,7 @@

- {{ $t("components._global.connect") }} + {{ $t(i18nMap.components._global.connect) }}

@@ -114,6 +121,7 @@ import { Popover, PopoverButton, PopoverPanel } from "@headlessui/vue"; import type { Group } from "~/types/communities/group"; import type { Organization } from "~/types/communities/organization"; import type { Event } from "~/types/events/event"; +import { i18nMap } from "~/types/i18n-map"; import { IconMap } from "~/types/icon-map"; const props = defineProps<{ diff --git a/frontend/components/card/CardDangerZone.vue b/frontend/components/card/CardDangerZone.vue index 0ac64cfe..890080ed 100644 --- a/frontend/components/card/CardDangerZone.vue +++ b/frontend/components/card/CardDangerZone.vue @@ -5,7 +5,7 @@ >

- {{ $t("components.card_danger_zone.header") }} + {{ $t(i18nMap.components.card_danger_zone.header) }}

{{ description }}

@@ -17,10 +17,10 @@ class="responsive-h4 font-bold text-primary-text" for="username" :placeholder=" - $t('components.card_danger_zone.username_placeholder') + $t(i18nMap.components.card_danger_zone.username_placeholder) " > - {{ $t("components.card_danger_zone.username_label") }} * + {{ $t(i18nMap.components.card_danger_zone.username_label) }} * - {{ $t("components.card_danger_zone.password_label") }} * + {{ $t(i18nMap.components.card_danger_zone.password_label) }} * diff --git a/frontend/components/card/change-account-info/CardChangeAccountInfoPassword.vue b/frontend/components/card/change-account-info/CardChangeAccountInfoPassword.vue index 07715c45..d3671894 100644 --- a/frontend/components/card/change-account-info/CardChangeAccountInfoPassword.vue +++ b/frontend/components/card/change-account-info/CardChangeAccountInfoPassword.vue @@ -1,15 +1,19 @@ + + diff --git a/frontend/components/card/change-account-info/CardChangeAccountInfoUsername.vue b/frontend/components/card/change-account-info/CardChangeAccountInfoUsername.vue index 5a03b2b4..b0fec342 100644 --- a/frontend/components/card/change-account-info/CardChangeAccountInfoUsername.vue +++ b/frontend/components/card/change-account-info/CardChangeAccountInfoUsername.vue @@ -1,22 +1,29 @@ + + diff --git a/frontend/components/card/discussion/CardDiscussionEntry.vue b/frontend/components/card/discussion/CardDiscussionEntry.vue index fc6348aa..a2e420b6 100644 --- a/frontend/components/card/discussion/CardDiscussionEntry.vue +++ b/frontend/components/card/discussion/CardDiscussionEntry.vue @@ -10,7 +10,7 @@

{{ discussionEntry.author }}

-

{{ $t("components.card_discussion_entry.on") }}

+

{{ $t(i18nMap.components.card_discussion_entry.on) }}

{{ discussionEntry.date.toLocaleDateString() }}

@@ -31,6 +31,7 @@ diff --git a/frontend/components/dropdown/DropdownCreate.vue b/frontend/components/dropdown/DropdownCreate.vue index 71e81814..8cf3abca 100644 --- a/frontend/components/dropdown/DropdownCreate.vue +++ b/frontend/components/dropdown/DropdownCreate.vue @@ -3,7 +3,7 @@ @@ -12,6 +12,7 @@ diff --git a/frontend/components/grid/GridGitHubShields.vue b/frontend/components/grid/GridGitHubShields.vue index 7b2d70e4..8909c3be 100644 --- a/frontend/components/grid/GridGitHubShields.vue +++ b/frontend/components/grid/GridGitHubShields.vue @@ -9,17 +9,17 @@
- {{ $t("components.grid_git_hub_shields.visit_us") }} + {{ $t(i18nMap.components.grid_git_hub_shields.visit_us) }}
- {{ $t("components._global.github") }} + {{ $t(i18nMap.components._global.github) }}
@@ -28,7 +28,7 @@ @@ -38,6 +38,7 @@ diff --git a/frontend/components/header/HeaderAppPage.vue b/frontend/components/header/HeaderAppPage.vue index 20633a96..a1685871 100644 --- a/frontend/components/header/HeaderAppPage.vue +++ b/frontend/components/header/HeaderAppPage.vue @@ -8,14 +8,14 @@

🚧

-

{{ $t("components.header_app_page.under_development") }}

+

{{ $t(i18nMap.components.header_app_page.under_development) }}

-

{{ $t("components._global.github") }}

+

{{ $t(i18nMap.components._global.github) }}

-

{{ $t("components._global.matrix") }}

+

{{ $t(i18nMap.components._global.matrix) }}

- {{ $t("components.header_app_page.status_pending") }} + {{ $t(i18nMap.components.header_app_page.status_pending) }}

{{ - $t("components._global.navigate_to_start") + $t(i18nMap.components._global.navigate_to_start) }} diff --git a/frontend/components/landing/LandingSplash.vue b/frontend/components/landing/LandingSplash.vue index cc5ef8bb..1304d18d 100644 --- a/frontend/components/landing/LandingSplash.vue +++ b/frontend/components/landing/LandingSplash.vue @@ -8,7 +8,7 @@ id="landing-splash-header" class="w-10/12 text-center font-display text-3xl font-bold leading-snug sm:text-4xl sm:leading-snug md:max-w-lg md:text-5xl md:leading-snug lg:font-bold xl:max-w-2xl xl:text-6xl xl:leading-snug" > - {{ $t("components.landing_splash.header") }} + {{ $t(i18nMap.components.landing_splash.header) }}

@@ -16,12 +16,12 @@ class="w-10/12 text-center text-base sm:text-xl md:w-3/4 md:text-lg xl:text-2xl" >
-

{{ $t("components.landing_splash.message_1") }}

-

{{ $t("components.landing_splash.message_2") }}

+

{{ $t(i18nMap.components.landing_splash.message_1) }}

+

{{ $t(i18nMap.components.landing_splash.message_2) }}

- {{ $t("components.landing_splash.message_1") }} {{ - $t("components.landing_splash.message_2") + {{ $t(i18nMap.components.landing_splash.message_1) }} {{ + $t(i18nMap.components.landing_splash.message_2) }}

@@ -61,6 +61,8 @@ diff --git a/frontend/components/logo/LogoActivist.vue b/frontend/components/logo/LogoActivist.vue index bb689e0e..eb057886 100644 --- a/frontend/components/logo/LogoActivist.vue +++ b/frontend/components/logo/LogoActivist.vue @@ -3,7 +3,7 @@ {{ - $t("components._global.navigate_to_start") + $t(i18nMap.components._global.navigate_to_start) }} diff --git a/frontend/components/tooltip/TooltipPasswordRequirements.vue b/frontend/components/tooltip/TooltipPasswordRequirements.vue index 85d249f4..57cd2e57 100644 --- a/frontend/components/tooltip/TooltipPasswordRequirements.vue +++ b/frontend/components/tooltip/TooltipPasswordRequirements.vue @@ -4,7 +4,9 @@ class="z-20 min-w-[200px] pb-4 pt-2 transition delay-150 ease-in-out md:min-w-[450px]" > {{ - $t("components.tooltip_password_requirements.password_rules_message") + $t( + i18nMap.components.tooltip_password_requirements.password_rules_message + ) }}
diff --git a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultEvent.vue b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultEvent.vue index cb3d1e0d..c95f5293 100644 --- a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultEvent.vue +++ b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultEvent.vue @@ -9,7 +9,7 @@ label="_global.support" leftIcon="IconSupport" fontSize="lg" - :ariaLabel="$t('_global.support_event_aria_label')" + :ariaLabel="$t(i18nMap._global.support_event_aria_label)" /> --> import type { Event } from "~/types/events/event"; +import { i18nMap } from "~/types/i18n-map"; import { IconMap } from "~/types/icon-map"; defineProps<{ diff --git a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultGroup.vue b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultGroup.vue index 12f97787..0b30ca0c 100644 --- a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultGroup.vue +++ b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultGroup.vue @@ -9,7 +9,7 @@ label="_global.support" leftIcon="IconSupport" fontSize="lg" - :ariaLabel="$t('_global.support_organization_aria_label')" + :ariaLabel="$t(i18nMap._global.support_organization_aria_label)" /> --> import type { Group } from "~/types/communities/group"; +import { i18nMap } from "~/types/i18n-map"; import { IconMap } from "~/types/icon-map"; defineProps<{ diff --git a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultOrganization.vue b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultOrganization.vue index fc9e39b6..9da86dcd 100644 --- a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultOrganization.vue +++ b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultOrganization.vue @@ -9,7 +9,7 @@ label="_global.support" leftIcon="IconSupport" fontSize="lg" - :ariaLabel="$t('_global.support_organization_aria_label')" + :ariaLabel="$t(i18nMap._global.support_organization_aria_label)" /> --> import type { Organization } from "~/types/communities/organization"; +import { i18nMap } from "~/types/i18n-map"; import { IconMap } from "~/types/icon-map"; defineProps<{ diff --git a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultResource.vue b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultResource.vue index 3b8ac789..b71af27d 100644 --- a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultResource.vue +++ b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultResource.vue @@ -9,7 +9,7 @@ label="components._global.star" :leftIcon="IconMap.STAR" fontSize="lg" - :ariaLabel="$t('components._global.star')" + :ariaLabel="$t(i18nMap.components._global.star)" /> --> import type { Resource } from "~/types/content/resource"; +import { i18nMap } from "~/types/i18n-map"; import { IconMap } from "~/types/icon-map"; defineProps<{ diff --git a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultUser.vue b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultUser.vue index 854c8e7b..7f0732f0 100644 --- a/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultUser.vue +++ b/frontend/components/tooltip/menu-search-result/TooltipMenuSearchResultUser.vue @@ -9,7 +9,7 @@ label="_global.support" leftIcon="IconSupport" fontSize="lg" - :ariaLabel="$t('components.tooltip_menu_search_result_user.support_user_aria_label')" + :ariaLabel="$t(i18nMap.components.tooltip_menu_search_result_user.support_user_aria_label)" /> --> import type { User } from "~/types/auth/user"; +import { i18nMap } from "~/types/i18n-map"; import { IconMap } from "~/types/icon-map"; defineProps<{ diff --git a/frontend/error.vue b/frontend/error.vue index 763de212..d236b246 100644 --- a/frontend/error.vue +++ b/frontend/error.vue @@ -3,7 +3,7 @@
- {{ $t("error.title") }} + {{ $t(i18nMap.error.title) }}
- {{ $t("error.message") }} + {{ $t(i18nMap.error.message) }}
diff --git a/frontend/pages/auth/reset-password.vue b/frontend/pages/auth/reset-password.vue index 0795a1e0..e0adafc9 100644 --- a/frontend/pages/auth/reset-password.vue +++ b/frontend/pages/auth/reset-password.vue @@ -2,30 +2,34 @@ diff --git a/frontend/pages/groups/create.vue b/frontend/pages/groups/create.vue index 4c19fb76..c02a74c1 100644 --- a/frontend/pages/groups/create.vue +++ b/frontend/pages/groups/create.vue @@ -11,10 +11,10 @@

- {{ $t("pages.groups.create.header") }} + {{ $t(i18nMap.pages.groups.create.header) }}

- {{ $t("pages.groups.create.subtext") }} + {{ $t(i18nMap.pages.groups.create.subtext) }}

{{ $t(i18nMap.pages.groups.create.group_name) }}*
{{ $t(i18nMap.pages._global.create.location) }}*
{{ $t(i18nMap.pages._global.create.description) }}*
{{ - $t("pages._global.terms_of_service_pt_2") + $t(i18nMap.pages._global.terms_of_service_pt_2) }}

.

@@ -111,6 +117,8 @@ diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue index a74c0e97..7ef7a85b 100644 --- a/frontend/pages/index.vue +++ b/frontend/pages/index.vue @@ -2,7 +2,7 @@ + + diff --git a/frontend/pages/organizations/[id]/about.vue b/frontend/pages/organizations/[id]/about.vue index 75a506f0..d10922e5 100644 --- a/frontend/pages/organizations/[id]/about.vue +++ b/frontend/pages/organizations/[id]/about.vue @@ -40,7 +40,7 @@ fontSize="sm" :rightIcon="IconMap.SHARE" iconSize="1.45em" - :ariaLabel="$t('_global.share_organization_aria_label')" + :ariaLabel="$t(i18nMap._global.share_organization_aria_label)" />
@@ -79,6 +79,7 @@ diff --git a/frontend/pages/resources/create.vue b/frontend/pages/resources/create.vue index ccf100fd..bb5259d1 100644 --- a/frontend/pages/resources/create.vue +++ b/frontend/pages/resources/create.vue @@ -11,10 +11,10 @@

- {{ $t("pages._global.create.information") }} + {{ $t(i18nMap.pages._global.create.information) }}

- {{ $t("pages.resources.create.subtext") }} + {{ $t(i18nMap.pages.resources.create.subtext) }}

{{ $t(i18nMap.pages.resources.create.title) }}*
{{ $t(i18nMap.pages._global.create.link) }}*
{{ $t(i18nMap.pages.resources.create.description) }}*
@@ -112,6 +116,8 @@