{"id":25575494,"url":"https://github.com/porscheinformatik/weblate-spring","last_synced_at":"2025-09-14T05:44:03.613Z","repository":{"id":41967821,"uuid":"329220541","full_name":"porscheinformatik/weblate-spring","owner":"porscheinformatik","description":"Provides a Spring MessageSource backed by a Weblate Server.","archived":false,"fork":false,"pushed_at":"2025-03-21T05:45:27.000Z","size":98,"stargazers_count":5,"open_issues_count":3,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-21T06:29:52.409Z","etag":null,"topics":["java","spring","spring-boot","translation","weblate"],"latest_commit_sha":null,"homepage":"","language":"Java","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/porscheinformatik.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-01-13T06:56:52.000Z","updated_at":"2025-03-08T05:02:16.000Z","dependencies_parsed_at":"2024-03-21T15:29:02.718Z","dependency_job_id":"e4ca91d7-8f47-4905-b629-78f49c477dba","html_url":"https://github.com/porscheinformatik/weblate-spring","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porscheinformatik%2Fweblate-spring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porscheinformatik%2Fweblate-spring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porscheinformatik%2Fweblate-spring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porscheinformatik%2Fweblate-spring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/porscheinformatik","download_url":"https://codeload.github.com/porscheinformatik/weblate-spring/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586233,"owners_count":21128997,"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":["java","spring","spring-boot","translation","weblate"],"created_at":"2025-02-21T02:24:08.002Z","updated_at":"2025-04-12T15:10:24.666Z","avatar_url":"https://github.com/porscheinformatik.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Weblate Spring\n\nProvides a Spring MessageSource backed by a [Weblate](https://weblate.org/) Server.\n\n## Usage\n\nAdd the Maven dependency to your project (find the current version\non [Maven Central](https://search.maven.org/search?q=g:at.porscheinformatik.weblate%20AND%20a:weblate-spring\u0026core=gav)):\n\n```xml\n\n\u003cdependency\u003e\n  \u003cgroupId\u003eat.porscheinformatik.weblate\u003c/groupId\u003e\n  \u003cartifactId\u003eweblate-spring\u003c/artifactId\u003e\n  \u003cversion\u003e${weblate-spring.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nThen declare the `WeblateMessageSource` as a bean. You can configure the `MessageSource` via:\n\n- baseUrl (required) - the base URL of your Weblate instance\n- project (required) - the project slug\n- component (required) - the component slug\n\nUsually you might want to have the local message bundles as a backup when Weblate is not running. Therefore, you can\nset a `ResourceBundleMessageSource` as the parent of the `WeblateMessageSource`.\n\n`WeblateMessageSource` implements an interface `AllPropertiesSource` which can be used to obtain all translations from\nthe message source. This is needed when you want to get all your translations to your client (for example in a Single\nPage App). The `AllPropertiesReloadableResourceBundleMessageSource` should also be used in this context.\n\nThe implementation can also be switched to use asynchronous loading. In this case the texts will be loaded in a \nseparate thread in the background. This means that the first time you get a property it will fall-back to the \nparent `MessageSource`. As soon as the loading is done the new translated texts will be available.\n\nHere is a full example bean configuration for a Spring Boot app (with \"messages\" as the default bundle):\n\n```java\n@Bean\n@Primary\npublic WeblateMessageSource messageSource() {\n  var weblateMessageSource = new WeblateMessageSource();\n  weblateMessageSource.setBaseUrl(\"https://hosted.weblate.org\");\n  weblateMessageSource.setProject(\"my-project\");\n  weblateMessageSource.setComponent(\"my-component\");\n  weblateMessageSource.useAuthentication(\"api-key\");\n  weblateMessageSource.setAsync(true); // \u003c- set this for asynchronous loading\n  weblateMessageSource.setParentMessageSource(localMessageSource());\n  return weblateMessageSource;\n}\n\n@Bean\nMessageSource localMessageSource() {\n  var localMessageSource = new AllPropertiesReloadableResourceBundleMessageSource();\n  localMessageSource.setDefaultEncoding(StandardCharsets.UTF_8.name());\n  localMessageSource.setBasename(\"messages\");\n  localMessageSource.setFallbackToSystemLocale(false);\n  return localMessageSource;\n}\n```\n\n## Authentication / Adapting RestTemplate\n\nFor the simple authentication via API key you can use `WeblateMessageSource#useAuthentication`. If you want further\ncustomization of the HTTP calls you can set your own `RestTemplate`. \n\n## Caching\n\n`WeblateMessageSource` caches loaded translations 30 minutes (this can be changed by setting `maxAgeMilis`).\nIf you want to update one locale immediately call `WeblateMessageSource#reload(Locale)`. \n\nIf you want to fully clear the cache call `WeblateMessageSource#clearCache` - this will also reload the languages. **Please use this with caution as it add heavy load to the Weblate API!**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fporscheinformatik%2Fweblate-spring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fporscheinformatik%2Fweblate-spring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fporscheinformatik%2Fweblate-spring/lists"}