{"id":18880089,"url":"https://github.com/antoninhrlt/lingo","last_synced_at":"2025-10-27T00:06:40.502Z","repository":{"id":64974613,"uuid":"580003207","full_name":"antoninhrlt/lingo","owner":"antoninhrlt","description":"Internationalize a Rust program and translate strings quickly and simply. Make any software open to multiple languages","archived":false,"fork":false,"pushed_at":"2023-08-09T21:18:20.000Z","size":38,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-21T12:37:42.530Z","etag":null,"topics":["internationalization","l10n","languages","localization","rust","rust-library","software-development"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/lingo_lib","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antoninhrlt.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}},"created_at":"2022-12-19T13:32:39.000Z","updated_at":"2023-02-20T12:31:26.000Z","dependencies_parsed_at":"2024-11-08T06:51:59.298Z","dependency_job_id":null,"html_url":"https://github.com/antoninhrlt/lingo","commit_stats":{"total_commits":29,"total_committers":2,"mean_commits":14.5,"dds":0.06896551724137934,"last_synced_commit":"4fb00ba57d0dad78788d65999e0ceada9b0fd941"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/antoninhrlt/lingo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoninhrlt%2Flingo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoninhrlt%2Flingo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoninhrlt%2Flingo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoninhrlt%2Flingo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antoninhrlt","download_url":"https://codeload.github.com/antoninhrlt/lingo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoninhrlt%2Flingo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265481736,"owners_count":23773944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["internationalization","l10n","languages","localization","rust","rust-library","software-development"],"created_at":"2024-11-08T06:41:47.665Z","updated_at":"2025-10-27T00:06:35.467Z","avatar_url":"https://github.com/antoninhrlt.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lingo\nInternationalise a Rust program and translate strings quickly and simply. Make any software open to multiple languages\n\n## Installation\nIn your \"Cargo.toml\" file :\n```toml\n[dependencies]\nlingo_lib = \"*\"\n```\nCheck the current version on [crates.io](https://crates.io/crates/lingo_lib).\n\n\u003e Unfortunately, the crate \"lingo\" already exists in [crates.io](https://crates.io/crates/lingo). Waiting to get the name, be careful to not import \"lingo\" but \"lingo_lib\".\n\n## How to use\n```rust\nlet mut lingo = lingo![\n    (\n        \"\u003cidentifier\u003e\", \n        strings![\n            s!(\"\u003clocale\u003e\", \"\u003ctranslation\u003e\"),\n            s!(\"\u003clocale\u003e\", \"\u003ctranslation\u003e\")\n            // ...\n        ]\n    )\n    // ...\n];\n\n// If not set, it's the operating system locale that will be used.\nlingo.set_context_locale(/* app locale */);\n// If not set, it's `locale!(\"en\")`.\nlingo.set_default_locale(/* locale */);\n\nprintln!(\"{}\", lingo.string(\"\u003cidentifier\u003e\").unwrap());\n```\n\n- ## Locale\n    ```rust\n    locale!(\"en\"); // English (no country code)\n    locale!(\"en_US\"); // English (United States)\n\n    Locale::from_string(\"en_US\", '_'); // English (United States)\n    Locale::from_string(\"en-US\", '-'); // English (United States)\n\n    // English (no country code)\n    Locale(Language::new(LanguageCode::en), CountryCode::None);\n    // English (United States) \n    Locale(Language::new(LanguageCode::en), CountryCode::US);\n    ```\n\n## Example\nA French application using `lingo`.\n```rust\nstruct MyFrenchApp {\n    lingo: Lingo,\n}\n\nimpl MyFrenchApp {\n    pub fn new() -\u003e Self {\n        Self { \n            lingo: Self::init_lingo()\n        }\n    }\n\n    pub fn run(\u0026self) {\n        println!(\"{}\", self.lingo.string(\"welcome\").unwrap());\n    } \n}\n\nimpl LingoApp for MyFrenchApp {\n    fn init_lingo() -\u003e Lingo {\n        let mut lingo = lingo![\n            (\n                \"welcome\", \n                strings![\n                    s!(\"fr\", \"bienvenue sur l'app !\"),\n                    s!(\"en\", \"welcome to the app!\")\n                    // ...\n                ]\n            )\n            // ...\n        ];\n\n        lingo.set_context_locale(locale!(\"fr_FR\"));\n        lingo\n    }\n\n    fn lingo(\u0026self) -\u003e \u0026Lingo {\n        \u0026self.lingo\n    }\n}\n\nfn main() {\n    let app = MyFrenchApp::new();\n    \n    println!(\"{}\", app.lingo().string(\"welcome\").unwrap());\n    \n    app.run();\n}\n```\n\n```\nbienvenue sur l'app !\nbienvenue sur l'app !\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eImports for the example\u003c/summary\u003e\n\n```rust\nuse lingo_lib::{ lingo, locale, strings, s };\nuse lingo_lib::{ Lingo, LingoApp };\nuse lingo_lib::locales::Locale;\n```\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoninhrlt%2Flingo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantoninhrlt%2Flingo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoninhrlt%2Flingo/lists"}