TagSpaces is an offline, open source, document manager with tagging support
TSN253-adding-new-string-to-i18n
Mladen Sapundshiev7ae136d524aa
diff --git a/app/locales/en/core.json b/app/locales/en/core.jsonindex 4268db669..e93196c44 100644--- a/app/locales/en/core.json+++ b/app/locales/en/core.json@@ -357,5 +357,27 @@"locationType": "Type","firstOpenaFolder": "Please first open a folder!","errorLoadingFolder": "Error loading directory",+ "fileCreateSuccessfully": "File create successfully",+ "errorCreatingFile": "Error creating file",+ "connectedtoObjectStore": "Connected to object store",+ "connectedtoObjectStoreFailed": "Connection to object store failed!",+ "renamingSuccessfully": "Renaming successfully.",+ "notImplementedYet": "Not implemented yet, please use the save button.",+ "generatingThumbnailsFailed": "Generating thumbnails failed",+ "checkingThumbnails": "Checking thumbnails",+ "loadingOrGeneratingThumbnails": "Loading or generating thumbnails...",+ "copyingFilesFailed": "Copying files failed",+ "filesMovedSuccessfull": "Files moved successfull",+ "filesCopiedSuccessfull": "Files copied successfull",+ "allFilesMoveSuccessfully": "All files move successfully",+ "movingFilesFailed": "Moving files failed",+ "loadingIndex": "Loading index ...",+ "loadingIndexFailed": "Loading index failed",+ "searching": "Searching...",+ "searchingFailed": "Search failed.",+ "addingTagsFailed": "Adding tags failed",+ "removingSidecarTagsFailed": "Removing sidecar tags failed",+ "removingTagsInSidecarFileFailed": "Removing tags in sidecar file failed",+ "fileCreatedSuccessfully": "File created successfully","-": "-"}diff --git a/app/reducers/app.js b/app/reducers/app.jsindex aa6aff1e6..c3e9a479d 100644--- a/app/reducers/app.js+++ b/app/reducers/app.js@@ -765,13 +765,13 @@ export const actions = {const filePath = app.currentDirectoryPath + AppConfig.dirSeparator + 'textfile' + AppConfig.beginTagContainer + formatDateTime4Tag(new Date(), true) + AppConfig.endTagContainer + '.txt';PlatformIO.saveFilePromise(filePath, '', true).then(() => {dispatch(actions.reflectCreateEntry(filePath, true));- dispatch(actions.showNotification('File create successfully', 'info', true));+ dispatch(actions.showNotification(i18n.t('core:fileCreateSuccessfully'), 'info', true));dispatch(actions.openFile(filePath));// TODO select file // dispatch(actions.setLastSelectedEntry(filePath));return true;}).catch((err) => {console.warn('File creation failed with ' + err);- dispatch(actions.showNotification('Error creating file', 'warning', true));+ dispatch(actions.showNotification(i18n.t('core:errorCreatingFile'), 'warning', true));});} else {dispatch(actions.showNotification(i18n.t('core:firstOpenaFolder'), 'warning', true));@@ -841,7 +841,7 @@ export const actions = {const currentLocationId = getState().app;if (location.type === locationType.TYPE_CLOUD) {PlatformIO.enableObjectStoreSupport(location).then(() => {- dispatch(actions.showNotification('Connected to object store', 'default', true));+ dispatch(actions.showNotification(i18n.t('core:connectedtoObjectStore'), 'default', true));dispatch(actions.setReadOnlyMode(location.isReadOnly || false));dispatch(actions.setCurrentLocationId(location.uuid));dispatch(actions.loadDirectoryContent(location.paths[0]));@@ -854,7 +854,7 @@ export const actions = {}return true;}).catch(() => {- dispatch(actions.showNotification('Connection to object store failed!', 'warning', true));+ dispatch(actions.showNotification(i18n.t('core:connectedtoObjectStoreFailed'), 'warning', true));PlatformIO.disableObjectStoreSupport();});} else { // if (location.type === locationType.TYPE_LOCAL) {@@ -1111,7 +1111,7 @@ export const actions = {// UI notificationdispatch(actions.showNotification(- 'Renaming successfully.',+ i18n.t('core:renamingSuccessfully'),'default',true)@@ -1146,12 +1146,12 @@ export const actions = {dispatch: (actions: Object) => void,getState: () => Object) => {- actions.showNotification('Not implemented yet, please use the save button.', 'warning', true);+ actions.showNotification(i18n.t('core:notImplementedYet'), 'warning', true);// const { app } = getState();/* PlatformIO.saveFilePromise(filePath, content, true).then((isNewFile) => {console.log(isNewFile);dispatch(- actions.showNotification('File created successfully.', 'successfully', true)+ actions.showNotification(i18n.t('core:fileCreatedSuccessfully.'), 'successfully', true));return true;}).catch((error) => {@@ -1220,12 +1220,12 @@ function prepareDirectoryContent(function handleTmbGenerationFailed(error) {console.warn('Thumb generation failed: ' + error);dispatch(actions.setGeneratingThumbnails(false));- dispatch(actions.showNotification('Generating thumbnails failed', 'warning', true));+ dispatch(actions.showNotification(i18n.t('core:generatingThumbnailsFailed'), 'warning', true));}if (tmbGenerationPromises.length > 0) {dispatch(actions.setGeneratingThumbnails(true));- // dispatch(actions.showNotification('Checking thumbnails', 'info', false));+ // dispatch(actions.showNotification(i18n.t('core:checkingThumbnails'), 'info', false));Promise.all(tmbGenerationPromises).then(handleTmbGenerationResults).catch(handleTmbGenerationFailed);@@ -1233,7 +1233,7 @@ function prepareDirectoryContent(if (tmbGenerationList.length > 0) {dispatch(actions.setGeneratingThumbnails(true));- // dispatch(actions.showNotification('Loading or generating thumbnails...', 'info', false));+ // dispatch(actions.showNotification(i18n.t('core:loadingOrGeneratingThumbnails'), 'info', false));PlatformIO.createThumbnailsInWorker(tmbGenerationList).then(handleTmbGenerationResults).catch(handleTmbGenerationFailed);diff --git a/app/reducers/io-actions.js b/app/reducers/io-actions.jsindex 0043df8d3..cbc69ddb9 100644--- a/app/reducers/io-actions.js+++ b/app/reducers/io-actions.js@@ -34,6 +34,7 @@ import {renameFilesPromise} from '../services/utils-io';import AppConfig from '../config';+import i18n from '../services/i18n';const actions = {moveFiles: (paths: Array<string>, targetPath: string) => (@@ -45,11 +46,11 @@ const actions = {return true;});Promise.all(renameJobs).then(() => {- dispatch(AppActions.showNotification('All files move successfully'));+ dispatch(AppActions.showNotification(i18n.t('core:allFilesMoveSuccessfully')));return true;}).catch((err) => {console.warn('Moving files failed with ' + err)- dispatch(AppActions.showNotification('Moving files failed'));+ dispatch(AppActions.showNotification(i18n.t('core:movingFilesFailed')));}); */const moveJobs = [];paths.map((path) => {@@ -57,7 +58,7 @@ const actions = {return true;});renameFilesPromise(moveJobs).then(() => {- dispatch(AppActions.showNotification('Files moved successful'));+ dispatch(AppActions.showNotification(i18n.t('core:filesMovedSuccessfull')));const moveMetaJobs = [];moveJobs.map((job) => {dispatch(AppActions.reflectDeleteEntry(job[0])); // TODO moved files should be added to the index, if the target dir in index@@ -74,7 +75,7 @@ const actions = {return true;}).catch((err) => {console.warn('Moving files failed with ' + err);- dispatch(AppActions.showNotification('Copying files failed'));+ dispatch(AppActions.showNotification(i18n.t('core:copyingFilesFailed')));});},copyFiles: (paths: Array<string>, targetPath: string) => (@@ -86,7 +87,7 @@ const actions = {return true;});copyFilesPromise(copyJobs).then(() => {- dispatch(AppActions.showNotification('Files copied successful'));+ dispatch(AppActions.showNotification(i18n.t('core:filesCopiedSuccessfull')));const copyMetaJobs = [];copyJobs.map((job) => {// dispatch(AppActions.reflectCopyEntry(job[0])); // TODO need only for the index if the target dir is indexed@@ -103,7 +104,7 @@ const actions = {return true;}).catch((err) => {console.warn('Moving files failed with ' + err);- dispatch(AppActions.showNotification('Copying files failed'));+ dispatch(AppActions.showNotification(i18n.t('core:copyingFilesFailed')));});},};diff --git a/app/reducers/location-index.js b/app/reducers/location-index.jsindex 215b894f1..2fcc5d53c 100644--- a/app/reducers/location-index.js+++ b/app/reducers/location-index.js@@ -30,6 +30,7 @@ import type { SearchQuery } from '../services/search';import Search from '../services/search';import { actions as AppActions } from './app';import AppConfig from '../config';+import i18n from '../services/i18n';export const types = {INDEX_DIRECTORY: 'INDEX_DIRECTORY',@@ -218,14 +219,14 @@ export const actions = {const state = getState();const currentLocation: Location = getLocation(state, state.app.currentLocationId);dispatch(actions.startDirectoryIndexing());- dispatch(AppActions.showNotification('Loading index ...', 'default', true));+ dispatch(AppActions.showNotification(i18n.t('core:loadingIndex'), 'default', true));if (Pro && Pro.Indexer.loadIndex) {Pro.Indexer.loadIndex(directoryPath, (currentLocation.type === locationType.TYPE_CLOUD) ? '/' : AppConfig.dirSeparator).then((directoryIndex) => {dispatch(actions.indexDirectorySuccess(directoryIndex));return true;}).catch(err => {dispatch(actions.indexDirectoryFailure(err));- dispatch(AppActions.showNotification('Loading index failed', 'warning', true));+ dispatch(AppActions.showNotification(i18n.t('core:loadingIndexFailed'), 'warning', true));});}},@@ -236,7 +237,7 @@ export const actions = {dispatch: (actions: Object) => void,getState: () => Object) => {- dispatch(AppActions.showNotification('Searching...', 'default', false));+ dispatch(AppActions.showNotification(i18n.t('core:searching'), 'default', false));setTimeout(() => { // Workarround used to show the start search noticationSearch.searchLocationIndex(getState().locationIndex.currentDirectoryIndex,@@ -248,7 +249,7 @@ export const actions = {}).catch(() => {dispatch(AppActions.updateSearchResults([]));dispatch(AppActions.hideNotifications());- dispatch(AppActions.showNotification('Search failed.', 'warning', true));+ dispatch(AppActions.showNotification(i18n.t('core:searchingFailed'), 'warning', true));});}, 50);},diff --git a/app/reducers/tagging-actions.js b/app/reducers/tagging-actions.jsindex 69f63aa56..71759445d 100644--- a/app/reducers/tagging-actions.js+++ b/app/reducers/tagging-actions.js@@ -116,7 +116,7 @@ const actions = {return true;}).catch((err) => {console.warn('Error adding tags for ' + path + ' with ' + err);- dispatch(AppActions.showNotification('Adding tags failed', 'error', true));+ dispatch(AppActions.showNotification(i18n.t('core:addingTagsFailed'), 'error', true));});}} else {@@ -126,7 +126,7 @@ const actions = {return true;}).catch(error => {console.warn('Error adding tags for ' + path + ' with ' + error);- dispatch(AppActions.showNotification('Adding tags failed', 'error', true));+ dispatch(AppActions.showNotification(i18n.t('core:addingTagsFailed'), 'error', true));});}} else if (fsEntryMeta) { // Handling tags in filename by existing sidecar@@ -212,12 +212,12 @@ const actions = {return true;}).catch((err) => {console.warn('Error adding tags for ' + path + ' with ' + err);- dispatch(AppActions.showNotification('Adding tags failed', 'error', true));+ dispatch(AppActions.showNotification(i18n.t('core:addingTagsFailed'), 'error', true));});return true;}).catch((error) => {console.warn('Error adding tags for ' + path + ' with ' + error);- dispatch(AppActions.showNotification('Adding tags failed', 'error', true));+ dispatch(AppActions.showNotification(i18n.t('core:addingTagsFailed'), 'error', true));});}},@@ -262,13 +262,13 @@ const actions = {return true;}).catch((err) => {console.warn('Removing sidecar tags failed ' + path + ' with ' + err);- dispatch(AppActions.showNotification('Removing sidecar tags failed', 'error', true));+ dispatch(AppActions.showNotification(i18n.t('core:removingSidecarTagsFailed'), 'error', true));removeTagsFromFilename();});return true;}).catch((error) => {console.warn('Error adding tags for ' + path + ' with ' + error);- // dispatch(AppActions.showNotification('Removing sidecar tags failed', 'error', true));+ // dispatch(AppActions.showNotification(i18n.t('core:removingSidecarTagsFailed'), 'error', true));removeTagsFromFilename();});@@ -317,7 +317,7 @@ const actions = {return true;}).catch((err) => {console.warn('Removing sidecar tags failed for ' + path + ' with ' + err);- dispatch(AppActions.showNotification('Removing tags in sidecar file failed', 'error', true));+ dispatch(AppActions.showNotification(i18n.t('core:removingTagsInSidecarFileFailed'), 'error', true));removeAllTagsFromFilename();});return true;