forked from openedx/frontend-base
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: merge internal and federated messages into i18n
This commit adds code to merge in module i18n messages into the messages object in the runtime. This means that when new modules, their localized messages will be available.
- Loading branch information
Showing
22 changed files
with
193 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,7 +93,7 @@ export { | |
IntlProvider, | ||
createIntl, | ||
defineMessages, | ||
useIntl | ||
useIntl, | ||
} from 'react-intl'; | ||
|
||
export { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Link } from 'react-router-dom'; | ||
import { useIntl } from '../../../runtime'; | ||
import { getAppUrl } from '../../../runtime/routing'; | ||
import messages from './messages'; | ||
|
||
export default function HomePage() { | ||
const moduleOneUrl = getAppUrl('moduleOne'); | ||
const dashboardUrl = getAppUrl('learnerDashboard'); | ||
const intl = useIntl(); | ||
|
||
return ( | ||
<div className="p-3"> | ||
<p>{intl.formatMessage(messages.homeContent)}</p> | ||
<ul> | ||
{moduleOneUrl !== null && ( | ||
<li><Link to={moduleOneUrl}>Go to module one page</Link></li> | ||
)} | ||
{dashboardUrl !== null && ( | ||
<li><Link to={dashboardUrl}>Go to dashboard page</Link></li> | ||
)} | ||
</ul> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Placeholder be overridden by `make pull_translations` | ||
export default { | ||
ar: {}, | ||
'zh-hk': {}, | ||
'zh-cn': {}, | ||
uk: {}, | ||
'tr-tr': {}, | ||
th: {}, | ||
te: {}, | ||
ru: {}, | ||
'pt-pt': {}, | ||
'pt-br': {}, | ||
'it-it': {}, | ||
id: {}, | ||
hi: {}, | ||
he: {}, | ||
'fr-ca': { | ||
'home.content': 'Home content in French.' | ||
}, | ||
fa: {}, | ||
'es-es': {}, | ||
'es-419': {}, | ||
el: {}, | ||
'de-de': {}, | ||
da: {}, | ||
bo: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import HomePage from './HomePage'; | ||
import messages from './i18n'; | ||
|
||
const config = { | ||
route: { | ||
path: '/', | ||
Component: HomePage, | ||
}, | ||
messages, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { defineMessages } from '../../../runtime'; | ||
|
||
const messages = defineMessages({ | ||
homeContent: { | ||
id: 'home.content', | ||
defaultMessage: 'Home page content.', | ||
description: 'Content for the dev project home page.', | ||
}, | ||
}); | ||
|
||
export default messages; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Placeholder be overridden by `make pull_translations` | ||
export default { | ||
ar: {}, | ||
'zh-hk': {}, | ||
'zh-cn': {}, | ||
uk: {}, | ||
'tr-tr': {}, | ||
th: {}, | ||
te: {}, | ||
ru: {}, | ||
'pt-pt': {}, | ||
'pt-br': {}, | ||
'it-it': {}, | ||
id: {}, | ||
hi: {}, | ||
he: {}, | ||
'fr-ca': {}, | ||
fa: {}, | ||
'es-es': {}, | ||
'es-419': {}, | ||
el: {}, | ||
'de-de': {}, | ||
da: {}, | ||
bo: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import DashboardPage from './DashboardPage'; | ||
|
||
const config = { | ||
route: { | ||
path: 'dashboard', | ||
Component: DashboardPage, | ||
} | ||
}; | ||
|
||
export default config; |
4 changes: 2 additions & 2 deletions
4
shell/dev-project/ChildOnePage.tsx → .../dev-project/module-one/ModuleOnePage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Placeholder be overridden by `make pull_translations` | ||
export default { | ||
ar: {}, | ||
'zh-hk': {}, | ||
'zh-cn': {}, | ||
uk: {}, | ||
'tr-tr': {}, | ||
th: {}, | ||
te: {}, | ||
ru: {}, | ||
'pt-pt': {}, | ||
'pt-br': {}, | ||
'it-it': {}, | ||
id: {}, | ||
hi: {}, | ||
he: {}, | ||
'fr-ca': {}, | ||
fa: {}, | ||
'es-es': {}, | ||
'es-419': {}, | ||
el: {}, | ||
'de-de': {}, | ||
da: {}, | ||
bo: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { primaryLinks } from '../../header/defaults'; | ||
import ModuleOnePage from './ModuleOnePage'; | ||
|
||
const config = { | ||
header: { | ||
primaryLinks: [ | ||
{ | ||
label: 'Child Link', | ||
url: '#' | ||
}, | ||
...primaryLinks, | ||
], | ||
secondaryLinks: [ | ||
{ | ||
label: 'Child Help', | ||
appId: 'support', | ||
} | ||
], | ||
}, | ||
route: { | ||
path: 'module-one', | ||
Component: ModuleOnePage, | ||
} | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters