{"id":31588673,"url":"https://github.com/sudarshanmhasrup/localina","last_synced_at":"2026-03-16T06:24:25.287Z","repository":{"id":320323905,"uuid":"1078095919","full_name":"sudarshanmhasrup/localina","owner":"sudarshanmhasrup","description":"A Kotlin Multiplatform library that supports real-time locale updates in your Compose Multiplatform app.","archived":false,"fork":false,"pushed_at":"2026-03-10T04:55:04.000Z","size":13096,"stargazers_count":48,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-10T12:44:01.128Z","etag":null,"topics":["android","compose-multiplaform","desktop","ios","klibs","kotlin-multiplaform","library","open-source","wasm-js"],"latest_commit_sha":null,"homepage":"https://sudarshanmhasrup.github.io/localina/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sudarshanmhasrup.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-17T07:48:21.000Z","updated_at":"2026-03-10T04:49:35.000Z","dependencies_parsed_at":"2025-10-23T07:06:48.842Z","dependency_job_id":"9789ae68-c69b-4108-96d9-e72fe7a55394","html_url":"https://github.com/sudarshanmhasrup/localina","commit_stats":null,"previous_names":["sudarshanmhasrup/localina"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/sudarshanmhasrup/localina","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudarshanmhasrup%2Flocalina","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudarshanmhasrup%2Flocalina/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudarshanmhasrup%2Flocalina/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudarshanmhasrup%2Flocalina/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sudarshanmhasrup","download_url":"https://codeload.github.com/sudarshanmhasrup/localina/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudarshanmhasrup%2Flocalina/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30570664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-16T06:02:37.763Z","status":"ssl_error","status_checked_at":"2026-03-16T06:02:14.913Z","response_time":96,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","compose-multiplaform","desktop","ios","klibs","kotlin-multiplaform","library","open-source","wasm-js"],"created_at":"2025-10-06T02:12:15.309Z","updated_at":"2026-03-16T06:24:25.207Z","avatar_url":"https://github.com/sudarshanmhasrup.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Maven Central](https://img.shields.io/maven-central/v/io.github.sudarshanmhasrup.localina/localina.svg?label=Maven%20Central)](https://search.maven.org/artifact/io.github.sudarshanmhasrup.localina/localina)\n![Beta](https://img.shields.io/badge/status-beta-yellow)\n[![Kotlin](https://img.shields.io/badge/kotlin-2.3.10-blue.svg?logo=kotlin\u0026logoColor=original)](http://kotlinlang.org)\n[![Compose Multiplatform](https://img.shields.io/badge/Compose_Multiplatform-1.10.2-4285F4?style=flat\u0026logo=jetpackcompose\u0026logoColor=original)](https://www.jetbrains.com/compose-multiplatform/)\n\n### About this project\n\nLocalization is one of the most important aspects of the user experience when building software that supports\ninclusivity by allowing users to use your software in their preferred language. Compose Multiplatform supports\nlocalization out of the box, but changing the locale in real time is a bit trickier and requires writing a lot of\nboilerplate code, which is also challenging to understand. `Localina` Is a Kotlin Multiplatform library that allows you\nto update the locale of your Compose Multiplatform app in real time.\n\n### Live preview\n\nView a live preview of `Localina` in action: [Localina Live Preview](https://sudarshanmhasrup.github.io/localina/demo)\n\n### Installation guide\n\nTo get started, add the `Localina` dependency to your existing [Gradle](https://gradle.org/) project. To make `Localina`\navailable in any module's classpath, copy and paste the following line into your module's `build.gradle.kts` file under\nthe `dependencies` block as shown below.\n\n```kotlin\nkotlin {\n    sourceSets {\n        commonMain.dependencies {\n            // Other dependencies will go here\n            implementation(\"io.github.sudarshanmhasrup.localina:localina:1.0.0-beta2\")\n        }\n    }\n}\n```\n\nTo quickly copy the dependency, you can use the following command:\n\n```kotlin\nimplementation(\"io.github.sudarshanmhasrup.localina:localina:1.0.0-beta2\")\n```\n\nIf your project uses a version catalog for centralized dependency management, then add the following lines to your\n`libs.versions.toml` file:\n\n```\n[versions]\n# Other version declarations will go here\nlocalina = \"1.0.0-beta2\"\n\n[libraries]\n# Other libraries declarations will go here\nlocalina = { module = \"io.github.sudarshanmhasrup.localina:localina\", version.ref = \"localina\" }\n```\n\nThen you can refer to the dependency in your module's `build.gradle.kts` file like this:\n\n```kotlin\nkotlin {\n    sourceSets {\n        commonMain.dependencies {\n            // Other dependencies will go here\n            implementation(libs.localina)\n        }\n    }\n}\n```\n\nTo quickly copy the dependency, you can use the following command:\n\n```kotlin\nimplementation(libs.localina)\n```\n\n### Usage guide\n\nIt's super easy to use `Localina` for updating your app's locale in real-time. Follow these three steps and you're good\nto go.\n\n#### Step 1: Add String Resources\n\nStore all your string resources under `commonMain/composeResource` directory and add localized strings for each\nsupported language, like this:\n\n```\ncommonMain/composeResources/\n├── values/\n│   └── strings.xml\n├── values-hi/\n│   └── strings.xml\n├── values-fr/\n│   └── strings.xml\n└── ... (other locale directories)\n```\n\n#### Step 2: Wrap your app's UI with LocalinaApp Composable\n\nWrap all your UI code inside the\n[LocalinaApp](/library/src/commonMain/kotlin/io/github/sudarshanmhasrup/localina/api/LocalinaApp.kt) composable, like\nthis:\n\n```kotlin\n@Composable\nfun App() {\n    LocalinaApp {\n        // Your UI code here\n    }\n}\n```\n\n#### Step 3: Update the Locale\n\nTo change the language at runtime, call the\n[updateLocale()](/library/src/commonMain/kotlin/io/github/sudarshanmhasrup/localina/api/LocalinaApp.kt) function with\nyour desired locale code.\n\n```kotlin\n// Replace \"hi\" with your desired locale code.\nLocaleUpdater.updateLocale(locale = \"hi\")\n\n// Or change language using Locale enum\n@OptIn(ExperimentalLocalinaApi::class)\nLocaleUpdater.updateLocale(locale = Locale.Hindi)\n```\n\n#### Step 4: (Only for Web) Override Navigator.languages Property\n\nIn your browser's index.html, put the following code before loading the application scripts:\n\n```html\n\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    ...\n    \u003cscript\u003e\n        var currentLanguagesImplementation = Object.getOwnPropertyDescriptor(Navigator.prototype, \"languages\");\n        var newLanguagesImplementation = Object.assign({}, currentLanguagesImplementation, {\n            get: function () {\n                if (window.__customLocale) {\n                    return [window.__customLocale];\n                } else {\n                    return currentLanguagesImplementation.get.apply(this);\n                }\n            }\n        });\n\n        Object.defineProperty(Navigator.prototype, \"languages\", newLanguagesImplementation)\n    \u003c/script\u003e\n    \u003cscript src=\"skiko.js\"\u003e\u003c/script\u003e\n    ...\n\u003c/head\u003e\n\u003cbody\u003e\u003c/body\u003e\n\u003cscript src=\"composeApp.js\"\u003e\u003c/script\u003e\n\u003c/html\u003e\n```\n\n### Supported platforms\n\n`Localina` supports all platforms that Compose Multiplatform supports. This includes:\n\n| Platform | Target(s)                                      |\n|----------|------------------------------------------------|\n| Android  | `android()`                                    |\n| iOS      | `iosX64()`, `iosArm64()`,`iosSimulatorArm64()` |\n| Desktop  | `jvm()`                                        |\n| Web      | `wasmJs()`, `js()`                             |\n\n### Contributing\n\nContributions are welcome! Please feel free to open an issue or submit a pull request.\n\n### Thank you! 🙌\n\nThank you so much for checking out the `Localina` project. If you like my work on this project, feel free to give a star\nto the repository. Happy coding!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudarshanmhasrup%2Flocalina","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsudarshanmhasrup%2Flocalina","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudarshanmhasrup%2Flocalina/lists"}