-
-
Notifications
You must be signed in to change notification settings - Fork 38
docs: expand Android SDK overview with detailed features and benefits #1005
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
base: main
Are you sure you want to change the base?
Changes from all commits
3a4ca66
74c73b1
4a88a73
4a92aed
c33fdc4
456ff63
acfed4b
014eb1e
a2a4e66
210e7e7
52a26aa
373e446
2101cc0
f8692ca
c0698b1
9832ed8
35c69d6
19b97aa
3e8c730
d02a215
3c2bac9
1360b08
114018f
d201ffe
d24b262
922ecb3
373a55e
5c7646c
7156091
15ee967
79d9da6
3938f0f
13c7790
ba8e6c9
62a5e7f
2ddb624
e44e60d
d19c5f1
c2c4c3f
29033ce
5b6bb9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
--- | ||
id: example-apps | ||
title: Example Apps | ||
slug: /example-apps | ||
description: Example apps for Tolgee Android SDK with Over‑the‑Air (OTA) localization updates for Android and Compose Multiplatform. | ||
--- | ||
|
||
import { ScreenshotWrapper } from '../platform/shared/_ScreenshotWrapper'; | ||
|
||
# Example Apps | ||
|
||
Explore fully functional demo applications showcasing Tolgee Android SDK integration. Each example demonstrates best practices for implementing Over-the-Air translation updates in different Android development environments. | ||
|
||
<ScreenshotWrapper | ||
src="/img/docs/sdk/android-studio.png" | ||
alt="Android Studio" | ||
/> | ||
|
||
## Android Views Demo | ||
|
||
**Perfect for traditional Android development** | ||
|
||
A complete reference implementation using classic Android Views and XML layouts. This example demonstrates: | ||
|
||
- ✅ One-time and dynamic translation methods | ||
- ✅ Locale switching and change detection | ||
- ✅ Integration with Android string resources | ||
- ✅ Parameter support for dynamic content | ||
- ✅ Proper Application-level initialization | ||
|
||
**[View Android Views Example →](https://github.com/tolgee/tolgee-mobile-kotlin-sdk/tree/master/demo/exampleandroid)** | ||
|
||
--- | ||
|
||
## Jetpack Compose Demo | ||
|
||
**Modern declarative UI with reactive translations** | ||
|
||
A comprehensive example showcasing Tolgee integration with Jetpack Compose. Features include: | ||
|
||
- ✅ `stringResource()` composables for direct translation | ||
- ✅ Parameter support for dynamic content | ||
- ✅ Reactive UI updates when locale changes | ||
- ✅ Formatter configuration options | ||
- ✅ Integration with Compose state system | ||
|
||
**[View Jetpack Compose Example →](https://github.com/tolgee/tolgee-mobile-kotlin-sdk/tree/master/demo/examplejetpack)** | ||
|
||
--- | ||
|
||
## Compose Multiplatform Demo | ||
|
||
**Cross-platform translations for Android, iOS, and Desktop** | ||
|
||
A full-featured multiplatform application demonstrating Tolgee's Kotlin Multiplatform capabilities: | ||
|
||
- ✅ Shared translation logic across platforms | ||
- ✅ Compose Multiplatform UI integration | ||
- ✅ Cross-platform resource handling | ||
- ✅ Common API for all supported platforms | ||
- ✅ Multiplatform development patterns | ||
|
||
**[View Compose Multiplatform Example →](https://github.com/tolgee/tolgee-mobile-kotlin-sdk/tree/master/demo/examplecomposemultiplatform)** | ||
|
||
--- | ||
|
||
## Getting Started with Examples | ||
|
||
1. **Clone the repository**: | ||
|
||
```bash | ||
git clone https://github.com/tolgee/tolgee-mobile-kotlin-sdk.git | ||
``` | ||
2. **Navigate to the demo folder**: Choose the example that matches your tech stack | ||
3. **Open in Android Studio**: Import the project and sync Gradle | ||
4. **Configure your CDN URL**: Add your Tolgee project's CDN URL in the initialization code | ||
5. **Run and explore**: See live translation updates in action | ||
|
||
:::tip | ||
These examples are actively maintained and updated with each SDK release. They're the best way to learn Tolgee integration patterns and troubleshoot issues. | ||
::: | ||
|
||
## Next Steps | ||
|
||
- **New to Tolgee?** Start with [Installation](./installation) | ||
- **Need help?** Check [Troubleshooting](./troubleshooting) | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,48 +1,71 @@ | ||||||
--- | ||||||
id: installation | ||||||
title: Installation | ||||||
description: How to install Tolgee Android SDK in your Android project | ||||||
description: Installation guide for Tolgee Android SDK | ||||||
--- | ||||||
|
||||||
> **NOTE:** | ||||||
> For managing static translations, we recommend using [Tolgee CLI](https://github.com/tolgee/tolgee-cli). | ||||||
import AndroidApiRequirement from '@site/src/component/AndroidApiRequirement'; | ||||||
import Tabs from '@theme/Tabs'; | ||||||
import TabItem from '@theme/TabItem'; | ||||||
|
||||||
:::note | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if we need to include this. What do you think @Anty0 ? |
||||||
Configuration examples below are written in Kotlin DSL. Groovy DSL should work but is not officially supported/tested. | ||||||
::: | ||||||
|
||||||
## Requirements | ||||||
|
||||||
- **Android API Level**: 21+ (Android 5.0+) | ||||||
<AndroidApiRequirement /> | ||||||
|
||||||
## Quickstart (Views) | ||||||
## Setup dependencies | ||||||
|
||||||
1. Add dependency (Core): | ||||||
To use the library, you need to add the dependency to your project. | ||||||
|
||||||
Using Version Catalog is recommended to keep your versions aligned. | ||||||
In `gradle/libs.versions.toml` add an alias for Tolgee Core library: | ||||||
|
||||||
```toml | ||||||
# gradle/libs.versions.toml | ||||||
[libraries] | ||||||
tolgee = { group = "io.tolgee.mobile-kotlin-sdk", name = "core", version.ref = "tolgee" } | ||||||
``` | ||||||
:::info | ||||||
Using **Version Catalog** is recommended to keep your versions aligned, especially in bigger projects. | ||||||
This **provides readability, centralization, and consistency**. | ||||||
::: | ||||||
|
||||||
```kotlin | ||||||
// build.gradle.kts (module) | ||||||
dependencies { | ||||||
implementation(libs.tolgee) | ||||||
} | ||||||
``` | ||||||
<Tabs | ||||||
defaultValue="core" | ||||||
values={[ | ||||||
{label: 'Core (Android Views)', value: 'core'}, | ||||||
{label: 'Compose (Jetpack/Multiplatform)', value: 'compose'}, | ||||||
]}> | ||||||
<TabItem value="core"> | ||||||
```toml | ||||||
[libraries] | ||||||
tolgee = { group = "io.tolgee.mobile-kotlin-sdk", name = "core", version.ref = "tolgee" } | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about the version ref @Anty0 ? Usually in the docs there is the latest version mentioned. I don't think I have ever seen version ref like this. |
||||||
``` | ||||||
</TabItem> | ||||||
<TabItem value="compose"> | ||||||
```toml | ||||||
[libraries] | ||||||
tolgee = { group = "io.tolgee.mobile-kotlin-sdk", name = "compose", version.ref = "tolgee" } | ||||||
``` | ||||||
</TabItem> | ||||||
</Tabs> | ||||||
|
||||||
If you use Jetpack Compose, see the Compose variant: [Jetpack Installation](/android-sdk/jetpack/installation) | ||||||
|
||||||
2. (If needed) Ensure repositories include Maven Central: | ||||||
Then, in `build.gradle.kts`, use the created alias: | ||||||
|
||||||
```kotlin | ||||||
// settings.gradle.kts or build.gradle.kts | ||||||
pluginManagement { repositories { gradlePluginPortal(); google(); mavenCentral() } } | ||||||
dependencyResolutionManagement { repositories { google(); mavenCentral() } } | ||||||
``` | ||||||
|
||||||
3. Allow CDN networking (required when using Tolgee Cloud CDN): | ||||||
```kotlin | ||||||
dependencies { | ||||||
implementation(libs.tolgee) | ||||||
} | ||||||
``` | ||||||
|
||||||
Create a network security config file `network_security.xml` in your `res/xml` folder: | ||||||
:::info | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would remove this as I don't think this would be a trouble for anyone. They will just simply copy paste it. |
||||||
The Compose module includes Core transitively, so you don't need to add both. | ||||||
::: | ||||||
|
||||||
## Network Configuration | ||||||
|
||||||
Enable Tolgee to fetch translations from the cloud at runtime. To do this, you need to configure network access. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again. We don't communicate in imperative in the docs, instead we use indicative. Please reread the whole docs and fix it everywhere.
Suggested change
|
||||||
|
||||||
Create a network security config file `network_security.xml` in your `res/xml` folder: | ||||||
|
||||||
```xml | ||||||
<?xml version="1.0" encoding="utf-8"?> | ||||||
|
@@ -54,53 +77,23 @@ description: How to install Tolgee Android SDK in your Android project | |||||
</network-security-config> | ||||||
``` | ||||||
|
||||||
In Android, the network security config must be explicitly linked in your `AndroidManifest.xml`, so the system knows to apply it. | ||||||
|
||||||
Add network security config to your `AndroidManifest.xml`: | ||||||
|
||||||
```xml | ||||||
<application | ||||||
android:networkSecurityConfig="@xml/network_security"> <!-- Add this line to your existing application tag --> | ||||||
android:networkSecurityConfig="@xml/network_security"> <!-- Add this line to your existing application tag --> | ||||||
</application> | ||||||
``` | ||||||
|
||||||
> NOTE: | ||||||
> Allowing `tolgee.io` and `tolg.ee` domains is required when using Tolgee Cloud CDN. If you only access your own self-hosted CDN, include your domain(s) accordingly. | ||||||
|
||||||
## Initialization and configuration | ||||||
|
||||||
Initialize Tolgee in your `Application` class. | ||||||
|
||||||
```kotlin | ||||||
class MyApplication : Application() { | ||||||
override fun onCreate() { | ||||||
super.onCreate() | ||||||
Tolgee.init { | ||||||
contentDelivery { | ||||||
url = "https://cdn.tolg.ee/your-cdn-url-prefix" // from Tolgee Platform → Content Delivery | ||||||
storage = TolgeeStorageProviderAndroid(this@MyApplication, BuildConfig.VERSION_CODE) // cache invalidates on app update | ||||||
} | ||||||
} | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
How to get your CDN URL prefix (Content Delivery): | ||||||
- Open Tolgee Platform → your Project → Developer settings → Content Delivery. | ||||||
- Copy the full CDN URL prefix. You can use different prefixes per environment (dev/staging/prod). | ||||||
- Optional: Verify connectivity locally: | ||||||
|
||||||
```bash | ||||||
curl -I "https://cdn.tolg.ee/your-cdn-url-prefix/en.json" | ||||||
``` | ||||||
|
||||||
You should receive a 200 response. If you get 403/404, double‑check the prefix. | ||||||
|
||||||
> TIP: | ||||||
> For Activities, wrap the base context so `getString` and similar APIs use Tolgee. See step-by-step in [Usage](./usage.mdx). | ||||||
|
||||||
## Next steps | ||||||
:::info | ||||||
Allowing `tolgee.io` and `tolg.ee` domains is required when using Tolgee Cloud CDN. | ||||||
If you access your own self-hosted CDN, here is where you should add the domain of your CDN. | ||||||
::: | ||||||
|
||||||
- Not sure which artifact to use? See [`Modules overview`](./modules.mdx) | ||||||
- Learn how to fetch and render translations in Views: [`Usage`](./usage.mdx) | ||||||
- Using Compose? Start here: [`Jetpack Installation`](./jetpack/installation.mdx) | ||||||
- Having issues? Check [`Troubleshooting`](./troubleshooting.mdx) | ||||||
## Next Steps | ||||||
|
||||||
- Setup Tolgee Android SDK: [Setup](./setup.mdx) | ||||||
- Learn how to fetch and render translations in Views: [Usage](./usage.mdx) | ||||||
- Having issues? Check [Troubleshooting](./troubleshooting.mdx) |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can merge the installation and setup pages. I am not sure why for example the
Network Configuration
goes to installation, but not to the setup.