{"id":37128396,"url":"https://github.com/bobiverse/blabla","last_synced_at":"2026-01-14T14:56:49.028Z","repository":{"id":257806598,"uuid":"865785950","full_name":"bobiverse/blabla","owner":"bobiverse","description":"Translations from YAML file to Go and Go templates.","archived":false,"fork":false,"pushed_at":"2024-10-01T15:27:07.000Z","size":35,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-02T07:41:17.853Z","etag":null,"topics":["i18n","l10n","localization","translation"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bobiverse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-10-01T06:10:51.000Z","updated_at":"2024-10-01T15:27:10.000Z","dependencies_parsed_at":"2024-10-02T07:41:21.617Z","dependency_job_id":"37f3b2b7-417e-4af2-b256-d903b46ccb68","html_url":"https://github.com/bobiverse/blabla","commit_stats":null,"previous_names":["bobiverse/blabla"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bobiverse/blabla","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobiverse%2Fblabla","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobiverse%2Fblabla/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobiverse%2Fblabla/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobiverse%2Fblabla/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bobiverse","download_url":"https://codeload.github.com/bobiverse/blabla/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobiverse%2Fblabla/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28424024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"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":["i18n","l10n","localization","translation"],"created_at":"2026-01-14T14:56:48.473Z","updated_at":"2026-01-14T14:56:49.016Z","avatar_url":"https://github.com/bobiverse.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 💬 blabla\n\n**blabla** is a lightweight translation package. \nIt simplifies managing multilingual content in both Go code and templates, supporting YAML-based translation files and dynamic language switching.\n\nThis package is motivated by the need for a quick and simple translation solution, designed for easy integration into existing Go projects, using YAML as a straightforward and flexible source for translations.\n\n\n## Translation YAML file\n\n**YAML**-based translation file format for easy management.\n\n\n```yaml\nhello:\n  en: Hello\n  lv: Sveiki\n\nplural.demo:\n  en:\n    - One item\n    - \"%d items\"\n  lv: \n    - Viena lieta\n    - \"%d lietas\"\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eYAML with all features (plural options, format params, includes)\u003c/summary\u003e\n  \n\u003cbr/\u003e\n\nThe `^` in a YAML file copies the text from the translation key. The key can either be used as the final text or as a unique token for translations below.\n\n```yaml\n\nparams:\n  en: \"1=%d, 2=%0.2f 3=%s\"\n  lv: \"1=%d, 2=%0.2f 3=%s\"\n\nSame English text from Key:\n  en: ^\n  lv: Tas pats teksts no key\n\n# Include additional translation files\ninclude:\n  sub: sub.yml\n  sub2: sub3.yml\n```\n\u003c/details\u003e\n\n## Load translations\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/bobiverse/blabla\"\n)\n\nfunc main() {\n\tbla := blabla.MustLoad(\"tests/translations.yml\") // panics if there's an error\n\t// bla, err := blabla.Load(\"..\") // no panics\n\n\tlang := \"lv\"\n\n\tfmt.Println(bla.Get(lang, \"hello\"))                    // Outputs: \"Sveiki\"\n\tfmt.Println(bla.Get(lang, \"params\", 1, 2.02, \"three\")) // Outputs: \"1=1, 2=2.02 3=three\"\n\tfmt.Println(bla.Get(lang, \"plural.demo\", 5))           // Outputs: \"5 items\"\n\n\tfmt.Println(bla.Get(\"en\", \"Same English text from Key\")) // Outputs: \"Same English text from Key\"\n}\n```\n\nCheck [examples/main.go](examples/main.go)!\n\n\n## Use translations in Golang templates\n\nYou can also use the translation function directly inside Golang templates:\n\n```go\ntemplate.FuncMap{\n    \"T\":      bla.Get, // global `bla`\n    // ...\n}\n```\n\n```html\n\u003cp\u003e{{ T \"lv\" \"hello\" }}\u003c/p\u003e\n\u003cp\u003e{{ T .User.Lang \"hello\" }}\u003c/p\u003e\n```\n\n### Integrate into your struct\n```go\ntype User struct {\n    Lang string \n    // ..\n}\n\nfunc (user *User) T(s string) string {\n    return bla.Get(user.Lang, s) // global `bla`\n}\n```\n\n```html\n\u003cp\u003e{{ .User.T \"hello\" }}\u003c/p\u003e\n```\n\nThis will output the translation based on the active language.\n\n\n## Roadmap\n\n- [ ] **Implement advanced pluralization logic**  \n  Enhance the pluralization logic to support language-specific rules. For example, in **Latvian**, numbers like `1` and `21` use the singular form (`lieta`), while `5` and `22` use the plural form (`lietas`), and numbers like `10` and `15` use a different genitive plural form (`lietu`). Similarly, **Icelandic** uses a singular form for `1`, dual forms for `2-4`, and a plural form for `5` and above. This logic should cover edge cases across all supported languages.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobiverse%2Fblabla","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbobiverse%2Fblabla","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobiverse%2Fblabla/lists"}