# Language translation

[![](https://img.shields.io/badge/Lv2-Practically_Viable_Pattern-green)](https://github.com/orgs/AI-Native-Development/projects/1/)

## Description

Sometimes, developers may need to translate code from one language to another, such as from Python to JavaScript or HTML to Markdown. This is where GitHub Copilot shines as a virtual aide. Imagine a scenario where a team is working on a multi-platform project, and they need to quickly convert a Python algorithm into JavaScript for web integration. GitHub Copilot's Language Translation ability can save hours of manual translation, enabling seamless cross-language development.

### Example

Here's an example of translating a Python function into JavaScript:

Python code:

```python
def add(a, b):
    return a + b
```

Using GitHub Copilot, we can effortlessly translate it into JavaScript:

```javascript
function add(a, b) {
    return a + b;
}
```

## Exercise

* **Exercise 1**: Translate a simple HTML structure into Markdown using GitHub Copilot.
* **Exercise 2**: Convert a given Python class into its equivalent Java representation.
* **Exercise 3**: Write a C# function and then translate it into Ruby using GitHub Copilot.

## Checklist for Further Learning

* How can GitHub Copilot be further optimized to provide more accurate translations between specific languages?
* What are the limitations, if any, when translating code from one language to another with GitHub Copilot?
* How can I utilize GitHub Copilot in collaborative environments to make cross-language projects more efficient? What are the differences between using GitHub Copilot and GitHub Copilot Chat?


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ai-native-development.gitbook.io/docs/general/language-translation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
