Skip to content

Added multi language guide #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions android/MULTILANGUAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Sendbird AI Agent SDK Localization Guide

This guide explains how to localize the UI strings used in the Sendbird AI Agent SDK for Android to support multiple languages in your application.

---

## Table of Contents

- [Overview](#overview)
- [Default Strings Used by the SDK](#default-strings-used-by-the-sdk)
- [How to Add Translations](#how-to-add-translations)
- [Overriding SDK Strings in Your App](#overriding-sdk-strings-in-your-app)

---

## Overview

Sendbird AI Agent SDK includes a default set of user-facing string resources such as button labels, error messages, input hints, and system texts.
To support internationalization, you can translate these strings into multiple languages using standard Android localization patterns with `strings.xml`.

> **Built-in languages:**
> The SDK currently provides built-in localization for the following languages:
>
> - English (`en`)
> - German (`de`)
> - Spanish (`es`)
> - French (`fr`)
> - Hindi (`hi`)
> - Italian (`it`)
> - Japanese (`ja`)
> - Korean (`ko`)
> - Portuguese (`pt`)
> - Turkish (`tr`)
>
> If you need support for a language that is not listed above, you can customize the SDK strings by following this guide.

---

## Default Strings Used by the SDK

The Sendbird AI Agent SDK uses a predefined set of string keys for user-facing texts such as messages, errors, and labels.

You can download or view the full list of default strings here:

📄 [aiagent_sdk_strings.xml](./res/strings.xml)

Use this file as a reference when creating translations for additional languages.

---

## How to Add Translations

You can add translations for different languages in your Android project using Android Studio’s **Translations Editor**. This tool makes it easy to manage multilingual string resources without manually editing XML files.

### Open Translations Editor
1. In Android Studio, go to `res/values/strings.xml`.
2. Right-click and choose `Open Translations Editor`, or click the 🌐 icon on the file tab.

### Add a New Language
- Click **Globe ➕ Add Locale**
- Choose a language (e.g., Russian `ru`, Japanese `ja`, etc.)
- Click **OK**
- Android Studio will create a folder like `res/values-ru/strings.xml`

---

## Overriding SDK Strings in Your App

If you want to **customize** the SDK's text, override it by redefining the string with the same key in your app's `strings.xml`.

```xml
<!-- res/values-ru/strings.xml -->
<string name="aa_text_dialog_permission_title">Разрешить доступ</string>
<string name="aa_text_go_to_settings">Настройки</string>
<string name="aa_text_need_to_allow_permission_camera">%s
нужен доступ к камере. Перейдите в настройки, чтобы разрешить доступ.</string>
<string name="aa_text_need_to_allow_permission_storage">%s
нужен доступ к памяти устройства. Перейдите в настройки, чтобы разрешить доступ.</string>
<string name="aa_text_need_to_allow_permission_record_audio">%s
нужен доступ к микрофону. Перейдите в настройки, чтобы разрешить доступ.</string>
...
```

> The SDK will prioritize the string from your app over its internal default.

---
63 changes: 63 additions & 0 deletions android/res/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="aa_text_dialog_permission_title">Allow permission</string>
<string name="aa_text_go_to_settings">Settings</string>
<string name="aa_text_need_to_allow_permission_camera">%s\nneeds permission to access your camera. Go to Settings to allow access</string>
<string name="aa_text_need_to_allow_permission_storage">%s\nneeds permission to access your device storage. Go to Settings to allow access.</string>
<string name="aa_text_need_to_allow_permission_record_audio">%s\nneeds permission to access recording audio. Go to Settings to allow access.</string>
<string name="aa_text_error_not_found_aiagent_id">Conversation information is not founded. AI-Agent ID is missing</string>
<string name="aa_text_error_invalid_parameter">Invalid request: Some required parameters are missing or incorrect.</string>
<string name="aa_text_error_file_upload_size_limit">The maximum size per file is %s.</string>
<string name="aa_text_yesterday">Yesterday</string>
<string name="aa_text_no_members">(No members)</string>
<string name="aa_text_no_name">(No name)</string>
<string name="aa_text_information_channel_frozen">Channel is frozen</string>
<string name="aa_text_message_input_hint">Ask a question</string>
<string name="aa_text_message_input_hint_bot_reply">Waiting for the agent\'s reply…</string>
<string name="aa_text_message_input_hint_suggested_replies">Please choose one from above</string>
<string name="aa_text_message_input_hint_unavailable">Chat is unavailable in this channel</string>
<string name="aa_text_button_retry">Retry</string>
<string name="aa_text_error_retry_request">Check your connection and try again.</string>
<string name="aa_text_default_error_status_message">Couldn\&#39;t retrieve channel.</string>
<string name="aa_text_default_empty_status_message">No messages</string>
<string name="aa_text_empty_conversation_status_message">No conversations yet</string>
<string name="aa_text_channel_unknown_type_text">(Unknown message type)\nCannot read this message.</string>
<string name="aa_text_has_no_browser">No browser app found</string>
<string name="aa_text_camera">Camera</string>
<string name="aa_text_photo_library">Photo library</string>
<string name="aa_text_files">Files</string>
<string name="aa_text_orgname">Sendbird</string>
<string name="aa_text_attribution_header">Powered by Sendbird</string>
<string name="aa_text_attribution_header_url">https://sendbird.com/?utm_medium=product&amp;utm_source=aiagent&amp;utm_campaign=fy26-glbl-ai-agent-poweredby</string>
<string name="aa_text_conversation_history">Conversation history</string>
<string name="aa_text_conversation_topic_fallback_message">No category</string>
<string name="aa_text_dialog_delete_message">Delete this message?</string>
<string name="aa_text_button_cancel">Cancel</string>
<string name="aa_text_button_delete">Delete</string>
<string name="aa_text_csat_title">Your feedback matters to us</string>
<string name="aa_text_cre_subtitle">Was your issue resolved?</string>
<string name="aa_text_cre_resolved">Yes, thank you! 👍</string>
<string name="aa_text_cre_not_resolved">No, that didn’t help.</string>
<string name="aa_text_csat_submitted">Successfully submitted!</string>
<string name="aa_text_csat_subtitle">How would you rate your experience?</string>
<string name="aa_text_csat_submit_expired">We’re sorry, the survey period has ended.</string>
<string name="aa_text_start_new_conversation">💬 Start a new conversation</string>
<string name="aa_text_return_to_conversation">💬 Return to conversation</string>
<string name="aa_text_csat_dialog_csat_title_1">Very dissatisfied</string>
<string name="aa_text_csat_dialog_csat_title_2">Dissatisfied</string>
<string name="aa_text_csat_dialog_csat_title_3">Neutral</string>
<string name="aa_text_csat_dialog_csat_title_4">Satisfied</string>
<string name="aa_text_csat_dialog_csat_title_5">Very satisfied</string>
<string name="aa_text_csat_dialog_subtitle">Tell us more about your experience</string>
<string name="aa_text_csat_submit">Submit</string>
<string name="aa_text_csat_dialog_edittext_hint"> Share your feedback</string>
<string name="aa_text_csat_notice_conversation_closed">Your conversation has ended.</string>

<string name="aa_text_relative_time_seconds">%1$d seconds ago</string>
<string name="aa_text_relative_time_minutes">%1$d minutes ago</string>
<string name="aa_text_relative_time_hours">%1$d hours ago</string>
<string name="aa_text_relative_time_days">%1$d days ago</string>
<string name="aa_text_relative_time_weeks">%1$d weeks ago</string>
<string name="aa_text_relative_time_months">%1$d months ago</string>
<string name="aa_text_relative_time_years">%1$d years ago</string>
</resources>