fix(netlify-cms-core): support translation in error message (#1935)

This commit is contained in:
sysoce 2018-12-12 00:50:23 +09:00 committed by Shawn Erquhart
parent 443f060ef9
commit 0f1ebd1060
2 changed files with 165 additions and 161 deletions

View File

@ -79,7 +79,10 @@ export function loginUser(credentials) {
console.error(error); console.error(error);
dispatch( dispatch(
notifSend({ notifSend({
message: `${error.message}`, message: {
details: error.message,
key: 'ui.toast.onFailToAuth',
},
kind: 'warning', kind: 'warning',
dismissAfter: 8000, dismissAfter: 8000,
}), }),

View File

@ -1,160 +1,161 @@
export function getPhrases() { export function getPhrases() {
return { return {
app: { app: {
header: { header: {
content: 'Contents', content: 'Contents',
workflow: 'Workflow', workflow: 'Workflow',
media: 'Media', media: 'Media',
quickAdd: 'Quick add', quickAdd: 'Quick add',
}, },
app: { app: {
errorHeader: 'Error loading the CMS configuration', errorHeader: 'Error loading the CMS configuration',
configErrors: 'Config Errors', configErrors: 'Config Errors',
checkConfigYml: 'Check your config.yml file.', checkConfigYml: 'Check your config.yml file.',
loadingConfig: 'Loading configuration...', loadingConfig: 'Loading configuration...',
waitingBackend: 'Waiting for backend...', waitingBackend: 'Waiting for backend...',
}, },
notFoundPage: { notFoundPage: {
header: 'Not Found', header: 'Not Found',
}, },
}, },
collection: { collection: {
sidebar: { sidebar: {
collections: 'Collections', collections: 'Collections',
searchAll: 'Search all', searchAll: 'Search all',
}, },
collectionTop: { collectionTop: {
viewAs: 'View as', viewAs: 'View as',
newButton: 'New %{collectionLabel}', newButton: 'New %{collectionLabel}',
}, },
entries: { entries: {
loadingEntries: 'Loading Entries', loadingEntries: 'Loading Entries',
cachingEntries: 'Caching Entries', cachingEntries: 'Caching Entries',
longerLoading: 'This might take several minutes', longerLoading: 'This might take several minutes',
}, },
}, },
editor: { editor: {
editorControlPane: { editorControlPane: {
widget: { widget: {
required: '%{fieldLabel} is required.', required: '%{fieldLabel} is required.',
regexPattern: "%{fieldLabel} didn't match the pattern: %{pattern}.", regexPattern: "%{fieldLabel} didn't match the pattern: %{pattern}.",
processing: '%{fieldLabel} is processing.', processing: '%{fieldLabel} is processing.',
}, },
}, },
editor: { editor: {
onLeavePage: 'Are you sure you want to leave this page?', onLeavePage: 'Are you sure you want to leave this page?',
onUpdatingWithUnsavedChanges: onUpdatingWithUnsavedChanges:
'You have unsaved changes, please save before updating status.', 'You have unsaved changes, please save before updating status.',
onPublishingNotReady: 'Please update status to "Ready" before publishing.', onPublishingNotReady: 'Please update status to "Ready" before publishing.',
onPublishingWithUnsavedChanges: 'You have unsaved changes, please save before publishing.', onPublishingWithUnsavedChanges: 'You have unsaved changes, please save before publishing.',
onPublishing: 'Are you sure you want to publish this entry?', onPublishing: 'Are you sure you want to publish this entry?',
onDeleteWithUnsavedChanges: onDeleteWithUnsavedChanges:
'Are you sure you want to delete this published entry, as well as your unsaved changes from the current session?', 'Are you sure you want to delete this published entry, as well as your unsaved changes from the current session?',
onDeletePublishedEntry: 'Are you sure you want to delete this published entry?', onDeletePublishedEntry: 'Are you sure you want to delete this published entry?',
onDeleteUnpublishedChangesWithUnsavedChanges: onDeleteUnpublishedChangesWithUnsavedChanges:
'This will delete all unpublished changes to this entry, as well as your unsaved changes from the current session. Do you still want to delete?', 'This will delete all unpublished changes to this entry, as well as your unsaved changes from the current session. Do you still want to delete?',
onDeleteUnpublishedChanges: onDeleteUnpublishedChanges:
'All unpublished changes to this entry will be deleted. Do you still want to delete?', 'All unpublished changes to this entry will be deleted. Do you still want to delete?',
loadingEntry: 'Loading entry...', loadingEntry: 'Loading entry...',
}, },
editorToolbar: { editorToolbar: {
publishing: 'Publishing...', publishing: 'Publishing...',
publish: 'Publish', publish: 'Publish',
published: 'Published', published: 'Published',
publishAndCreateNew: 'Publish and create new', publishAndCreateNew: 'Publish and create new',
deleteUnpublishedChanges: 'Delete unpublished changes', deleteUnpublishedChanges: 'Delete unpublished changes',
deleteUnpublishedEntry: 'Delete unpublished entry', deleteUnpublishedEntry: 'Delete unpublished entry',
deletePublishedEntry: 'Delete published entry', deletePublishedEntry: 'Delete published entry',
deleteEntry: 'Delete entry', deleteEntry: 'Delete entry',
saving: 'Saving...', saving: 'Saving...',
save: 'Save', save: 'Save',
deleting: 'Deleting...', deleting: 'Deleting...',
updating: 'Updating...', updating: 'Updating...',
setStatus: 'Set status', setStatus: 'Set status',
backCollection: ' Writing in %{collectionLabel} collection', backCollection: ' Writing in %{collectionLabel} collection',
unsavedChanges: 'Unsaved Changes', unsavedChanges: 'Unsaved Changes',
changesSaved: 'Changes saved', changesSaved: 'Changes saved',
draft: 'Draft', draft: 'Draft',
inReview: 'In review', inReview: 'In review',
ready: 'Ready', ready: 'Ready',
publishNow: 'Publish now', publishNow: 'Publish now',
}, },
editorWidgets: { editorWidgets: {
unknownControl: { unknownControl: {
noControl: "No control for widget '%{widget}'.", noControl: "No control for widget '%{widget}'.",
}, },
unknownPreview: { unknownPreview: {
noPreview: "No preview for widget '%{widget}'.", noPreview: "No preview for widget '%{widget}'.",
}, },
}, },
}, },
mediaLibrary: { mediaLibrary: {
mediaLibrary: { mediaLibrary: {
onDelete: 'Are you sure you want to delete selected media?', onDelete: 'Are you sure you want to delete selected media?',
}, },
mediaLibraryModal: { mediaLibraryModal: {
loading: 'Loading...', loading: 'Loading...',
noResults: 'No results.', noResults: 'No results.',
noAssetsFound: 'No assets found.', noAssetsFound: 'No assets found.',
noImagesFound: 'No images found.', noImagesFound: 'No images found.',
private: 'Private ', private: 'Private ',
images: 'Images', images: 'Images',
mediaAssets: 'Media assets', mediaAssets: 'Media assets',
search: 'Search...', search: 'Search...',
uploading: 'Uploading...', uploading: 'Uploading...',
uploadNew: 'Upload new', uploadNew: 'Upload new',
deleting: 'Deleting...', deleting: 'Deleting...',
deleteSelected: 'Delete selected', deleteSelected: 'Delete selected',
chooseSelected: 'Choose selected', chooseSelected: 'Choose selected',
}, },
}, },
ui: { ui: {
errorBoundary: { errorBoundary: {
title: 'Sorry!', title: 'Sorry!',
details: "There's been an error - please ", details: "There's been an error - please ",
reportIt: 'report it!', reportIt: 'report it!',
}, },
settingsDropdown: { settingsDropdown: {
logOut: 'Log Out', logOut: 'Log Out',
}, },
toast: { toast: {
onFailToLoadEntries: 'Failed to load entry: %{details}', onFailToLoadEntries: 'Failed to load entry: %{details}',
onFailToPersist: 'Failed to persist entry: %{details}', onFailToPersist: 'Failed to persist entry: %{details}',
onFailToDelete: 'Failed to delete entry: %{details}', onFailToDelete: 'Failed to delete entry: %{details}',
onFailToUpdateStatus: 'Failed to update status: %{details}', onFailToUpdateStatus: 'Failed to update status: %{details}',
missingRequiredField: missingRequiredField:
"Oops, you've missed a required field. Please complete before saving.", "Oops, you've missed a required field. Please complete before saving.",
entrySaved: 'Entry saved', entrySaved: 'Entry saved',
entryPublished: 'Entry published', entryPublished: 'Entry published',
onFailToPublishEntry: 'Failed to publish: %{details}', onFailToPublishEntry: 'Failed to publish: %{details}',
entryUpdated: 'Entry status updated', entryUpdated: 'Entry status updated',
onDeleteUnpublishedChanges: 'Unpublished changes deleted', onDeleteUnpublishedChanges: 'Unpublished changes deleted',
}, onFailToAuth: '%{details}',
}, },
workflow: { },
workflow: { workflow: {
loading: 'Loading Editorial Workflow Entries', workflow: {
workflowHeading: 'Editorial Workflow', loading: 'Loading Editorial Workflow Entries',
newPost: 'New Post', workflowHeading: 'Editorial Workflow',
description: newPost: 'New Post',
'%{smart_count} entry waiting for review, %{readyCount} ready to go live. |||| %{smart_count} entries waiting for review, %{readyCount} ready to go live. ', description:
}, '%{smart_count} entry waiting for review, %{readyCount} ready to go live. |||| %{smart_count} entries waiting for review, %{readyCount} ready to go live. ',
workflowCard: { },
deleteChanges: 'Delete changes', workflowCard: {
deleteNewEntry: 'Delete new entry', deleteChanges: 'Delete changes',
publishChanges: 'Publish changes', deleteNewEntry: 'Delete new entry',
publishNewEntry: 'Publish new entry', publishChanges: 'Publish changes',
}, publishNewEntry: 'Publish new entry',
workflowList: { },
onDeleteEntry: 'Are you sure you want to delete this entry?', workflowList: {
onPublishingNotReadyEntry: onDeleteEntry: 'Are you sure you want to delete this entry?',
'Only items with a "Ready" status can be published. Please drag the card to the "Ready" column to enable publishing.', onPublishingNotReadyEntry:
onPublishEntry: 'Are you sure you want to publish this entry?', 'Only items with a "Ready" status can be published. Please drag the card to the "Ready" column to enable publishing.',
draftHeader: 'Drafts', onPublishEntry: 'Are you sure you want to publish this entry?',
inReviewHeader: 'In Review', draftHeader: 'Drafts',
readyHeader: 'Ready', inReviewHeader: 'In Review',
currentEntries: '%{smart_count} entry |||| %{smart_count} entries', readyHeader: 'Ready',
}, currentEntries: '%{smart_count} entry |||| %{smart_count} entries',
}, },
}; },
} };
}