From 6021626a17d44d4a05a0be5cb4a3cbf1a41ccb17 Mon Sep 17 00:00:00 2001 From: Liam Mulhall Date: Fri, 28 Apr 2023 12:19:27 -0600 Subject: [PATCH] chore: remove `NO_INTERNET` code For https://github.com/phetsims/rosetta/issues/399. --- src/server/translationApi/getLocaleInfo.js | 10 ---------- src/server/translationApi/getSimMetadata.js | 16 ---------------- .../translationApi/getTranslationFormData.js | 9 --------- 3 files changed, 35 deletions(-) diff --git a/src/server/translationApi/getLocaleInfo.js b/src/server/translationApi/getLocaleInfo.js index 9e702b19..5028239e 100644 --- a/src/server/translationApi/getLocaleInfo.js +++ b/src/server/translationApi/getLocaleInfo.js @@ -10,9 +10,7 @@ // import fs from 'fs'; import axios from 'axios'; -import fs from 'fs'; import privateConfig from '../../common/privateConfig.js'; -import publicConfig from '../../common/publicConfig.js'; import logger from './logger.js'; let timeOfLastUpdate = Number.NEGATIVE_INFINITY; @@ -28,14 +26,6 @@ const getLocaleInfo = async () => { logger.info( 'getting locale info' ); try { - // If working on the translation utility without an internet connection, - // mock the locale info with your local copy. (This assumes you have - // a local copy of locale info.) - if ( publicConfig.ENVIRONMENT === 'development' && privateConfig.NO_INTERNET ) { - logger.info( 'using local copy of locale info' ); - return JSON.parse( fs.readFileSync( './localeInfo.json' ) ); - } - const localeInfoValidDurationElapsed = timeOfLastUpdate + privateConfig.VALID_LOCALE_INFO_DURATION < Date.now(); diff --git a/src/server/translationApi/getSimMetadata.js b/src/server/translationApi/getSimMetadata.js index a432ef08..cbc95133 100644 --- a/src/server/translationApi/getSimMetadata.js +++ b/src/server/translationApi/getSimMetadata.js @@ -6,7 +6,6 @@ * @author Liam Mulhall */ -import fs from 'fs'; import axios from 'axios'; import privateConfig from '../../common/privateConfig.js'; import publicConfig from '../../common/publicConfig.js'; @@ -79,21 +78,6 @@ let simMetadata; const getSimMetadata = async () => { logger.info( 'getting sim metadata' ); - // If working on the translation utility without an internet connection, - // mock the sim metadata with your local copy. (This assumes you have - // a local copy of sim metadata.) - try { - if ( publicConfig.ENVIRONMENT === 'development' && privateConfig.NO_INTERNET ) { - logger.info( 'using local copy of sim metadata' ); - return JSON.parse( fs.readFileSync( './simMetadata.json' ) ); - } - } - catch( e ) { - logger.error( 'unable to get sim metadata' ); - logger.error( e ); - logger.error( 'this might be because you don\'t have a local copy of sim metadata' ); - } - simMetadataMutex = simMetadataMutex.then( async () => { const metadataValidDurationElapsed = timeOfLastUpdate + diff --git a/src/server/translationApi/getTranslationFormData.js b/src/server/translationApi/getTranslationFormData.js index d0f99b64..510f00d7 100644 --- a/src/server/translationApi/getTranslationFormData.js +++ b/src/server/translationApi/getTranslationFormData.js @@ -12,7 +12,6 @@ // Uncomment this import of you want a local copy of translation form data. // import fs from 'fs'; -import fs from 'fs'; import privateConfig from '../../common/privateConfig.js'; import publicConfig from '../../common/publicConfig.js'; import getCommonTranslationFormData from './getCommonTranslationFormData.js'; @@ -76,14 +75,6 @@ const getTranslationFormData = async ( ) => { logger.info( 'getting translation form data' ); - // If working on the translation utility without an internet connection, - // mock the translation form data with your local copy. (This assumes you have - // a local copy of translation form data.) - if ( publicConfig.ENVIRONMENT === 'development' && privateConfig.NO_INTERNET ) { - logger.info( 'using local copy of translation form data' ); - return JSON.parse( fs.readFileSync( './translationFormData.json' ) ); - } - // Try to get a saved translation from the short-term storage database. if ( privateConfig.DB_ENABLED ) { try {