PowerPoint Translator is a Streamlit application that uses the official OpenAI Python SDK 1.x to translate text in a PowerPoint presentation into Traditional Chinese. This version connects to Azure OpenAI by using Microsoft Entra ID authentication.
This codebase is currently tested against an Azure OpenAI Service deployment based on the gpt-5-mini model.
To run this script, you'll need the following:
-
Python 3.11 or higher
-
openaiPython package (version 1.109.1 or higher) -
azure-identityPython package (version 1.17.1 or higher) -
python-pptxPython package (version 1.0.2 or higher) -
streamlitPython package (version 1.39.0 or higher) -
An Azure OpenAI resource with a deployed chat model
-
A Microsoft Entra identity that can access that Azure OpenAI resource
- Clone or download the PowerPoint Translator repository to your local machine.
- Install the required Python packages by running
python -m pip install -r requirements.txt.
If you prefer a global Python environment, install the dependencies into that exact interpreter. For example:
python.exe -m pip install -r requirements.txtThis project uses python-dotenv, so you can place the required environment variables in a .env file in the same folder as main.py.
- Sign in with an identity that can access the Azure OpenAI resource.
For local development, Azure CLI is the simplest option:
az login-
Make sure the signed-in identity has the
Cognitive Services OpenAI Userrole on the target Azure OpenAI resource. -
Configure the application with the Azure OpenAI endpoint and deployment name.
Example:
OPENAI_MODEL=<your deployment name>
OPENAI_BASE_URL=https://<your-resource-name>.openai.azure.com/openai/v1/For example, if you created an Azure OpenAI deployment for gpt-5-mini, set OPENAI_MODEL to that deployment name. It only needs to be the literal string gpt-5-mini if that is the deployment name you chose.
You can also keep using:
OPENAI_ENDPOINT=https://<your-resource-name>.openai.azure.com/When OPENAI_ENDPOINT is set, the app automatically converts it to the Azure OpenAI v1 base_url format.
Notes:
OPENAI_MODELis required. For Azure OpenAI, this value must be your deployment name.OPENAI_BASE_URLis required unless you provideOPENAI_ENDPOINTinstead.OPENAI_API_VERSIONis not required for Azure OpenAI v1 and is ignored by this app.OPENAI_API_KEYis not used in this version because authentication is handled by Microsoft Entra ID.DefaultAzureCredentialcan use Azure CLI sign-in, environment-based service principal credentials, managed identity, shared token cache, or interactive browser sign-in.
- Open a terminal and change to the project directory.
- Start the app with the same Python interpreter that has the dependencies installed.
For a global Python environment:
python.exe -m streamlit run main.pyDo not rely on streamlit run main.py by itself unless you are sure that streamlit on your PATH belongs to the same Python installation.
- Upload the PowerPoint file you want to translate.
- Optionally fill in
Optional slide context and translation notesto describe the deck's topic, terminology, or translation constraints. The app adds this text to the system prompt for every translation request. - Optionally fill in
Optional terminology glossarywith one term per line usingsource => target. Matching source terms are forced to the target translation across the deck. - Review
Suggested glossary candidatesto see repeated English terms extracted from the uploaded deck. Select any terms you want to preserve first, then clickAdd selected terms to glossaryto appendsource => sourcedraft entries that you can edit. - Click
Check Entra sign-inbefore translation. If this machine doesn't already have a cached Microsoft Entra sign-in, the app can open your default browser so you can sign in first. - Review the
Microsoft Entra Statuspanel. It shows whether sign-in is ready, whether a browser prompt is expected, whether translation is currently enabled, and what to do next. - Click
Translate PowerPointafter you finish reviewing the glossary and the Entra sign-in check succeeds. The app will show a progress bar while it processes the presentation. - Click
Downloadto save the translated PowerPoint file.
Notes:
- If the same source string appears multiple times in the same upload, the app translates that exact string once and reuses the result across the deck. This improves consistency for repeated sentences and reduces duplicate model calls.
- Glossary entries are applied after the model returns, so terms such as product names or domain-specific phrases keep the exact target translation you specify.
- Suggested glossary candidates are heuristic English term matches based on repeated text in the deck. Review them before adding them to the glossary.
Check Entra sign-inverifies that the app can acquire a Microsoft Entra ID token before translation starts. Azure OpenAI RBAC permissions are still enforced when the translation request is sent.