{"id":23226087,"url":"https://github.com/simplelocalize/spring-boot-i18n","last_synced_at":"2026-05-05T18:38:51.993Z","repository":{"id":117686386,"uuid":"567732993","full_name":"simplelocalize/spring-boot-i18n","owner":"simplelocalize","description":"Spring Boot internationalization code and quick guide","archived":false,"fork":false,"pushed_at":"2025-08-04T09:56:36.000Z","size":5603,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-27T01:21:57.351Z","etag":null,"topics":["i18n","internationalization","localization","simplelocalize","spring-boot","spring-framework","spring-i18n","spring-thymeleaf","thymeleaf"],"latest_commit_sha":null,"homepage":"https://simplelocalize.io","language":"Java","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/simplelocalize.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,"zenodo":null}},"created_at":"2022-11-18T12:57:48.000Z","updated_at":"2025-08-04T09:56:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"fbc4d299-0648-4a3d-a6bd-0a70e5bca084","html_url":"https://github.com/simplelocalize/spring-boot-i18n","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/simplelocalize/spring-boot-i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fspring-boot-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fspring-boot-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fspring-boot-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fspring-boot-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplelocalize","download_url":"https://codeload.github.com/simplelocalize/spring-boot-i18n/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fspring-boot-i18n/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32663429,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"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","internationalization","localization","simplelocalize","spring-boot","spring-framework","spring-i18n","spring-thymeleaf","thymeleaf"],"created_at":"2024-12-19T00:15:58.293Z","updated_at":"2026-05-05T18:38:51.988Z","avatar_url":"https://github.com/simplelocalize.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![translated spring boot page](/readme/translated-springboot-webpages.png)\n\n# Simple internationalization (i18n) for Spring Boot\n\nThis project provides a simple guide and code to internationalize your Spring Boot application using default methods for Spring Framework. \n[Step-by-step guide with configuration part is available here](https://simplelocalize.io/blog/posts/spring-boot-simple-internationalization/).\n\n### Project details:\n- Java 24\n- Spring Boot 3.5\n- Thymeleaf\n- Maven\n- SimpleLocalize Editor\n\n![simplelocalize](/readme/simplelocalize-editor.png)\n\n## Usage\n\n\n### Get translated messages\n\nUse `MessageSource` to get translated messages. This is the default way to get translated messages in Spring Boot.\n\n```java\nimport org.springframework.context.MessageSource;\n\n@Autowired\nprivate MessageSource messageSource;\n\n@Test\nvoid shouldGetTranslatedTextFromLocalFileAndLocale()\n{\n    //given\n    Locale locale = Locale.of(\"pl\", \"PL\");\n\n    //when\n    String titleTextWithArgument = messageSource.getMessage(\"title\", new Object[]{\"Foo Bar\"}, locale);\n\n    //then\n    assert titleTextWithArgument.equals(\"Hej Foo Bar!\");\n}\n```\n\n\n### Thymeleaf: render HTML with translations\n\n\nUse `ThymeleafEngine` bean to render HTML with translated messages. This is _probably_ the most \npopular way to render HTML with translated messages in Spring Boot.\n\n```java\n\n@Autowired\nprivate TemplateEngine templateEngine;\n\npublic String renderHtmlFromTemplate(Locale locale, String userName)\n{\n    Context context = new Context();\n    context.setLocale(locale);\n    context.setVariable(\"userName\", userName);\n    context.setVariable(\"lang\", locale.getLanguage());\n    context.setVariable(\"url\", \"https://simplelocalize.io\");\n    return templateEngine.process(\"my-html-template\", context);\n}\n```\n\n![render custom HTML with translated texts](/readme/ide-with-spring-boot.png)\n\n### Return translated web pages\n\nYou can also return translated web pages (HTML) by using standard Spring Boot `@Controller`.\nSpring Boot will automatically resolve user locale and render HTML from `my-html-template.html` template with translated messages.\n\nThis is the default way to return translated web pages in Spring Boot. \n\n```java\n@Controller\npublic class WelcomeController\n{\n  @GetMapping(\"/welcome\")\n  public String renderHtmlFromTemplate(Model model)\n  {\n    model.addAttribute(\"userName\", \"Jakub\");\n    return \"my-html-template\";\n  }\n}\n```\n\nRun the application and open `http://localhost:8080/welcome` in your browser.\nYou can change the language by adding `?lang=pl_PL` to the URL.\n\n![changing lang parameter in spring boot](/readme/change-language-parameter.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplelocalize%2Fspring-boot-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplelocalize%2Fspring-boot-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplelocalize%2Fspring-boot-i18n/lists"}