This repository has been archived by the owner on Dec 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Internationalization): adds support for internationalization (#497)
* feat(Translation): adds translation hook. applies translation on all hardcoded text Signed-off-by: Lucas Temponi <[email protected]> * feat(Translation): changeset Signed-off-by: Lucas Temponi <[email protected]> * feat(Translation): fix types Signed-off-by: Lucas Temponi <[email protected]> --------- Signed-off-by: Lucas Temponi <[email protected]> Co-authored-by: Lucas Temponi <[email protected]> Co-authored-by: Kurt King <[email protected]>
- Loading branch information
1 parent
21228b4
commit e44fb0c
Showing
21 changed files
with
396 additions
and
84 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@procore-oss/backstage-plugin-announcements-react': minor | ||
'@procore-oss/backstage-plugin-announcements': minor | ||
--- | ||
|
||
Adds internacionalization following Backstage's guidelines |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { useAnnouncements } from './useAnnouncements'; | ||
export { useCategories } from './useCategories'; | ||
export { useAnnouncementsTranslation } from './useAnnouncementsTranslation'; |
6 changes: 6 additions & 0 deletions
6
plugins/announcements-react/src/hooks/useAnnouncementsTranslation.ts
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,6 @@ | ||
import { useTranslationRef } from '@backstage/core-plugin-api/alpha'; | ||
import { translationRef } from '../translation'; | ||
|
||
export const useAnnouncementsTranslation = () => { | ||
return useTranslationRef(translationRef); | ||
}; |
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,150 @@ | ||
/* | ||
* Copyright 2024 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { createTranslationRef } from '@backstage/core-plugin-api/alpha'; | ||
|
||
/** @public */ | ||
export const translationRef = createTranslationRef({ | ||
id: 'announcements', | ||
messages: { | ||
announcementForm: { | ||
title: 'Title', | ||
excerpt: 'Excerpt', | ||
active: 'Active', | ||
submit: 'Submit', | ||
editAnnouncement: 'Edit announcement', | ||
newAnnouncement: 'New announcement', | ||
categoryInput: { | ||
create: 'Create', | ||
label: 'Category', | ||
}, | ||
}, | ||
announcementsPage: { | ||
newAnnouncement: 'New announcement', | ||
genericNew: 'New', | ||
card: { | ||
by: 'By', | ||
in: 'in', | ||
edit: 'EDIT', | ||
delete: 'DELETE', | ||
}, | ||
grid: { | ||
announcementDeleted: 'Announcement deleted.', | ||
}, | ||
contextMenu: { | ||
admin: 'Admin', | ||
categories: 'Categories', | ||
}, | ||
}, | ||
deleteDialog: { | ||
title: 'Are you sure you want to delete this announcement?', | ||
cancel: 'Cancel', | ||
delete: 'Delete', | ||
}, | ||
announcementsCard: { | ||
seeAll: 'See all', | ||
announcements: 'Announcements', | ||
new: 'New', | ||
in: 'in', | ||
noAnnouncements: 'No announcements yet, want to', | ||
addOne: 'add one', | ||
}, | ||
announcementSearchResultListItem: { | ||
published: 'Published', | ||
announcement: 'Announcement', | ||
}, | ||
announcementsTimeline: { | ||
noAnnouncements: 'No announcements', | ||
error: 'Error', | ||
}, | ||
categoriesForm: { | ||
newCategory: 'New category', | ||
editCategory: 'Edit category', | ||
titleLabel: 'Title', | ||
submit: 'Submit', | ||
}, | ||
categoriesTable: { | ||
categoryDeleted: 'Category deleted.', | ||
slug: 'Slug', | ||
title: 'Title', | ||
actions: 'Actions', | ||
addTooltip: 'Add', | ||
noCategoriesFound: 'No categories found.', | ||
}, | ||
categoriesPage: { | ||
title: 'Categories', | ||
subtitle: 'Manage announcement categories', | ||
}, | ||
createAnnouncementPage: { | ||
alertMessage: 'Announcement created.', | ||
alertMessageWithNewCategory: 'with new category', | ||
}, | ||
editAnnouncementPage: { | ||
updatedMessage: 'Announcement updated.', | ||
notFoundMessage: 'Unable to find announcement', | ||
edit: 'Edit', | ||
}, | ||
newAnnouncementBanner: { | ||
markAsSeen: 'Mark as seen', | ||
}, | ||
newCategoryDialog: { | ||
createdMessage: 'Category created.', | ||
newCategory: 'New category', | ||
title: 'Title', | ||
cancelButton: 'Cancel', | ||
createButton: 'Create', | ||
}, | ||
admin: { | ||
adminPortal: { | ||
announcementsLabels: 'Announcements', | ||
categoriesLabel: 'Categories', | ||
title: 'Admin Portal for Announcements', | ||
subtitle: 'Manage announcements and categories', | ||
}, | ||
announecementsContent: { | ||
alertMessage: 'Announcement created.', | ||
alertMessageWithNewCategory: 'with new category', | ||
cancelButton: 'Cancel', | ||
createButton: 'Create Announcement', | ||
announcements: 'Announcements', | ||
noAnnouncementsFound: 'No announcements found', | ||
table: { | ||
title: 'Title', | ||
body: 'Body', | ||
publisher: 'Publisher', | ||
category: 'Category', | ||
status: 'Status', | ||
actions: 'Actions', | ||
active: 'Active', | ||
inactive: 'Inactive', | ||
}, | ||
}, | ||
categoriesContent: { | ||
createdMessage: 'created', | ||
deletedMessage: 'Category deleted.', | ||
cancelButton: 'Cancel', | ||
createButton: 'Create category', | ||
table: { | ||
categoryDeleted: 'Category deleted.', | ||
slug: 'Slug', | ||
title: 'Title', | ||
actions: 'Actions', | ||
addTooltip: 'Add', | ||
noCategoriesFound: 'No categories found.', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); |
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
Oops, something went wrong.