一个Jupyter扩展,可以在应用程序内直接翻译Web界面。
项目描述
jupyterlab_in_context_translation
一个Jupyter扩展,使用crowdin in-context在应用程序内直接翻译Web界面。适用于JupyterLab和Notebook。
要求
- 一个免费的crowdin账户
- 然后加入JupyterLab项目
- JupyterLab >= 4.0.0或Notebook >= 7.0.0
安装
要安装扩展,执行
pip install jupyterlab_in_context_translation
用法
[!重要] 请确保您已在crowdin上创建账户并加入JupyterLab项目,请参阅要求。
- 在菜单设置 -> 语言中选择伪语言
- 确认以保存并重新加载页面
- 在重新加载时,您将被提示选择要将JupyterLab翻译成哪种语言,并登录crowdin
- 开始翻译带有红色边框的字符串
- 将鼠标悬停在要翻译的字符串上
- 单击出现在左上角的编辑按钮
- 在对话框中输入翻译
- 单击保存按钮
- 要禁用此功能,在菜单设置 -> 语言中选择另一种语言
另请参阅说明这些步骤的视频。
https://github.com/user-attachments/assets/bfe0e93b-d55c-4b29-a45e-e82f9aad3757
卸载
要卸载扩展,请执行
pip uninstall jupyterlab_in_context_translation
贡献
开发安装
注意:构建扩展包需要NodeJS。
jlpm
命令是JupyterLab捆绑的版本yarn,与JupyterLab一起安装。您可以在下面使用yarn
或npm
代替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。
打包扩展
项目详情
jupyterlab_in_context_translation-1.0.0.tar.gz的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | 253c986ad80b1fbd125fe0e4d3ee5041fefb8c26742de6c954bfa18527cb010c |
|
MD5 | c65124d1ca34e1e7d6155748a38ec6d6 |
|
BLAKE2b-256 | c44d3946a8d1a0877b7ae7b532da93bc79bebc64db1d9db052c919e3631cc02a |
jupyterlab_in_context_translation-1.0.0-py3-none-any.whl的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | fd8b38be216f94bbfed00649cce8ceade62fd3cbfbcd4a2497d64230d40ca09c |
|
MD5 | 7d52e982023fc5a61224e4459b31940e |
|
BLAKE2b-256 | 017d6ee653e00a54a3d7fe7123fff8e74cb305ad553ba161f335dbe8b81aa545 |