Skip to content

🌍 Gradle plugin that generates Android string resources from Notion database with 35+ languages support

License

Notifications You must be signed in to change notification settings

lyh990517/android-notion-string-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

51 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌍 Notion Stringboard Plugin

A powerful Gradle plugin that automatically generates Android string resources from your Notion database with advanced filtering and multi-language support.

✨ Features

  • 🌐 Multi-language support: Generate string resources for 35+ languages
  • πŸ”„ Automated sync: Fetch translations directly from Notion database
  • πŸ“± Android optimized: Generates proper Android XML string resources
  • πŸ—οΈ Build integration: Seamlessly integrates with your Gradle build process
  • 🎯 Advanced filtering: Use complex queries to filter your Notion data
  • πŸ“Š Sorting options: Sort by properties, timestamps, and custom criteria

πŸš€ Quick Setup

1️⃣ Apply the plugin

In your build.gradle.kts (Module level):

plugins {
    id("io.github.lyh990517.notion-stringboard") version "1.0.2"
}

2️⃣ Configure the plugin

stringboard {
    // Required: Your Notion credentials
    notionApiKey = "your_notion_integration_token"
    dataSourceId = "your_notion_datasource_id"

    // Required: Output directory for generated resources
    outputDir = "${project.rootDir}/app/src/main/res"

    // Required: Column name in Notion that contains Android string resource IDs (e.g., "resource_id_1", "project_a_home_1")
    idPropertyName = "Resource ID"

    // Required: Define your supported languages
    languages = listOf(
        Language.English("String: BASE"),
        Language.Korean("String: KOR"), 
        Language.Japanese("String: JPN")
    )

    // Optional: Advanced filtering and sorting (if not specified, all data from the database will be fetched)
    queryBuilder = NotionQueryBuilder()
        .filter {
            richText { "String: BASE" contains "hello" } and
            select { "Status" equals "Published" }
        }
        .sort {
            property { "Resource ID" by Direction.ASCENDING }
        }
}

3️⃣ Set up Your Notion Database

Create a Notion database with these columns:

πŸ“‹ Reference: Sample database template

Column Name Type Purpose
Resource ID Title Android string resource name
String: BASE Rich Text English/default text
String: KOR Rich Text Korean translation
String: JPN Rich Text Japanese translation
Status Select Publication status

Example data:

Resource ID String: BASE String: KOR String: JPN Status
hello_world Hello World! μ•ˆλ…•ν•˜μ„Έμš”! こんにけは! Published
welcome_msg Welcome ν™˜μ˜ν•©λ‹ˆλ‹€ γ‚ˆγ†γ“γ Published
πŸ“Έ Database Screenshot μŠ€ν¬λ¦°μƒ· 2025-09-05 μ˜€ν›„ 1 28 43

βš™οΈ Advanced Configuration

🌐 Extended Language Support

The plugin supports 35+ languages. Add any combination:

languages = listOf(
    // Asian Languages
    Language.Korean("String: KOR"),
    Language.Japanese("String: JPN"), 
    Language.ChiSimplified("String: CHS"),
    Language.ChiTraditional("String: CHT"),
    Language.Thai("String: THA"),
    Language.Vietnamese("String: VIE"),
    
    // European Languages  
    Language.English("String: BASE"),
    Language.Spanish("String: SPA"),
    Language.French("String: FRA"),
    Language.German("String: DEU"),
    Language.Italian("String: ITA"),
    Language.Portuguese("String: POR"),
    Language.Dutch("String: NLD"),
    Language.Russian("String: RUS"),
    
    // And many more...
)
🎯 Advanced Filtering & Sorting

Use the powerful query builder to filter your data:

queryBuilder = NotionQueryBuilder()
    .filter {
        // Text filters
        richText { "String: BASE" contains "welcome" } and
        richText { "String: KOR".isNotEmpty } and
        
        // Select/Multi-select filters  
        select { "Status" equals "Published" } and
        multiSelect { "Tags" contains "Mobile" } and
        
        // Boolean filters
        checkBox { "Deprecated" equals false } or
        
        // Combine with OR
        (select { "Priority" equals "High" } or 
         select { "Priority" equals "Medium" })
    }
    .sort {
        // Sort by properties
        property { "Resource ID" by Direction.ASCENDING }
        property { "Priority" by Direction.DESCENDING }
        
        // Sort by timestamps
        timestamp { Timestamp.CREATED_TIME by Direction.DESCENDING }
        timestamp { Timestamp.LAST_EDITED_TIME by Direction.ASCENDING }
    }

πŸ”‘ Getting Notion Credentials

Create Integration & Get Credentials

  1. Go to πŸ”— Notion Integrations
  2. Click "New integration", name it and select your workspace
  3. Copy the "Internal Integration Token"
  4. Open your Notion database and copy the datasource ID:
πŸ“Έ See screenshot μŠ€ν¬λ¦°μƒ· 2025-09-05 μ˜€μ „ 11 58 46

Secure Storage

Add to your local.properties:

NOTION_API_KEY=your_integration_token_here
DATA_SOURCE_ID=your_database_id_here

Then use in build.gradle.kts:

val localProperties = Properties().apply {
    load(rootProject.file("local.properties").inputStream())
}

stringboard {
    notionApiKey = localProperties.getProperty("NOTION_API_KEY")
    dataSourceId = localProperties.getProperty("DATA_SOURCE_ID")
    // ... other config
}

🎯 Usage

Generate String Resources

./gradlew fetchStringboard

This generates:

  • πŸ‡ΊπŸ‡Έ values/strings.xml (English)
  • πŸ‡°πŸ‡· values-ko/strings.xml (Korean)
  • πŸ‡―πŸ‡΅ values-ja/strings.xml (Japanese)
  • 🌍 And all other configured languages...

🌐 Supported Languages

View all 35+ supported languages
Region Languages
🌏 Asian Korean (ko), Japanese (ja), Chinese Simplified (zh-rCN), Chinese Traditional (zh-rTW), Thai (th), Vietnamese (vi), Hindi (hi), Indonesian (id), Malay (ms), Filipino (fil)
🌍 European English (default), Spanish (es), French (fr), German (de), Italian (it), Portuguese (pt), Dutch (nl), Russian (ru), Polish (pl), Czech (cs), Hungarian (hu), Romanian (ro), Croatian (hr), Serbian (sr), Bulgarian (bg), Greek (el), Swedish (sv), Norwegian (no), Danish (da), Finnish (fi), Ukrainian (uk)
🌎 Others Arabic (ar), Hebrew (iw), Turkish (tr), Persian (fa), Swahili (sw), Bengali (bn), Tamil (ta), Telugu (te), Gujarati (gu), Marathi (mr), Punjabi (pa), Urdu (ur)

πŸ“‹ Requirements

  • βœ… Android Gradle Plugin 7.0+
  • βœ… Gradle 7.0+
  • βœ… Java/Kotlin 17+
  • βœ… Active Notion workspace and database

🀝 Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


ℹ️ Information

  • Notion API version: 2025-09-03

πŸ”— Links


Made with ❀️ for Android developers who love automation

⭐ Star this repo if it helped you! ⭐

About

🌍 Gradle plugin that generates Android string resources from Notion database with 35+ languages support

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages