{"id":18640,"date":"2025-08-05T18:12:22","date_gmt":"2025-08-05T10:12:22","guid":{"rendered":"https:\/\/92it.top\/?p=18640"},"modified":"2025-08-05T18:12:22","modified_gmt":"2025-08-05T10:12:22","slug":"%e5%b9%b3%e6%9b%bf%e8%b0%b7%e6%ad%8c%e7%bf%bb%e8%af%91%ef%bc%8c%e4%b8%80%e5%88%86%e9%92%9f%e9%83%a8%e7%bd%b2libretranslate","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=18640","title":{"rendered":"\u5e73\u66ff\u8c37\u6b4c\u7ffb\u8bd1\uff0c\u4e00\u5206\u949f\u90e8\u7f72LibreTranslate"},"content":{"rendered":"\n<p><strong>\u80cc\u666f<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u60f3\u7ffb\u8bd1\u4e00\u6bb5\u5185\u5bb9\uff0c\u7ed3\u679c\u7f51\u65ad\u4e86\uff0c\u5728\u7ebf\u7ffb\u8bd1\u9875\u9762\u538b\u6839\u6253\u4e0d\u5f00\uff1f\u7ecf\u5e38\u8981\u7ffb\u8bd1\u5927\u91cf\u5185\u5bb9\uff0c\u8001\u662f\u53d7\u9650\u4e8e\u5b57\u6570\u3001\u8bf7\u6c42\u9891\u7387\uff0c\u751a\u81f3\u5e7f\u544a\u6ee1\u5929\u98de\uff1f\u62c5\u5fc3\u5728\u7ebf\u7ffb\u8bd1\u5668\u5c06\u5185\u90e8\u8d44\u6599\u4f20\u5230 Google\u3001\u767e\u5ea6\u670d\u7b49\u52a1\u5668\u4e0a\uff0c\u6570\u636e\u9690\u79c1\u6beb\u65e0\u4fdd\u969c\uff1f<\/p>\n\n\n\n<p>\u53c8\u6216\u5f00\u53d1\u65f6\u60f3\u8c03\u7528\u4e2a\u7ffb\u8bd1 API\uff0c\u5374\u53d1\u73b0\u4e0d\u662f\u8981\u7ed1\u5361\u5c31\u662f\u8981\u4ed8\u8d39\uff0c\u8c03\u8bd5\u90fd\u96be\uff1f<\/p>\n\n\n\n<p><strong>\u5982\u679c\u4f60\u70b9\u5934\u4e86\uff0c\u90a3\u6216\u8bb8\u8be5\u4e86\u89e3\u4e0bLibreTranslate\uff0c\u8fd9\u662f\u4e00\u6b3e\u5f00\u6e90\u3001\u514d\u8d39\u3001\u65e0\u9700\u8054\u7f51\u5c31\u80fd\u7528\u7684\u7ffb\u8bd1\u5de5\u5177\uff0c\u80fd\u672c\u5730\u90e8\u7f72\u3001\u652f\u6301\u591a\u8bed\u8a00\u4e92\u8bd1\u3001\u4e0d\u4e0a\u4f20\u4efb\u4f55\u6570\u636e\uff0c\u8fd8\u80fd\u4e00\u952e Docker \u542f\u52a8\u3002<\/strong><\/p>\n\n\n\n<p>\u6211\u7684\u5de5\u4f5c\u4f1a\u7ecf\u5e38\u6027\u6821\u8ba2\u603b\u90e8\u6587\u7a3f\uff0c\u539f\u672c\u662f\u817e\u8baf\u7ffb\u8bd1\u541b\u548cGoogle\u7ffb\u8bd1\u63ba\u5408\u7740\u7528\uff0c\u5c1d\u8fc7LibreTranslate\u89c9\u5f97\u771f\u662f\u4e0d\u9519\uff0c\u56e0\u6b64\u63a8\u8350\u7ed9\u5927\u5bb6\uff5e<\/p>\n\n\n\n<p>LibreTranslate \u662f\u4e00\u4e2a\u5b8c\u5168\u5f00\u6e90\u3001\u65e0\u9700\u4f9d\u8d56\u7b2c\u4e09\u65b9 Google \u6216 Azure \u7b49\u4e13\u6709\u63d0\u4f9b\u5546\u6765\u6267\u884c\u7ffb\u8bd1\uff0c\u57fa\u4e8e\u795e\u7ecf\u7f51\u7edc\u7684\u5f00\u6e90\u7ffb\u8bd1\u5f15\u64ce\uff08\u7531\u5f00\u6e90Argos Translate\u5e93\u63d0\u4f9b\u652f\u6301\uff09\uff0c\u53ef\u4ee5\u79bb\u7ebf\u8fd0\u884c\u3001\u81ea\u5efa\u90e8\u7f72\uff0c\u5b9e\u73b0\u5b8c\u5168\u81ea\u6258\u7ba1\u3002<\/p>\n\n\n\n<ul>\n<li>\u96f6\u4f9d\u8d56\u7b2c\u4e09\u65b9\u4e91\u5e73\u53f0\uff0c\u53ef\u5b8c\u5168\u672c\u5730\u79bb\u7ebf\u90e8\u7f72<\/li>\n\n\n\n<li>\u652f\u6301 API \u5bc6\u94a5\u9650\u5236\u3001\u8bf7\u6c42\u63a7\u5236<\/li>\n\n\n\n<li>\u652f\u6301\u591a\u8bed\u8a00\u4e92\u8bd1\uff08\u542b\u4e2d\u82f1\u6cd5\u897f\u7b49\u4e3b\u6d41\u8bed\u79cd\uff09<\/li>\n\n\n\n<li>\u63d0\u4f9b Docker \u955c\u50cf\uff0c\u90e8\u7f72\u7ef4\u62a4\u6210\u672c\u6781\u4f4e<\/li>\n<\/ul>\n\n\n\n<p>\u5b98\u7f51\u5730\u5740:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">https:\/\/libretranslate.com\/\nhttps:\/\/docs.libretranslate.com\/guides\/installation<\/pre>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>docker\u8fd0\u884c<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u62c9\u53d6Docker\u955c\u50cf:\ndocker pull libretranslate\/libretranslate\n\n\u7136\u540e\u8fd0\u884c\u5bb9\u5668: \ndocker run -ti --rm -p 5000:5000 libretranslate\/libretranslate --load-only zh,en\n<\/pre>\n\n\n\n<p>\u7136\u540e\u5728\u4e3b\u673a\u4e0a\u8bbf\u95ee\u865a\u62df\u673a\u7684Host\u8fde\u63a5\u5730\u5740:\u7ffb\u8bd1\u670d\u52a1\u6620\u5c04\u7684\u7aef\u53e3<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"533\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-5-1024x533.png\" alt=\"\" class=\"wp-image-18642\" style=\"width:510px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-5-1024x533.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-5-300x156.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-5-768x400.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-5-1536x800.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-5-830x432.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-5-230x120.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-5-350x182.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-5-480x250.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-5.png 1594w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u3000<\/p>\n\n\n\n<p>\u51fa\u73b0\u6b64\u754c\u9762,\u5219\u8bf4\u660eDocker\u670d\u52a1\u5b89\u88c5\u5b8c\u6210.\u3000\u9996\u9875\u4e0b\u65b9\u975e\u5e38\u8d34\u5fc3\u5730\u63d0\u793a\u4e86API\u8bf7\u6c42\u7684\u8bed\u6cd5,<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"712\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-6-1024x712.png\" alt=\"\" class=\"wp-image-18645\" style=\"width:550px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-6-1024x712.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-6-300x209.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-6-768x534.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-6-830x577.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-6-230x160.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-6-350x244.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-6-480x334.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-6.png 1374w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p> \u3000<\/p>\n\n\n\n<p><strong>K8s\u90e8\u7f72\u7684\u4f8b\u5b50<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Deployment<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># kubectl apply -f service-libretranslate-deployment.yaml -n common-services\napiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: service-libretranslate-deployment  # Deployment \u540d\u79f0\n  labels:\n    app: service-libretranslate\nspec:\n  replicas: 1  # \u8fd0\u884c 1 \u4e2a\u5bb9\u5668\u5b9e\u4f8b\uff08\u7c7b\u4f3c Docker \u7684\u5355\u5bb9\u5668\uff09\n  selector:\n    matchLabels:\n      app: service-libretranslate\n  template:\n    metadata:\n      labels:\n        app: service-libretranslate\n    spec:\n      containers:\n      - name: libretranslate  # \u5bb9\u5668\u540d\u79f0\uff08\u5bf9\u5e94 Docker \u7684 --name\uff09\n        image: libretranslate\/libretranslate:latest # \u4f7f\u7528 latest \u6807\u7b7e\n        args: [\"--load-only\", \"en,zh\"]  # \u4ec5\u52a0\u8f7d\u82f1\u8bed\u548c\u4e2d\u6587\u6a21\u578b\n        imagePullPolicy: IfNotPresent  # \u672c\u5730\u6709\u955c\u50cf\u5219\u4e0d\u62c9\u53d6\uff0c\u6ca1\u6709\u5219\u62c9\u53d6\n        ports:\n        - containerPort: 5000  # \u5bb9\u5668\u5185\u7684\u7aef\u53e3\uff08\u5bf9\u5e94 Docker \u5bb9\u5668\u5185\u7684 5000\uff09\n        resources:\n          limits:\n            memory: \"2Gi\"\n            cpu: \"500m\"\n        volumeMounts:\n        - name: libretranslate-models  # \u6302\u8f7d\u5377\u7684\u540d\u79f0\uff08\u9700\u4e0e\u4e0b\u9762\u7684 volumes \u5bf9\u5e94\uff09\n          mountPath: \/home\/libretranslate\/.local # \u5bb9\u5668\u5185\u7684\u6302\u8f7d\u8def\u5f84\uff08\u5bf9\u5e94 Docker \u7684 -v \u5bb9\u5668\u5185\u8def\u5f84\uff09\n        - name: libretranslate-apikeys  # \u6302\u8f7d\u5377\u7684\u540d\u79f0\uff08\u9700\u4e0e\u4e0b\u9762\u7684 volumes \u5bf9\u5e94\uff09\n          mountPath: \/app\/db # \u5bb9\u5668\u5185\u7684\u6302\u8f7d\u8def\u5f84\uff08\u5bf9\u5e94 Docker \u7684 -v \u5bb9\u5668\u5185\u8def\u5f84\uff09\n      volumes:\n      - name: libretranslate-models\n        hostPath:\n          path: \/Users\/xxxx\/Documents\/k8s\/pv\/libretranslate\/models  # \u5bbf\u4e3b\u673a\u7684\u8def\u5f84\uff08\u5bf9\u5e94 Docker \u7684 -v \u5bbf\u4e3b\u673a\u8def\u5f84\uff09\n          type: DirectoryOrCreate  # \u82e5\u8def\u5f84\u4e0d\u5b58\u5728\u5219\u81ea\u52a8\u521b\u5efa\n      - name: libretranslate-apikeys\n        hostPath:\n          path: \/Users\/xxxx\/Documents\/k8s\/pv\/libretranslate\/apikeys  # \u5bbf\u4e3b\u673a\u7684\u8def\u5f84\uff08\u5bf9\u5e94 Docker \u7684 -v \u5bbf\u4e3b\u673a\u8def\u5f84\uff09\n          type: DirectoryOrCreate  # \u82e5\u8def\u5f84\u4e0d\u5b58\u5728\u5219\u81ea\u52a8\u521b\u5efa<\/pre>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>service<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># kubectl apply -f libretranslate-service.yaml -n common-services\napiVersion: v1\nkind: Service\nmetadata:\n  name: libretranslate-service\nspec:\n  selector:\n    app: service-libretranslate\n  ports:\n    - protocol: TCP\n      port: 5000        # Service \u7aef\u53e3\n      targetPort: 5000  # \u5bb9\u5668\u7aef\u53e3\n      nodePort: 30500   # \u8282\u70b9\u7aef\u53e3\uff08\u8303\u56f4 30000-32767\uff09\n  type: NodePort        # \u901a\u8fc7\u8282\u70b9 IP:\u7aef\u53e3 \u8bbf\u95ee\u670d\u52a1<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f \u60f3\u7ffb\u8bd1\u4e00\u6bb5\u5185\u5bb9\uff0c\u7ed3\u679c\u7f51\u65ad\u4e86\uff0c\u5728\u7ebf\u7ffb\u8bd1\u9875\u9762\u538b\u6839\u6253\u4e0d\u5f00\uff1f\u7ecf\u5e38\u8981\u7ffb\u8bd1\u5927\u91cf\u5185\u5bb9\uff0c\u8001\u662f\u53d7\u9650\u4e8e\u5b57\u6570\u3001\u8bf7\u6c42\u9891\u7387\uff0c\u751a\u81f3\u5e7f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/18640"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=18640"}],"version-history":[{"count":6,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/18640\/revisions"}],"predecessor-version":[{"id":18648,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/18640\/revisions\/18648"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=18640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=18640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=18640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}