Skip to content

Commit

Permalink
Merge pull request #190 from Maycol-Espinoza-Ponce/internationalization
Browse files Browse the repository at this point in the history
Internationalization
  • Loading branch information
r-southworth authored Oct 26, 2023
2 parents b152114 + cb8ee8b commit a30d255
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/components/common/ThemeIcon.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { Icon } from 'astro-icon/components';
import { SITE } from '../../config';
import { getLangFromUrl, useTranslations } from '../../i18n/utils';
const lang = getLangFromUrl(Astro.url);
const t = useTranslations(lang);
export interface Props {
label?: string;
class?: string;
Expand All @@ -12,7 +17,7 @@ export interface Props {
}
const {
label = 'Toggle between Dark and Light mode',
label = {t(‘ariaLabels.darkMessage’)},
class:
className = 'text-ptext1 dark:text-ptext1-DM hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-2.5 inline-flex items-center',
iconClass = 'w-6 h-6',
Expand Down
6 changes: 5 additions & 1 deletion src/components/posts/SocialModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { createSignal, Show, createEffect, onCleanup } from 'solid-js';
import type { Component, JSX } from 'solid-js';
import { SocialMediaShares } from './SocialMediaShares';
import { getLangFromUrl, useTranslations } from '../../i18n/utils';

const lang = getLangFromUrl(new URL(window.location.href));
const t = useTranslations(lang);

interface Post {
id: number;
Expand Down Expand Up @@ -58,7 +62,7 @@ const SocialModal: Component<Post> = function(props) {
<SocialMediaShares id={ props.id } title={ props.title } image_urls={ props.image_urls }/>

<button
aria-aria-label='Close Dialog'
aria-label={t(‘ariaLabels.closeDialog’)}
class="modal-close w-8 h-8 flex justify-center items-start text-icon2 dark:text-icon2-DM"
onClick={ closeModal }
>
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/UI/English.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ export const English = {
checkboxMajorMunicipality: "Checkbox for selecting major municipality",
checkboxMinorMunicipality: "Checkbox for selecting minor municipality",
checkboxGoverningDistrict: "Checkbox for selecting governing district",
darkMessage: "Toggle between Dark and Light mode",
closeDialog: "Close Dialog",
},

headerData: {
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/UI/French.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ export const French = {
checkboxMajorMunicipality: "Case à cocher pour sélectionner la grande municipalité",
checkboxMinorMunicipality: "Case à cocher pour sélectionner une commune mineure",
checkboxGoverningDistrict: "Case à cocher pour sélectionner le district administratif",
darkMessage: "Basculer entre le mode clair et le mode sombre",
closeDialog: "Fermer la boîte de dialogue",
},

headerData: {
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/UI/Spanish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ export const Spanish = {
checkboxMajorMunicipality: "Casilla de verificación para seleccionar Provincia",
checkboxMinorMunicipality: "Casilla de verificación para seleccionar Cantón",
checkboxGoverningDistrict: "Casilla de verificación para seleccionar Distrito",
darkMessage: "Cambia entre modo claro y modo oscuro",
closeDialog: "Cerrar Dialogo",
},

headerData: {
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/uiType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ export interface uiObject {
checkboxMajorMunicipality: string,
checkboxMinorMunicipality: string,
checkboxGoverningDistrict: string,
darkMessage: string,
closeDialog: string,
},

headerData: {
Expand Down

0 comments on commit a30d255

Please sign in to comment.