Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(website) refactor: Footer Migration #568

Merged
merged 11 commits into from
Sep 20, 2023
Merged
252 changes: 252 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions shared/src/types/admin/Language.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// TODO: use https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes and custom codes for languages that are not in that list, e.g. Krio

const LANGUAGES = ['en', 'de', 'it', 'fr', 'kri'] as const;
export type Language = (typeof LANGUAGES)[number];
const LANGUAGE_CODES = ['en', 'de', 'it', 'fr', 'kri'] as const;
export type LanguageCode = (typeof LANGUAGE_CODES)[number];
4 changes: 2 additions & 2 deletions shared/src/types/admin/User.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EntityReference } from 'firecms';
import { capitalizeStringIfUppercase } from '../../utils/strings';
import { Language } from './Language';
import { LanguageCode } from './Language';

export const USER_FIRESTORE_PATH = 'users';

Expand Down Expand Up @@ -42,7 +42,7 @@ export type User = {
stripe_customer_id?: string;
test_user?: boolean; // TODO: discuss if still needed
institution?: boolean;
language?: Language;
language?: LanguageCode;
location?: string; // TODO: discuss if still needed
currency?: string | null; // TODO: proper typing
contributor_organisations?: EntityReference[];
Expand Down
8 changes: 4 additions & 4 deletions shared/src/utils/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import i18next, { i18n } from 'i18next';
import resourcesToBackend from 'i18next-resources-to-backend';
import { Language } from '../types';
import { LanguageCode } from '../types';

export const FALLBACK_LANGUAGE = 'en';

Expand All @@ -11,18 +11,18 @@ interface TranslateProps {
}

interface TranslatorProps {
language: Language;
language: LanguageCode;
namespaces: string[] | string;
}

export type TranslateFunction = (key: string, translateProps?: TranslateProps) => string;

export class Translator {
language: Language;
language: LanguageCode;
namespaces: string[] | string;
instance: i18n;

constructor(language: Language, namespaces: string[] | string) {
constructor(language: LanguageCode, namespaces: string[] | string) {
this.language = language;
this.namespaces = namespaces;
this.instance = i18next.createInstance();
Expand Down
4 changes: 2 additions & 2 deletions shared/src/utils/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import i18next from 'i18next';
import resourcesToBackend from 'i18next-resources-to-backend';
import mjml2html from 'mjml';
import path from 'path';
import { Language } from '../types';
import { LanguageCode } from '../types';
import { FALLBACK_LANGUAGE } from './i18n';

export interface RenderTemplateProps {
language?: Language;
language?: LanguageCode;
translationNamespace?: string | string[];
hbsTemplatePath: string; // path starting from /shared/templates/{hbsTemplatePath}
context: object;
Expand Down
1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"class-variance-authority": "^0.7.0",
"classnames": "^2.3.2",
"clsx": "^1.2.1",
"cmdk": "^0.2.0",
"lucide-react": "^0.276.0",
"react-hook-form": "^7.46.1",
"tailwindcss-animate": "^1.0.7",
Expand Down
Loading
Loading