Azure / co-op-translator

Easily automate multilingual translations for your projects with co-op-translator, powered by advanced LLM technology and Azure AI Services.

Home Page:https://techcommunity.microsoft.com/t5/educator-developer-blog/automate-markdown-and-image-translations-using-co-op-translator/ba-p/4263474

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Co Op Translator

Easily automate multilingual translations for your projects with co-op-translator, powered by advanced LLM technology and Azure AI Services.

Python package License: MIT Downloads Downloads

GitHub contributors GitHub issues GitHub pull-requests PRs Welcome

GitHub watchers GitHub forks GitHub stars

Open in GitHub Codespaces Open in Dev Containers

Overview

Co Op Translator is a tool designed to automate multilingual translations for various projects using advanced Large Language Model (LLM) technology and Azure AI Services. This project aims to simplify the process of translating content into multiple languages, making it accessible and efficient for developers.

Here is an architecture of Co Op Translator.

Architecture

The process begins with markdown and image files from your project folder, which are then processed by Azure AI Services. Azure OpenAI handles text translations from the markdown files, while Azure Computer Vision extracts text from the images. Once the text is extracted, Azure OpenAI translates the text from the images. The final translated files—both markdown and images—are saved in the designated translation folder, ready for use in multiple languages.

Python package

Co Op Translator Python package designed to automate multilingual translations across all files in your project. Powered by advanced Language Learning Models (LLMs), it simplifies the localization process by providing accurate and efficient translations.

Co Op Translator scans all your project files and translates all markdown documents and even text within images found in your folders. This comprehensive approach ensures that every part of your project is accessible to a global audience.

By integrating Co Op Translator into your workflow, you can:

  • Automate Translations: Easily translate text in your project files into multiple languages.
  • Comprehensive Coverage: Translate all markdown files and text within images in your project directories.
  • Advanced LLM Technology: Utilize cutting-edge language models for high-quality translations.
  • Simplify Localization: Streamline the process of localizing your project for international markets.
  • Easy Integration: Seamlessly integrate with your existing project setup.

Co Op Translator empowers developers to focus on core functionalities while effortlessly managing multilingual support.

Here is an example of how Co Op Translator can be used to translate text in images and markdown files in your project:

Example

Key features

  • Multilingual Translation: Supports translation into multiple languages, leveraging the power of LLMs.
  • Automation: Automates the translation process, reducing manual effort and increasing consistency.
  • Integration: Easily integrates with existing projects, providing a seamless translation experience.

Repository structure

  • data/: Contains data files.
  • notebooks/: Jupyter notebooks for examples and tutorials.
  • src/co_op_translator/: Source code for the translator.
  • tests/: Test cases for the project.

Getting started with Co Op Translator

Prerequisites

  • Azure Computer vision resource
  • Azure OpenAI resource
  • Python 3.10 or higher

Quick install

Install Co Op Translator via pip

pip install co-op-translator

Install Co Op Translator via poetry

poetry add co-op-translator

How to use Co Op Translator

  1. Set up Azure resources before starting
  2. Create an '.env' file in the root directory
  3. Install the Co Op translator package
  4. Use Co Op translator in your project

Sample notebooks (update in progress)

Supported languages

The table below lists the languages currently supported by Co Op Translator. It includes language codes, language names, and any known issues associated with each language. If you would like to add support for a new language, please add the corresponding language code, name, and appropriate font in the font_language_mappings.yml file located at src/co_op_translator/fonts/ and submit a pull request after testing.

Language Code Language Name Font RTL Support Known Issues
en English NotoSans-Medium.ttf No No
fr French NotoSans-Medium.ttf No No
es Spanish NotoSans-Medium.ttf No No
de German NotoSans-Medium.ttf No No
ru Russian NotoSans-Medium.ttf No No
ar Arabic NotoSansArabic-Medium.ttf Yes Yes
fa Persian (Farsi) NotoSansArabic-Medium.ttf Yes Yes
ur Urdu NotoSansArabic-Medium.ttf Yes Yes
zh Chinese (Simplified) NotoSansCJK-Medium.ttc No No
mo Chinese (Traditional) NotoSansCJK-Medium.ttc No No
hk Chinese (Traditional) NotoSansCJK-Medium.ttc No No
tw Chinese (Traditional) NotoSansCJK-Medium.ttc No No
ja Japanese NotoSansCJK-Medium.ttc No No
ko Korean NotoSansCJK-Medium.ttc No No
hi Hindi NotoSansDevanagari-Medium.ttf No No
bn Bengali NotoSansBengali-Medium.ttf No No
mr Marathi NotoSansDevanagari-Medium.ttf No No
ne Nepali NotoSansDevanagari-Medium.ttf No No
pa Punjabi (Gurmukhi) NotoSansGurmukhi-Medium.ttf No No
pt Portuguese NotoSans-Medium.ttf No No
it Italian NotoSans-Medium.ttf No No
pl Polish NotoSans-Medium.ttf No No
tr Turkish NotoSans-Medium.ttf No No
el Greek NotoSans-Medium.ttf No No
th Thai NotoSansThai-Medium.ttf No No
sv Swedish NotoSans-Medium.ttf No No
da Danish NotoSans-Medium.ttf No No
no Norwegian NotoSans-Medium.ttf No No
fi Finnish NotoSans-Medium.ttf No No
nl Dutch NotoSans-Medium.ttf No No
he Hebrew NotoSansHebrew-Medium.ttf Yes No
vi Vietnamese NotoSans-Medium.ttf No No
id Indonesian NotoSans-Medium.ttf No No
ms Malay NotoSans-Medium.ttf No No
tl Tagalog (Filipino) NotoSans-Medium.ttf No No
sw Swahili NotoSans-Medium.ttf No No
hu Hungarian NotoSans-Medium.ttf No No
cs Czech NotoSans-Medium.ttf No No
sk Slovak NotoSans-Medium.ttf No No
ro Romanian NotoSans-Medium.ttf No No
bg Bulgarian NotoSans-Medium.ttf No No
sr Serbian (Cyrillic) NotoSans-Medium.ttf No No
hr Croatian NotoSans-Medium.ttf No No
sl Slovenian NotoSans-Medium.ttf No No

Adding a new language

To add support for a new language:

  1. Go to src/co_op_translator/fonts/font_language_mappings.yml.
  2. Add the language code, name, and appropriate font file name. Make sure to include the rtl attribute if the language is right-to-left.
  3. If you need to use a new font, ensure that the font is free to use in open-source projects by checking its licensing and copyright terms. After verifying, add the font file to the src/co_op_translator/fonts/ directory.
  4. Test your changes locally to ensure that the new language is properly supported.
  5. Submit a Pull Request with your changes and indicate the addition of the new language in the PR description.

Example:

new_lang:
  name: "New Language"
  font: "NotoSans-Medium.ttf"
  rtl: false

Contributing

This project welcomes contributions and suggestions. Interested in contributing to Azure Co Op Translator? Please see our CONTRIBUTING.md for guidelines on how you can help make Co Op Translator more accessible.

Contributors

co-op-translator contributors

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Responsible AI

Microsoft is committed to helping our customers use our AI products responsibly, sharing our learnings, and building trust-based partnerships through tools like Transparency Notes and Impact Assessments. Many of these resources can be found at https://aka.ms/RAI. Microsoft’s approach to responsible AI is grounded in our AI principles of fairness, reliability and safety, privacy and security, inclusiveness, transparency, and accountability.

Large-scale natural language, image, and speech models - like the ones used in this sample - can potentially behave in ways that are unfair, unreliable, or offensive, in turn causing harms. Please consult the Azure OpenAI service Transparency note to be informed about risks and limitations.

The recommended approach to mitigating these risks is to include a safety system in your architecture that can detect and prevent harmful behavior. Azure AI Content Safety provides an independent layer of protection, able to detect harmful user-generated and AI-generated content in applications and services. Azure AI Content Safety includes text and image APIs that allow you to detect material that is harmful. We also have an interactive Content Safety Studio that allows you to view, explore and try out sample code for detecting harmful content across different modalities. The following quickstart documentation guides you through making requests to the service.

Another aspect to take into account is the overall application performance. With multi-modal and multi-models applications, we consider performance to mean that the system performs as you and your users expect, including not generating harmful outputs. It's important to assess the performance of your overall application using generation quality and risk and safety metrics.

You can evaluate your AI application in your development environment using the prompt flow SDK. Given either a test dataset or a target, your generative AI application generations are quantitatively measured with built-in evaluators or custom evaluators of your choice. To get started with the prompt flow sdk to evaluate your system, you can follow the quickstart guide. Once you execute an evaluation run, you can visualize the results in Azure AI Studio.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

About

Easily automate multilingual translations for your projects with co-op-translator, powered by advanced LLM technology and Azure AI Services.

https://techcommunity.microsoft.com/t5/educator-developer-blog/automate-markdown-and-image-translations-using-co-op-translator/ba-p/4263474

License:MIT License


Languages

Language:Python 99.9%Language:Shell 0.1%