GithubHelp home page GithubHelp logo

tnucat / libretranslator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bestzwei/libretranslator

0.0 0.0 0.0 75 KB

基于 DeepLx 可Cloudflare Pages部署的翻译界面。

Home Page: https://libretranslator.pages.dev

JavaScript 69.90% CSS 26.18% HTML 3.92%

libretranslator's Introduction

LibreTranslator

LibreTranslator 是一个基于 React 的翻译工具,利用 DeepLx API 提供快速和准确的翻译服务。用户可以选择源语言和目标语言,输入文本并获取翻译结果。

功能

  • 支持多种语言的翻译
  • 友好的用户界面(待完善)

技术栈

  • 前端: React
  • 样式: CSS
  • API: DeepLx API

项目结构

/
├── /public
│ ├── index.html
├── /src
│ ├── App.js
│ ├── index.js
│ └── styles.css
└── package.json

部署

1、使用 Cloudflare Pages 部署

  1. Fork 本仓库。
  2. 登录到 Cloudflare ,在 Cloudflare Dashboard 中,选择 "Pages"。
  3. 点击 "Create a Project"。
  4. 连接到您的 GitHub 存储库,并选择该项目。
  5. 在 "Configure your build" 步骤中,使用以下设置:
    • Framework preset:
    • Build command: npm run build
    • Build directory: build
  6. 点击 "Save and Deploy"。

2、使用 Vercel 部署

  1. Fork 本仓库。
  2. 登录到 Vercel,点击 "New Project"。
  3. 连接到您的 GitHub 存储库,并选择该项目。
  4. Vercel 会自动检测到您使用的是 React 项目。您可以使用默认设置。
  5. 点击 "Deploy"。

所有部署方式都要配置环境变量

  1. REACT_APP_DEEPLX_API_URL: https://api.deeplx.org/<api-key> ,不带 /translate

    用于存储 DeepLx API 的 URL,以便在请求翻译时使用。<api-key> 可以从 https://connect.linux.do/ 获取。

    或者你是Pro用户,参考 DeepLx文档 使用 /v1 请求 ,https://api.deeplx.org/v1

  2. REACT_APP_PASSWORD(可选): 访问密码

    用于存储访问口令,限制其他人使用你部署的翻译网页。

  3. NODE_OPTIONS:--openssl-legacy-provider

    这个变量用于配置 Node.js 的选项,通常用于解决某些依赖包的兼容性问题,不设置则可能部署失败。

  4. REACT_APP_API_TOKEN(可选):按需修改,如果你是自建的DeepLx服务,参考请求链接是 REACT_APP_DEEPLX_API_URL/translate?token=REACT_APP_API_TOKEN,填写这两个环境变量。

    常用的请求格式


贡献

欢迎任何形式的贡献!请提交问题或拉取请求。

libretranslator's People

Contributors

bestzwei avatar tnucat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.