diff --git a/README.md b/README.md index 47cebcc..1f37bb9 100644 --- a/README.md +++ b/README.md @@ -65,11 +65,11 @@ const jsonFile = { Now, you can use the library to translate the JSON file into multiple languages: ```javascript -const { translateToMultipleFolders, translateToUnicFolder } = require('azure-translator-code'); +const { translateToMultipleFolders, translateToUnicFolder, updateTranslationsMulti, updateTranslationsUnic } = require('azure-translator-code'); ``` or ```javascript -import { translateToMultipleFolders, translateToUnicFolder } from 'azure-translator-code'; +import { translateToMultipleFolders, translateToUnicFolder, updateTranslationsMulti, updateTranslationsUnic } from 'azure-translator-code'; ``` ```javascript @@ -101,16 +101,20 @@ const jsonFile = { }; // Translation to multiple folders -translateToMultipleFolders(key, endpoint, location, fromLang, toLangs, jsonFile); +translateToMultipleFolders(key, endpoint, location, fromLang, toLangs, jsonFile); // Replace all values ​​and keys // This function will return a folder called multiFolderGeneratedTranslations // Translation to a single folder -translateToUnicFolder(key, endpoint, location, fromLang, toLangs, jsonFile); +translateToUnicFolder(key, endpoint, location, fromLang, toLangs, jsonFile); // Replace all values ​​and keys // This function will return a folder called unicFolderGeneratedTranslations // Update translation from the multiple folders -updateTranslationsMulti(key, endpoint, location, fromLang, toLangs, jsonFile); +updateTranslationsMulti(key, endpoint, location, fromLang, toLangs, jsonFile); // Only new keys will be translated (Optimized) // This function will update the translations in the folder called multiFolderGeneratedTranslations + +// Update translation from the single folder +updateTranslationsUnic(key, endpoint, location, fromLang, toLangs, jsonFile); // Only new keys will be translated (Optimized) +// This function will update the translations in the folder called unicFolderGeneratedTranslations ``` #### You can also choose the folder or folder name where you will save the files. diff --git a/package-lock.json b/package-lock.json index ed99aae..e8bfeb9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "azure-translator-code", - "version": "1.1.0", + "version": "1.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "azure-translator-code", - "version": "1.1.0", + "version": "1.1.4", "license": "MIT", "dependencies": { "axios": "^1.5.0", diff --git a/package.json b/package.json index e086ac0..c27cf37 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "azure-translator-code", - "version": "1.1.3", + "version": "1.1.4", "description": "Azure Cognitive Services Translator Text API Code for Use with Common Languages", "author": { "name": "Gabriel Logan" diff --git a/src/translateToMultipleFolders/index.ts b/src/translateToMultipleFolders/index.ts index efa3e99..17c71f2 100644 --- a/src/translateToMultipleFolders/index.ts +++ b/src/translateToMultipleFolders/index.ts @@ -56,7 +56,7 @@ export default function translateToMultipleFolders( jsonFile: TranslationType, folderNamePath: string = 'multiFolderGeneratedTranslations', // Onde sera salvo os arquivos ): void { - const traducoesDir: string = path.join(__dirname, '..', '..', '..', '..', folderNamePath); + const traducoesDir: string = path.join(process.cwd(), folderNamePath); if (!fs.existsSync(traducoesDir)) { fs.mkdirSync(traducoesDir, { recursive: true }); // Use { recursive: true } para criar pastas recursivamente, se necessário diff --git a/src/translateToUnicFolder/index.ts b/src/translateToUnicFolder/index.ts index 0225533..dcd3574 100644 --- a/src/translateToUnicFolder/index.ts +++ b/src/translateToUnicFolder/index.ts @@ -56,7 +56,7 @@ export default function translateToUnicFolder( jsonFile: TranslationType, folderNamePath: string = 'unicFolderGeneratedTranslations', // Onde sera salvo os arquivos ): void { - const traducoesDir: string = path.join(__dirname, '..', '..', '..', '..', folderNamePath); + const traducoesDir: string = path.join(process.cwd(), folderNamePath); if (!fs.existsSync(traducoesDir)) { fs.mkdirSync(traducoesDir, { recursive: true }); // Use { recursive: true } para criar pastas recursivamente, se necessário diff --git a/src/updateTranslationMulti/index.ts b/src/updateTranslationMulti/index.ts index 6f2ac98..09c2613 100644 --- a/src/updateTranslationMulti/index.ts +++ b/src/updateTranslationMulti/index.ts @@ -59,7 +59,7 @@ export default function updateTranslationsMulti( jsonFile: TranslationType, folderNamePath: string = 'multiFolderGeneratedTranslations', // Onde sera salvo os arquivos ): void { - const traducoesDir: string = path.join(__dirname, '..', '..', '..', '..', folderNamePath); + const traducoesDir: string = path.join(process.cwd(), folderNamePath); if (!fs.existsSync(traducoesDir)) { fs.mkdirSync(traducoesDir, { recursive: true }); diff --git a/src/updateTranslationUnic/index.ts b/src/updateTranslationUnic/index.ts index 6c4d03d..118e3c9 100644 --- a/src/updateTranslationUnic/index.ts +++ b/src/updateTranslationUnic/index.ts @@ -59,7 +59,7 @@ export default function updateTranslationsUnic( jsonFile: TranslationType, folderNamePath: string = 'unicFolderGeneratedTranslations', // Onde sera salvo os arquivos ): void { - const traducoesDir: string = path.join(__dirname, '..', '..', '..', '..', folderNamePath); + const traducoesDir: string = path.join(process.cwd(), folderNamePath); if (!fs.existsSync(traducoesDir)) { fs.mkdirSync(traducoesDir, { recursive: true });