
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
gpt-json-translator
Advanced tools
JSON Translator is an innovative tool designed to utilize ChatGPT for translating extensive JSON text files efficiently. This project is ideal for developers and content creators who require quick and accurate localization of their JSON-based data into multiple languages.
{
"website": {
"name": "Mock Language Explorer",
"url": "www.mocklanguageexplorer.com",
"pages": [
{
"pageTitle": "About Us",
"content": "Language Explorer is dedicated to making language learning accessible to everyone. Our team, composed of language experts and technology enthusiasts, believes in the power of communication and understanding. With over a decade of experience, we provide resources, tools, and courses to help individuals and organizations break language barriers."
},
{
"pageTitle": "Our Services",
"subPages": [
{
"subPageTitle": "Translation Tools",
"description": "Explore our state-of-the-art translation tools designed to provide accurate and swift translations across multiple languages. From document translations to real-time conversational assistance, our tools utilize advanced algorithms and machine learning to ensure quality and efficiency."
},
{
"subPageTitle": "Language Courses",
"description": "Our language courses range from beginner to advanced levels, offering comprehensive learning modules in over 30 languages. Each course is tailored to promote immersive learning experiences, facilitated by native speakers and enriched with cultural insights."
}
]
}
]
}
}
{
"website": {
"name": "模拟语言探索者",
"url": "www.mocklanguageexplorer.com",
"pages": [
{
"pageTitle": "关于我们",
"content": "语言探索者致力于使语言学习对每个人都更加可及。我们的团队由语言专家和技术爱好者组成,坚信沟通和理解的力量。凭借超过十年的经验,我们提供资源、工具和课程,帮助个人和组织打破语言障碍。"
},
{
"pageTitle": "我们的服务",
"subPages": [
{
"subPageTitle": "翻译工具",
"description": "探索我们的最先进的翻译工具,旨在提供跨多种语言的准确和快速翻译。从文件翻译到实时对话协助,我们的工具利用先进的算法和机器学习,确保质量和效率。"
},
{
"subPageTitle": "语言课程",
"description": "我们的语言课程涵盖初学者到高级水平,在30多种语言中提供全面的学习模块。每门课程都旨在促进沉浸式学习体验,由母语人士主持,并丰富文化见解。"
}
]
}
]
}
}
To start using gpt-json-translator
, you need to install the package from npm. You can do this using either npm or yarn. Here are the steps for each method:
Visit NPM page Run the following command to install the package:
npm install gpt-json-translator
If you prefer using Yarn, run this command instead:
yarn add gpt-json-translator
npx translateAll
npx translateLocale fr
After installation, you can import and use gpt-json-translator
in your JavaScript project. Here's a simple example to get you started:
npx translateAll
npx translateLocale fr
import { translateOne, translateAll } from 'gpt-json-translator/index.js';
//translating a single locale
translateOne('fr');
//translating all supported locales
translateAll();
For those cautious about overwriting existing files, the tool offers a dryRun
mode. This mode enables users to preview the translation results without altering the original files.
npx translateAll --dryRun
npx translateLocale zh --dryRun
Set up a config.yaml
file in your project's root directory with the necessary parameters for the translation process.
config.yaml
:sourceLocale: 'en'
supportedLocales: ['en', 'fr', 'zh']
filePath: 'locales'
# dryRun: true
openai:
api_key: ${OPENAI_API_KEY} # put your openai api key here or in your .env file
model: 'gpt-3.5-turbo-1106' # you can put the modal you wants to run
max_tokens: 1000 # max prompt_tokens for source locale language.
max_retry: 3
# max_tokens: total_tokens = prompt_tokens + completion_tokens. when you send 1000 token en to translate to fr. it could return 2000 token as fr. so the total_tokens will be 3000.
For more information about ChatGPT models, you can Visit OpenAI Models
We welcome contributions to enhance JSON Translator. Feel free to fork the repository and submit pull requests.
This project is released under the MIT License.
Leverage the capabilities of ChatGPT with JSON Translator to streamline and refine your JSON localization processes.
FAQs
A tool for translating JSON files using GPT.
We found that gpt-json-translator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.