Skip to content

Commit

Permalink
fix: solve lin & build err & version update
Browse files Browse the repository at this point in the history
  • Loading branch information
ParvinEyvazov committed Oct 8, 2024
1 parent 8e2dd06 commit fce71d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.2.0",
"version": "3.2.1",
"license": "MIT",
"main": "dist/index.js",
"description": "Translate your JSON file or object into another languages with Google Translate API",
Expand Down
21 changes: 11 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { plaintranslate } from './core/translator';
import { fileTranslator } from './core/json_file';
import { objectTranslator } from './core/json_object';
import {
TranslationConfig,
TranslationModules,
TranslationConfig as TranslationConfigTemp,
TranslationModules as TranslationModulesTemp,
TranslationModule,
} from './modules/modules';
import { default_concurrency_limit, default_fallback } from './utils/micro';

const defaults: TranslationConfig = {
const defaults: TranslationConfigTemp = {
moduleKey: 'google',
TranslationModule: TranslationModules['google'],
TranslationModule: TranslationModulesTemp['google'],
concurrencyLimit: default_concurrency_limit,
fallback: default_fallback,
};
Expand All @@ -20,15 +20,16 @@ export async function translateWord(
word: string,
from: string,
to: string,
config: TranslationConfig = defaults
config: TranslationConfigTemp = defaults
) {
return await plaintranslate(config, word, from, to, []);
}

export async function translateObject(
object: translatedObject,
from: string,
to: string[],
config: TranslationConfig = defaults
config: TranslationConfigTemp = defaults
): Promise<translatedObject | translatedObject[]> {
let hard_copy = JSON.parse(JSON.stringify(object));
return objectTranslator(config, hard_copy, from, to);
Expand All @@ -39,7 +40,7 @@ export async function translateFile(
from: string,
to: string[],
newFileName: string,
config: TranslationConfig = defaults
config: TranslationConfigTemp = defaults
) {
return fileTranslator(config, objectPath, from, to, newFileName);
}
Expand All @@ -53,6 +54,6 @@ export interface translatedObject {
[key: string]: any;
}

export { TranslationModules };

export type { TranslationConfig, TranslationModule };
export { TranslationModule };
export type TranslationModules = TranslationModulesTemp;
export type TranslationConfig = TranslationConfigTemp;

0 comments on commit fce71d2

Please sign in to comment.