跳转到主要内容

一个Jupyter扩展,可以在应用程序内直接翻译Web界面。

项目描述

jupyterlab_in_context_translation

Github Actions Status Binder

一个Jupyter扩展,使用crowdin in-context在应用程序内直接翻译Web界面。适用于JupyterLab和Notebook。

要求

安装

要安装扩展,执行

pip install jupyterlab_in_context_translation

用法

[!重要] 请确保您已在crowdin上创建账户并加入JupyterLab项目,请参阅要求

  1. 在菜单设置 -> 语言中选择伪语言
  2. 确认以保存并重新加载页面
  3. 在重新加载时,您将被提示选择要将JupyterLab翻译成哪种语言,并登录crowdin
  4. 开始翻译带有红色边框的字符串
    1. 将鼠标悬停在要翻译的字符串上
    2. 单击出现在左上角的编辑按钮
    3. 在对话框中输入翻译
    4. 单击保存按钮
  5. 要禁用此功能,在菜单设置 -> 语言中选择另一种语言

另请参阅说明这些步骤的视频

https://github.com/user-attachments/assets/bfe0e93b-d55c-4b29-a45e-e82f9aad3757

卸载

要卸载扩展,请执行

pip uninstall jupyterlab_in_context_translation

贡献

开发安装

注意:构建扩展包需要NodeJS。

jlpm命令是JupyterLab捆绑的版本yarn,与JupyterLab一起安装。您可以在下面使用yarnnpm代替jlpm

# Clone the repo to your local environment
# Change directory to the jupyterlab_in_context_translation directory
# Install package in development mode
pip install -e "."
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm build

您可以在不同的终端中同时监视源目录并运行JupyterLab,以监视扩展源的变化并自动重新构建扩展。

# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter lab

在监视命令运行时,每次保存的更改都将立即本地构建并可在运行的JupyterLab中使用。刷新JupyterLab以在浏览器中加载更改(您可能需要等待几秒钟以重新构建扩展)。

默认情况下,jlpm build命令为该扩展生成源映射,使其更容易使用浏览器开发者工具进行调试。要为JupyterLab核心扩展也生成源映射,可以运行以下命令

jupyter lab build --minimize=False

开发卸载

pip uninstall jupyterlab_in_context_translation

在开发模式下,还需要删除由jupyter labextension develop命令创建的符号链接。要找到其位置,可以运行jupyter labextension list以确定labextensions文件夹的位置。然后可以删除该文件夹中的名为@jlab-contrib/in-context-translation的符号链接。

测试扩展

前端测试

此扩展使用Jest进行JavaScript代码测试。

要执行它们,请执行

jlpm
jlpm test

集成测试

此扩展使用Playwright进行集成测试(即用户级测试)。更准确地说,JupyterLab助手Galata用于在JupyterLab中测试扩展。

有关更多信息,请参阅ui-tests的README。

打包扩展

RELEASE

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

jupyterlab_in_context_translation-1.0.0.tar.gz (1.5 MB 查看散列)

上传时间

构建分布

jupyterlab_in_context_translation-1.0.0-py3-none-any.whl (45.5 kB 查看散列)

上传时间 Python 3

由以下赞助

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面