npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@testncfpkg/ncf-weblate-cf-front

v1.0.1

Published

Kotlin Multiplatform resource library for managing localized strings across Android, iOS, and Web

Readme

NCF Weblate CF Front

A Kotlin Multiplatform (KMP) resource-only library for managing localized strings across Android, iOS, and Web platforms.

Features

  • Resource-only KMP library with no platform-specific code
  • Multi-language support using Moko Resources
  • Organized by feature modules:
    • Foundation
    • UI
    • Content
    • Checkout
    • Customer
    • Bag
    • Order
  • Ready for Maven publishing
  • Weblate integration ready
  • Two consumption patterns: Moko Resources (StringResource) and generated String values

Setup

Gradle

dependencies {
    implementation("com.ncf.weblate:ncf-weblate-cf-front:1.0.0")
}

Usage

This library provides two ways to access localized strings:

  1. Generated Strings.kt - Direct String values (recommended for most cases)
  2. Moko Resources - StringResource objects (for platform integration)

Generated Strings.kt (Recommended)

The library generates locale-specific Strings.kt files with actual string values:

stringResources/
├── base/
│   └── {feature}/Strings.kt
├── ptBR/
│   └── {feature}/Strings.kt
├── esAR/
│   └── {feature}/Strings.kt
└── ...

Android (Kotlin/Compose)

import com.ncf.weblate.stringResources.base.bag.BagStrings

// Simple strings
val title: String = BagStrings.bagTitle
val empty: String = BagStrings.bagEmpty

// Usage in Compose
Text(text = BagStrings.bagTitle)

// Plurals
val itemsText = BagStrings.bagItemsCount.get(itemCount)
Text(text = String.format(itemsText, itemCount))

iOS (Swift)

After building the framework, access the strings through the generated Kotlin objects:

// Swift access to generated strings
let bagStrings = BagStrings()  // Uses base locale by default
let title = bagStrings.bagTitle
let empty = bagStrings.bagEmpty

// Plurals
let count = 5
let itemsText = bagStrings.bagItemsCount?.get(Int(count))

Note: For Swift access, expose the strings through a wrapper in your shared module:

// In your shared KMP module
class BagStringsProvider {
    fun getTitle(): String = com.ncf.weblate.stringResources.base.bag.BagStrings.bagTitle
    fun getBagItemsCount(quantity: Int): String = com.ncf.weblate.stringResources.base.bag.BagStrings.bagItemsCount.get(quantity)
}

Web (Kotlin/JS)

import com.ncf.weblate.stringResources.base.bag.BagStrings

// Simple strings
val title: String = BagStrings.bagTitle

// Plurals
val itemsText: String = BagStrings.bagItemsCount.get(itemCount)

Moko Resources (StringResource)

For platform integration (XML layouts, string formatting, etc.), use the Moko Resources approach:

Android (Traditional Views)

import com.ncf.weblate.MR
import dev.icerock.moko.resources.desc.StringDesc

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val textView: TextView = findViewById(R.id.my_text)

        // Method 1: Get StringResource and convert to String
        val stringResource = MR.strings.bag_items_title
        textView.text = stringResource.getString(this)  // Requires Context

        // Method 2: Use StringDesc
        val stringDesc: StringDesc = StringDesc.Resource(MR.strings.bag_checkout)
        textView.text = stringDesc.toString(this)
    }
}

XML Layouts:

<!-- activity_main.xml -->
<TextView
    android:id="@+id/title_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/bag_items_title"
    tools:text="Bag Title" />

Android (Compose)

import com.ncf.weblate.MR

Text(MR.foundation.strings.welcome_message.desc().toString())

iOS (Swift)

// In your shared module
class ResourceManager {
    fun getWelcomeMessage(): String {
        return MR.foundation.strings.welcome_message.desc().toString()
    }

    fun getBagTitle(): String {
        return MR.strings.bag_bag_title.desc().toString()
    }
}
// In your iOS project
let resourceManager = ResourceManager()
let welcomeMessage = resourceManager.getWelcomeMessage()
let bagTitle = resourceManager.getBagTitle()

Web (Kotlin/JS)

import com.ncf.weblate.MR

// Accessing string resources
val appName = MR.foundation.strings.app_name.desc().toString()
val welcomeMessage = MR.foundation.strings.welcome_message.desc().toString()

Feature Structure

Each feature has its own Strings object with all localized strings:

object FoundationStrings {
    val appName: String get() = "NCF Weblate"
    val cancel: String get() = "Cancel"
    val errorGeneric: String get() = "An error occurred"
    val retry: String get() = "Retry"
    val welcomeMessage: String get() = "Welcome to our application"

    val allKeys: List<String> get() = listOf(...)
    val count: Int get() = allKeys.size
}

Aggregated access through StringsBundle:

import com.ncf.weblate.stringResources.base.StringsBundle

// Access all features through a single entry point
StringsBundle.foundation.appName
StringsBundle.bag.bagTitle
StringsBundle.checkout.checkoutTitle

// Get feature string counts
StringsBundle.getFeatureStringCount("bag")  // Returns count
StringsBundle.hasFeature("bag")             // Returns Boolean
StringsBundle.totalStringCount              // Returns total count

Locale Selection

The library provides a convenient LocaleProvider for runtime locale switching:

import com.ncf.weblate.stringResources.localization.LocaleProvider

// Set locale at runtime
LocaleProvider.setLocale("esAR")
LocaleProvider.setLocale("ptBR")
LocaleProvider.setLocale("base")  // Default

// Access strings - same code, different locale
textView.text = LocaleProvider.Strings.bag.bagTitle
textView.text = LocaleProvider.Strings.foundation.appName
textView.text = LocaleProvider.Strings.checkout.checkoutTitle

// Plurals
val itemsText = LocaleProvider.Strings.bag.bagItemsCount.get(itemCount)

Supported locales:

  • "base" - English (default)
  • "ptBR" / "pt-BR" - Brazilian Portuguese
  • "esAR" / "es-AR" - Argentine Spanish
  • "esCO" / "es-CO" - Colombian Spanish
  • "esMX" / "es-MX" - Mexican Spanish
  • "esCL" / "es-CL" - Chilean Spanish

Check locale support:

if (LocaleProvider.isSupported("esAR")) {
    LocaleProvider.setLocale("esAR")
}

val currentLocale = LocaleProvider.getLocale()  // Returns "esAR"

Access all features:

LocaleProvider.Strings.foundation
LocaleProvider.Strings.bag
LocaleProvider.Strings.checkout
LocaleProvider.Strings.customer
LocaleProvider.Strings.order
LocaleProvider.Strings.content
LocaleProvider.Strings.ui

Weblate Integration

This library is designed to work seamlessly with Weblate for translation management:

  1. Configure Weblate to monitor the src/commonMain/resources/MR/base/ directory
  2. Set up translation components for each feature:
    • Foundation
    • UI
    • Content
    • Checkout
    • Customer
    • Bag
    • Order
  3. Configure Weblate to output translations to src/commonMain/resources/MR/{language}/
  4. When Weblate pushes translations, they will automatically be included in the next build

Weblate Component Configuration

For each feature, create a Weblate component with these settings:

  • File format: Android XML strings
  • File mask: src/commonMain/resources/MR/*/feature_name/strings.xml
  • Monolingual base language file: src/commonMain/resources/MR/base/feature_name/strings.xml

Continuous Integration

To automate the translation workflow:

  1. Set up a webhook in Weblate to trigger builds when translations are updated
  2. Configure your CI pipeline to pull translations from Weblate before building
  3. Publish new versions of the library when translations are updated

Publishing

To publish this library to a Maven repository:

  1. Configure your repository credentials in ~/.m2/settings.xml or through environment variables
  2. Run ./gradlew publish
  3. The library will be published with the coordinates: com.ncf.weblate:ncf-weblate-cf-front:1.0.0

Local Development

To build the library locally:

./gradlew build

To publish to local Maven repository:

./gradlew publishToMavenLocal

Build

Prerequisites

  • JDK 17+
  • Android SDK (for Android builds)
  • Xcode (for iOS builds)

All Platforms

To build for all platforms at once:

./gradlew build

Android

To build for Android:

./gradlew :ncf-weblate-cf-front:assembleRelease

Output location: build/outputs/aar/

iOS

To build iOS frameworks for all architectures:

./gradlew linkReleaseFrameworkIosArm64
./gradlew linkReleaseFrameworkIosSimulatorArm64
./gradlew linkReleaseFrameworkIosX64

Output locations:

  • iOS ARM64 (device): build/bin/iosArm64/releaseFramework/
  • iOS Simulator ARM64: build/bin/iosSimulatorArm64/releaseFramework/
  • iOS Simulator x64: build/bin/iosX64/releaseFramework/

Web/JS

To build the JavaScript bundle:

./gradlew jsBrowserDistribution

Output location: build/dist/js/production

Configuration

The project uses Moko Resources for multiplatform resource management rather than Kotlinx Resources. All string resources are organized by feature modules and are automatically included in builds for all supported platforms.

License

MIT License