summaryrefslogtreecommitdiff
path: root/src/i18n/translations
diff options
context:
space:
mode:
authorJoe Carstairs <65492573+Sycamost@users.noreply.github.com>2023-08-13 19:03:03 +0100
committerJoe Carstairs <65492573+Sycamost@users.noreply.github.com>2023-08-13 19:10:06 +0100
commit8c1fff45fb5340a338416586162ac247b2b190c0 (patch)
tree849ae072e8efc8652d3045ae4ab3db30798f1a9b /src/i18n/translations
parent1118c377e32940ada179bfcde1549b73d8948626 (diff)
Uses TSConfig paths
Diffstat (limited to 'src/i18n/translations')
-rw-r--r--src/i18n/translations/components/breadcrumbs.ts22
-rw-r--r--src/i18n/translations/components/languageLinks.ts2
-rw-r--r--src/i18n/translations/pages/furthsettins.ts2
-rw-r--r--src/i18n/translations/pages/home.ts2
-rw-r--r--src/i18n/translations/pages/lallansIssuePaymentSuccessConfirmation.ts2
-rw-r--r--src/i18n/translations/site.ts133
6 files changed, 156 insertions, 7 deletions
diff --git a/src/i18n/translations/components/breadcrumbs.ts b/src/i18n/translations/components/breadcrumbs.ts
index a0af6f9..3db3f2f 100644
--- a/src/i18n/translations/components/breadcrumbs.ts
+++ b/src/i18n/translations/components/breadcrumbs.ts
@@ -1,4 +1,6 @@
-import type { TranslationsDictionary } from '../../../types/TranslationsDictionary';
+import { getLallansIssue } from '$data/lallans';
+import { getScotsoun } from '$data/scotsoun';
+import type { TranslationsDictionary } from '$types/TranslationsDictionary';
// This maun be kept up til date bi haund. There is
// nae compile-time check that aw routes hae been
@@ -16,6 +18,24 @@ const breadcrumbsTranslations = {
sco: () => 'Lallans',
'en-GB': () => 'Lallans',
},
+ ...Object.fromEntries(
+ Object.keys(getLallansIssue).map((lallansIssueNumber) => [
+ `/furthsettins/lallans/${lallansIssueNumber}/`,
+ {
+ sco: () => `Lallans ${lallansIssueNumber}`,
+ 'en-GB': () => `Lallans ${lallansIssueNumber}`,
+ },
+ ])
+ ),
+ ...Object.fromEntries(
+ Object.keys(getScotsoun).map((scotsounId) => [
+ `/furthsettins/scotsoun/${scotsounId}/`,
+ {
+ sco: () => `Scotsoun ${scotsounId}`,
+ 'en-GB': () => `Scotsoun ${scotsounId}`,
+ },
+ ])
+ ),
};
type Raw = typeof breadcrumbsTranslations;
diff --git a/src/i18n/translations/components/languageLinks.ts b/src/i18n/translations/components/languageLinks.ts
index d3db24a..2a18448 100644
--- a/src/i18n/translations/components/languageLinks.ts
+++ b/src/i18n/translations/components/languageLinks.ts
@@ -1,4 +1,4 @@
-import type { TranslationsDictionary } from '../../../types/TranslationsDictionary';
+import type { TranslationsDictionary } from '$types/TranslationsDictionary';
const languageLinksTranslations = {
'language-link-text': {
diff --git a/src/i18n/translations/pages/furthsettins.ts b/src/i18n/translations/pages/furthsettins.ts
index 4b87311..4e5fc81 100644
--- a/src/i18n/translations/pages/furthsettins.ts
+++ b/src/i18n/translations/pages/furthsettins.ts
@@ -1,4 +1,4 @@
-import type { TranslationsDictionary } from '../../../types/TranslationsDictionary';
+import type { TranslationsDictionary } from '$types/TranslationsDictionary';
const furthsettinsTranslations = {
title: {
diff --git a/src/i18n/translations/pages/home.ts b/src/i18n/translations/pages/home.ts
index dda30b8..70765d2 100644
--- a/src/i18n/translations/pages/home.ts
+++ b/src/i18n/translations/pages/home.ts
@@ -1,4 +1,4 @@
-import type { TranslationsDictionary } from '../../../types/TranslationsDictionary';
+import type { TranslationsDictionary } from '$types/TranslationsDictionary';
const homeTranslations = {
title: {
diff --git a/src/i18n/translations/pages/lallansIssuePaymentSuccessConfirmation.ts b/src/i18n/translations/pages/lallansIssuePaymentSuccessConfirmation.ts
index c47ce0f..9520366 100644
--- a/src/i18n/translations/pages/lallansIssuePaymentSuccessConfirmation.ts
+++ b/src/i18n/translations/pages/lallansIssuePaymentSuccessConfirmation.ts
@@ -1,4 +1,4 @@
-import type { TranslationsDictionary } from '../../../types/TranslationsDictionary';
+import type { TranslationsDictionary } from '$types/TranslationsDictionary';
const lallansIssuePaymentSuccessConfirmation = {
title: {
diff --git a/src/i18n/translations/site.ts b/src/i18n/translations/site.ts
index 25598f1..6c16f8f 100644
--- a/src/i18n/translations/site.ts
+++ b/src/i18n/translations/site.ts
@@ -1,5 +1,8 @@
-import type Locale from '../../types/Locale';
-import type { TranslationsDictionary } from '../../types/TranslationsDictionary';
+import type Date from '$types/Date';
+import type Month from '$types/Month';
+import type Locale from '$types/Locale';
+import type { TranslationsDictionary } from '$types/TranslationsDictionary';
+import locales from '../locales';
const siteTranslations = {
title: {
@@ -14,6 +17,10 @@ const siteTranslations = {
sco: () => 'Lallans',
'en-GB': () => 'Lallans',
},
+ scotsoun: {
+ sco: () => 'Scotsoun',
+ 'en-GB': () => 'Scotsoun',
+ },
'scots-leid-associe': {
sco: () => 'Scots Leid Associe',
'en-GB': () => 'Scots Language Society',
@@ -40,6 +47,128 @@ const siteTranslations = {
}
},
},
+ 'long-date': Object.fromEntries(
+ locales.map((locale) => {
+ return [
+ locale,
+ ({ date }: { date: Date }) => `
+ ${siteTranslations['ordinal'][locale]({ n: date.slice(8) })}
+ ${siteTranslations['month'][locale]({ month: date.slice(5, 7) as Month })}
+ ${date.slice(0, 4)}
+ `,
+ ];
+ })
+ ),
+ ordinal: {
+ sco: ({ n }: { n: string }) => {
+ const m = n.replace(/^0+/, '');
+ switch (m.at(-1)) {
+ case '1':
+ // Exception for numbers ending in eleven
+ if (m.length > 1 && m.at(-2) === '1') {
+ return `${m}t`;
+ }
+ return `${m}st`;
+ case '2':
+ // Exception for numbers ending in twelve
+ if (m.length > 1 && m.at(-2) === '1') {
+ return `${m}t`;
+ }
+ return `${m}nt`;
+ case '3':
+ // Exception for numbers ending in thirteen
+ if (m.length > 1 && m.at(-2) === '1') {
+ return `${m}t`;
+ }
+ return `${m}rd`;
+ default:
+ return `${m}t`;
+ }
+ },
+ 'en-GB': ({ n }: { n: string }) => {
+ const m = n.replace(/^0+/, '');
+ switch (m.at(-1)) {
+ case '1':
+ // Exception for numbers ending in eleven
+ if (m.length > 1 && m.at(-2) === '1') {
+ return `${m}th`;
+ }
+ return `${m}st`;
+ case '2':
+ // Exception for numbers ending in twelve
+ if (m.length > 1 && m.at(-2) === '1') {
+ return `${m}th`;
+ }
+ return `${m}nd`;
+ case '3':
+ // Exception for numbers ending in thirteen
+ if (m.length > 1 && m.at(-2) === '1') {
+ return `${m}th`;
+ }
+ return `${m}rd`;
+ default:
+ return `${m}th`;
+ }
+ },
+ },
+ month: {
+ sco: ({ month }: { month: Month }) => {
+ switch (month) {
+ case '01':
+ return 'Januar';
+ case '02':
+ return 'Februar';
+ case '03':
+ return 'Mairch';
+ case '04':
+ return 'April';
+ case '05':
+ return 'Mey';
+ case '06':
+ return 'June';
+ case '07':
+ return 'July';
+ case '08':
+ return 'August';
+ case '09':
+ return 'Septemmer';
+ case '10':
+ return 'October';
+ case '11':
+ return 'Novemmer';
+ case '12':
+ return 'Decemmer';
+ }
+ },
+ 'en-GB': ({ month }: { month: Month }) => {
+ switch (month) {
+ case '01':
+ return 'January';
+ case '02':
+ return 'February';
+ case '03':
+ return 'March';
+ case '04':
+ return 'April';
+ case '05':
+ return 'May';
+ case '06':
+ return 'June';
+ case '07':
+ return 'July';
+ case '08':
+ return 'August';
+ case '09':
+ return 'September';
+ case '10':
+ return 'October';
+ case '11':
+ return 'November';
+ case '12':
+ return 'December';
+ }
+ },
+ },
};
type Raw = typeof siteTranslations;