Skip to content

Commit

Permalink
Merge pull request moodle#4 from lucaboesch/multilang_packages
Browse files Browse the repository at this point in the history
Localizations by Luca.
  • Loading branch information
srobotta authored Mar 8, 2024
2 parents 5086d22 + 29bfded commit c01243c
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 40 deletions.
29 changes: 27 additions & 2 deletions packages/react-app/src/locales/de/translation.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,36 @@ import type { Translations } from '../../webapp/types/i18n.mjs'
export const translations: Translations = {
add_content: 'Inhalte hinzufügen',
admin: 'Admin',
ambitious_seed: 'Ehrgeiziger Samen',
approve: 'Freigeben',
approved_badge: 'Freigabe erteilt, dein Inhalt ist jetzt für alle sichtbar.',
back_soon: 'Wir sind bald wieder da',
best_collection_ever: 'Beste Sammlung überhaupt',
bookmark: 'Lesezeichen',
bookmark_needs_login: 'Einloggen oder registieren um ein Lesezeichen zu setzen',
bookmark_remove: 'Lesezeichen entfernen',
bookmarks: 'Lesezeichen',
create_account: 'Neues Nutzendenkonto erstellen',
curated_collections: 'Kuratierte Sammlungen',
dont_show_again: 'Nicht mehr anzeigen',
dazzling_biome: 'Faszinierendes Biotop',
determined_sprout: 'Entschlossener Spross',
enter_your_account: 'Zum Nutzendenkonto',
file_too_big: 'Die Datei ist zu gross, reduziere die Grösse oder gib eine URL an',
firmly_grounded: 'Fest verwurzelt',
follow: 'Folgen',
follow_needs_login: 'Einloggen oder registieren zum Folgen',
follow_own_content: 'Du kannst nicht deinen eigenen Inhalten folgen',
follow_remove_user: 'Person nicht mehr folgen',
follow_user: 'Folge dieser Person',
followers: 'Folgende',
followers_cnt_sing: '{1} Person folgt',
followers_cnt_pl: '{1} Personen folgen',
following: 'Folgend',
goto_settings: 'Gehe zu den Einstellungen',
interest_description: 'Wähle deine Interessen aus, um das Beste aus MoodleNet herauszuholen.',
interest_title: 'Verbessere deine Erfahrung!',
image_too_big: 'Das Bild ist zu gross, reduziere die Grösse oder verwende ein anderes Bild',
join_now: 'Jetzt beitreten',
like: 'Gefällt mir',
like_needs_login: 'Einloggen oder registieren um zu liken',
Expand All @@ -32,27 +41,41 @@ export const translations: Translations = {
load_more: 'Mehr laden',
login: 'Einloggen',
logout: 'Ausloggen',
log_in_desc: 'Einloggen oder registieren um Inhalt zu veröffentlichen',
moodlenet_community: 'MoodleNet Community',
new_collection: 'Neue Sammlung',
new_resource: 'Neue Ressource',
override_subtitle: 'Dies ist das OER-Repository der Berner Fachhochschule.',
override_title: 'Die Lehre von morgen gestalten',
page_not_found_or_access_not_allowed: 'Seite nicht gefunden oder Zugriff nicht erlaubt',
photosynthesist: 'Photosynthesist',
please_provide_description: 'Bitte eine Beschreibung angeben',
please_provide_displayname: 'Bitte einen Anzeigenamen angeben',
please_provide_title: 'Bitte einen Titel angeben',
please_select_subject: 'Bitte ein Fachgebiet auswählen',
please_select_year: 'Bitte ein Jahr auswählen',
please_upload_content: 'Bitte einen Inhalt hochladen',
profile: 'Profil',
publish_content: 'Inhalte veröffentlichen',
resources: 'Ressourcen',
rooted_learner: 'Verwurzelter Lernender',
scheduled_maintenance:
'MoodleNet ist für eine geplante Wartung nicht verfügbar und wird in wenigen Minuten wieder online sein',
search_placeholder: 'Nach OER Inhalten suchen',
search_placeholder: 'Nach OER-Inhalten suchen',
seedling_scholar: 'Keimlingsschüler*in',
see_all_people_result: 'Zeige Resultate von allen Personen an',
see_more_authors: 'Mehr Autor*innen',
see_more_collections: 'Mehr Sammlungen ansehen',
see_more_resources: 'Weitere Ressourcen',
select_language: 'Sprache auswählen',
settings: 'Einstellungen',
select_license: 'Lizenz auswählen',
share_content: 'Inhalte teilen',
sky_reacher: 'Himmelstürmer*in',
sort_by: 'Sortieren nach',
signup: 'Registrieren',
start_publishing: 'Einloggen oder registieren um neue Inhalte zu veröffentlichen.',
steadily_grower: 'Stetig wachsende*r',
subtitle_create_collection: 'Sammlungen sind gruppierte Materialien',
subtitle_create_resource:
'Eine Ressource ist ein einzelnes Element z.B. Bild, Foliensatz, Dokument',
Expand All @@ -72,11 +95,13 @@ export const translations: Translations = {
user_menu: 'Nutzendenmenü',
user_subtitle_featured_authors: 'Top Autor*innen, die dich ansprechen könnten',
user_subtitle_featured_collections:
'Sammlungen von hoher Qualität die Dich interessieren könnten',
'Sammlungen von hoher Qualität die dich interessieren könnten',
user_subtitle_featured_resources: 'Ausgewählte Inhalte nach deinen Interessen',
user_title_featured_authors: 'Ausgewählte Autor*innen',
user_title_featured_collections: 'Ausgewählte Sammlungen',
user_title_featured_resources: 'Ausgewählte Ressourcen',
versatile_canopy: 'Vielseitiges Blätterdach',
visibility_required: 'Sichtbarkeit ist erforderlich',
we_love_to_get: 'Wir freuen uns über',
what_do_you_want_to_publish: 'Was möchtest du gerne veröffentlichen?',
you_can_suggest: 'Du kannst neue Funktionen vorschlagen und Fehler melden in der',
Expand Down
26 changes: 26 additions & 0 deletions packages/react-app/src/locales/en/translation.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,36 @@ import type { Translations } from '../../webapp/types/i18n.mjs'
export const translations: Translations = {
add_content: 'Add content',
admin: 'Admin',
ambitious_seed: 'Ambitious seed',
approve: 'Approve',
approve_badge: 'Approved, your published content is visible to all',
back_soon: "We'll be back soon",
best_collection_ever: 'Best collection ever',
bookmark: 'Bookmark',
bookmark_needs_login: 'Login or signup to bookmark',
bookmark_remove: 'Remove bookmark',
bookmarks: 'Bookmarks',
create_account: 'Create a new account',
curated_collections: 'Curated collections',
dont_show_again: 'Do not show again',
dazzling_biome: 'Dazzling biome',
determined_sprout: 'Determined sprout',
enter_your_account: 'Enter to your account',
file_too_big: 'The file is too big, reduce the size or provide a url',
firmly_grounded: 'Firmly grounded',
follow: 'Follow',
follow_needs_login: 'Login or signup to follow',
follow_own_content: 'Creators cannot follow their own content',
follow_remove_user: 'Unfollow user',
follow_user: 'Follow user',
followers: 'Followers',
followers_cnt_sing: '{1} follower',
followers_cnt_pl: '{1} followers',
following: 'Following',
goto_settings: 'Go to settings',
interest_description: 'Select your interests to get the most out of MoodleNet',
interest_title: 'Enhance your experience!',
image_too_big: 'The image is too big, reduce the size or use another image',
join_now: 'Join now',
like: 'Like',
like_needs_login: 'Login or signup to like',
Expand All @@ -32,27 +41,41 @@ export const translations: Translations = {
load_more: 'Load more',
login: 'Log in',
logout: 'Log out',
log_in_desc: 'Log in or create an account to start publishing content',
moodlenet_community: 'MoodleNet Community',
new_collection: 'New collection',
new_resource: 'New resource',
override_subtitle: 'This is the OER Repository of the Bern University of Applied Sciences.',
override_title: 'Shaping the teaching of tomorrow',
page_not_found_or_access_not_allowed: 'Page not found or access not allowed',
photosynthesist: 'Photosynthesist',
please_provide_description: 'Please provide a description',
please_provide_displayname: 'Please provide a display name',
please_provide_title: 'Please provide a title',
please_select_subject: 'Please select a subject',
please_select_year: 'Please select a year',
please_upload_content: 'Please upload a content',
profile: 'Profile',
publish_content: 'Publish content',
resources: 'Resources',
rooted_learner: 'Rooted learner',
scheduled_maintenance:
'MoodleNet is down for a scheduled maintenance and expect to be online in a few minutes',
search_placeholder: 'Search for open educational content',
see_all_people_result: 'See all people results',
see_more_authors: 'See more authors',
see_more_collections: 'See more collections',
see_more_resources: 'See more resources',
seedling_scholar: 'Seedling scholar',
select_language: 'Select language',
settings: 'Settings',
select_license: 'Select a license',
share_content: 'Share content',
signup: 'Sign up',
sky_reacher: 'Sky reacher',
sort_by: 'Sort by',
start_publishing: 'Log in or create an account to start publishing content',
steadily_grower: 'Steadily grower',
subtitle_create_collection: 'Collections are groups of resources',
subtitle_create_resource: 'A resource is a single item of content',
subtitle_featured_authors: 'Authors with outstanding contributions',
Expand All @@ -76,6 +99,9 @@ export const translations: Translations = {
user_title_featured_resources: 'Resources selection',
we_love_to_get: "We'd love to get",
what_do_you_want_to_publish: 'What would you like to publish?',
versatile_canopy: 'Versatile canopy',
visibility_required: 'Visibility is required',
we_love_to_get: 'We\'d love to get',
you_can_suggest: 'You can suggest new features and report bugs in the',
your_feedback: 'your feedback on MoodleNet',
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ReactComponent as LeafIcon } from '../../../assets/icons/leaf.svg'
import { ReactComponent as PersonIcon } from '../../../assets/icons/profile.svg'
import type { OverallCardProps } from './OverallCard.js'
import { OverallCard } from './OverallCard.js'
import { t } from '@moodlenet/react-app/webapp'

const meta: ComponentMeta<typeof OverallCard> = {
title: 'Molecules/OverallCard',
Expand Down Expand Up @@ -37,14 +38,14 @@ export const OverallCardStoryProps: OverallCardProps = {
Icon: PersonIcon,
className: 'followers',
href: href('Pages/Followers'),
name: 'Followers',
name: {t('followers')},
value: 25,
},
{
Icon: PersonIcon,
className: 'following',
href: href('Pages/Following'),
name: 'Following',
name: {t('following')},
value: 97,
},
{ Icon: FilterNone, className: 'resources', name: 'Resources', value: 23 },
Expand All @@ -57,7 +58,7 @@ export const OverallCardNoCardStoryProps: OverallCardProps = {
Icon: PersonIcon,
className: 'followers',
href: href('Pages/Followers'),
name: 'Followers',
name: {t('followers')},
value: 25,
},
{ Icon: LeafIcon, name: 'Leaves', className: 'leaves', value: 43212 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type { CollectionFormProps } from '@moodlenet/collection/common'
import type { MainCollectionCardProps } from '@moodlenet/collection/ui'
import { Collection, MainCollectionCard } from '@moodlenet/collection/ui'
import { useCollectionForm } from '../../../components/pages/Collection/CollectionProps.stories.js'
import { t } from '@moodlenet/react-app/webapp'
const maxUploadSize = 1024 * 1024 * 50

const meta: ComponentMeta<typeof Collection> = {
Expand Down Expand Up @@ -46,19 +47,19 @@ const meta: ComponentMeta<typeof Collection> = {
}

export const validationSchema: SchemaOf<CollectionFormProps> = object({
category: string().required(/* t */ `Please select a subject`),
content: string().required(/* t */ `Please upload a content`),
category: string().required(/* t */ {t('please_select_subject')}),
content: string().required(/* t */ {t('please_upload_content')}),
license: string().when('isFile', (isFile, schema) => {
return isFile ? schema.required(/* t */ `Select a license`) : schema.optional()
return isFile ? schema.required(/* t */ {t('select_license')}) : schema.optional()
}),
isFile: boolean().required(),
description: string().max(4096).min(3).required(/* t */ `Please provide a description`),
title: string().max(160).min(3).required(/* t */ `Please provide a title`),
description: string().max(4096).min(3).required(/* t */ {t('please_provide_description')}),
title: string().max(160).min(3).required(/* t */ {t('please_provide_title')}),
image: mixed()
.test((v, { createError }) =>
v instanceof Blob && v.size > maxUploadSize
? createError({
message: /* t */ `The file is too big, reduce the size or provide a url`,
message: /* t */ {t('file_too_big')},
})
: true,
)
Expand All @@ -67,9 +68,9 @@ export const validationSchema: SchemaOf<CollectionFormProps> = object({
level: string().optional(),
month: string().optional(),
type: string().optional(),
visibility: mixed().required(/* t */ `Visibility is required`),
visibility: mixed().required(/* t */ {t('visibility_required')}),
year: string().when('month', (month, schema) => {
return month ? schema.required(/* t */ `Please select a year`) : schema.optional()
return month ? schema.required(/* t */ {t('please_select_year')}) : schema.optional()
}),
})
export const collectionFormValues: CollectionFormProps = {
Expand Down Expand Up @@ -112,7 +113,7 @@ export const useMainCollectionCardStoryProps = (overrides?: {
// content: null,
// isFile: true,
// visibility: 'Public',
title: 'Best collection ever',
title: {t('best_collection_ever')},
description:
'This is the description that tells you that this is not only the best content ever, but also the most dynamic and enjoyable you will never ever find. Trust us. This is the description that tells you that this is not only the best content ever, but also the most dynamic and enjoyable you will never ever find. Trust us.This is the description that tells you that this is not only the best content ever, but also the most dynamic and enjoyable you will never ever find. Trust us.This is the description that tells you that this is not only the best content ever, but also the most dynamic and enjoyable you will never ever find. Trust us.This is the description that tells you that this is not only the best content ever, but also the most dynamic and enjoyable you will never ever find. Trust us.',
// 'This is the description that tells you that this is not only the best content ever, but also the most dynamic and enjoyable you will never ever find. Trust us.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useFormik } from 'formik'
import type { PartialDeep } from 'type-fest'
import type { SchemaOf } from 'yup'
import { mixed, object, string } from 'yup'
import { t } from '@moodlenet/react-app/webapp'
// import { people } from '../../../../../helpers/factories'
// import { fileExceedsMaxUploadSize, people, randomIntFromInterval } from '@moodlenet/component-library/ui.mjs'

Expand All @@ -19,7 +20,7 @@ export const profileStoriesValidationSchema: SchemaOf<ProfileFormValues> = objec
.test((v, { createError }) =>
v instanceof Blob && fileExceedsMaxUploadSize(v.size, maxUploadSize)
? createError({
message: /* t */ `The image is too big, reduce the size or use another image`,
message: /* t */ {t('image_too_big')},
})
: true,
)
Expand All @@ -28,12 +29,12 @@ export const profileStoriesValidationSchema: SchemaOf<ProfileFormValues> = objec
.test((v, { createError }) =>
v instanceof Blob && fileExceedsMaxUploadSize(v.size, maxUploadSize)
? createError({
message: /* t */ `The image is too big, reduce the size or use another image`,
message: /* t */ {t('image_too_big')},
})
: true,
)
.optional(),
displayName: string().max(160).min(3).required(/* t */ `Please provide a display name`),
displayName: string().max(160).min(3).required(/* t */ {t('please_provide_displayname')}),
location: string()
.transform(value => value || null)
.nullable(),
Expand All @@ -46,7 +47,7 @@ export const profileStoriesValidationSchema: SchemaOf<ProfileFormValues> = objec
.url()
.transform(value => value || null)
.nullable(),
aboutMe: string().max(4096).min(3).required(/* t */ `Please provide a description`),
aboutMe: string().max(4096).min(3).required(/* t */ {t('please_provide_description')}),
})

export default function useMainProfileCardStoryProps(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { BookmarkButtonProps, SmallFollowButtonProps } from '@moodlenet/web
import { FilterNone, PermIdentity } from '@mui/icons-material'
import type { Meta as ComponentMeta, StoryFn as ComponentStory } from '@storybook/react'
import type { PartialDeep } from 'type-fest'
import { t } from '@moodlenet/react-app/webapp'

const meta: ComponentMeta<typeof SubjectCard> = {
title: 'Molecules/SubjectCard',
Expand Down Expand Up @@ -42,13 +43,13 @@ export const getSubjectCardStoryProps = (
{
Icon: <PermIdentity />,
key: 'followers',
name: 'Followers',
name: {t('followers')},
value: Math.floor(Math.random() * Math.random() * 1000),
},
{
Icon: <FilterNone />,
key: 'resources',
name: 'Resources',
name: {t('resources')},
value: Math.floor(Math.random() * Math.random() * 1000),
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
MainLayoutLoggedInStoryProps,
MainLayoutLoggedOutStoryProps,
} from '../../layout/MainLayout/MainLayout.stories.js'
import { t } from '@moodlenet/react-app/webapp'

const meta: ComponentMeta<typeof Subject> = {
title: 'Pages/Subject',
Expand Down Expand Up @@ -84,7 +85,7 @@ export const useSubjectStoryProps = (

const overallItems: SubjectOverallProps[] = [
{
name: 'Followers',
name: {t('followers')},
value: 13,
key: 'followers',
},
Expand All @@ -94,14 +95,14 @@ export const useSubjectStoryProps = (
// key: 'collections',
// },
{
name: 'Resources',
name: {t('resources')},
value: 92,
key: 'resources',
},
]

const resourceList: SimpleResourceListProps = {
title: 'Resources',
title: {t('resources')},
resourceCardPropsList: getResourceCardsStoryProps(6, {
access: {},
orientation: 'horizontal',
Expand Down
Loading

0 comments on commit c01243c

Please sign in to comment.