{"id":14041314,"url":"https://github.com/biggik/Strings.ResourceGenerator","last_synced_at":"2025-07-27T13:31:22.346Z","repository":{"id":65500892,"uuid":"539016883","full_name":"biggik/Strings.ResourceGenerator","owner":"biggik","description":"Roslyn source generator that takes flatfile strings and creates resource accessors","archived":false,"fork":false,"pushed_at":"2024-08-07T21:59:13.000Z","size":201,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-09T03:09:03.401Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","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/biggik.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-09-20T13:56:49.000Z","updated_at":"2024-08-08T03:00:44.000Z","dependencies_parsed_at":"2024-02-27T06:08:36.906Z","dependency_job_id":"73e118f1-049a-4807-b1be-930a04dafe56","html_url":"https://github.com/biggik/Strings.ResourceGenerator","commit_stats":{"total_commits":22,"total_committers":2,"mean_commits":11.0,"dds":"0.18181818181818177","last_synced_commit":"726c850569d0eb5748e0fa5a0753889f5c6de55c"},"previous_names":["biggik/flatfile.resourcegenerator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biggik%2FStrings.ResourceGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biggik%2FStrings.ResourceGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biggik%2FStrings.ResourceGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biggik%2FStrings.ResourceGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biggik","download_url":"https://codeload.github.com/biggik/Strings.ResourceGenerator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227806081,"owners_count":17822622,"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":[],"created_at":"2024-08-12T07:00:51.802Z","updated_at":"2025-07-27T13:31:22.334Z","avatar_url":"https://github.com/biggik.png","language":"C#","funding_links":[],"categories":["Content"],"sub_categories":["201. [Strings.ResourceGenerator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/Strings.ResourceGenerator) , in the [FilesToCode](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#filestocode) category"],"readme":"# Strings.ResourceGenerator\nRoslyn source generator that takes strings from various file formats and creates resource accessors that access strings resources in a controlled manner\n\nCurrent support is for:\n\n* .strings files (one per language, e.g. Errors.strings and Errors.de.strings)\n* .strings file (multiple language support in a side-by-side fashion, with embedded configuration)\n* .json files (multiple language support)\n* .yaml files (multiple language support)\n\nThe generated accessors use the current region when selecting the language to pick strings from at runtime, but also accessor for per-language fetching of resources, e.g. via Errors.Neutral.MyErrorString and Errors.DE.MyErrorString\n\nFor all of the formats the following applies:\n* Keys must be unique for each string resource\n* Values can either use standard formatting (e.g. {0}, {1}, etc) or interpolation (e.g. {name}), but not both\n* Signatures must match for all languages\n\nParameters to strings also support type specifiers, formatting specifiers and signature ordering\n* Format: `:format`, e.g. `\"String with {0:n2} formatted\"`\n* Type: `@type`, e.g. `\"String with {name@string}\"`\n* Order: `@order`, e.g. `String with {name@string@1}\"` (order requires type as well)\n\nExample of using all: `\"String with {amount:n2@decimal@3}\"'\n\nSee examples of files online on the [project site](https://github.com/biggik/Strings.ResourceGenerator/tree/main/Strings.ResourceGenerator.Examples/Resources)\n\n## .strings files\n\nA .strings file is simply a UTF-8 encoded flat file of string resources in a key=value format.\n\nA slightly more complex version of a .strings file includes configuration and allows for multi-locale strings\n\n### .strings only\nThe format of the file should be \n```\nResourceKey=Resource value\nExceptionLogging=An exception has occurred. Error message is {message}\n```\n### .strings with multi-locale\nThe format of the file should be \n```\n[Configuration]\nnamespace=MyLibrary.Namespace\n\n[Resources]\n/* Used by exception logger middleware */\nExceptionLogging=An exception has occurred. Error message is {message}\nis:ExceptionLogging=Villa kom upp. Villuskilaboð voru {message}\n\n/* Or, alternatively, skip the resource key for additional locale resources */\nExceptionLogging2=An exception has occurred. Error message is {message}\nis:Villa kom upp. Villuskilaboð voru {message}\n```\n\n## .json files\n\n.json files can be used to add strings. Json files need to be serializable from `Strings.ResourceGenerator.Models.StringsModel` (using [NewtonSoft Json](https://www.newtonsoft.com/json))\n\n## .yaml files\n\n.yaml files can be used to add strings. Yaml files need to be serializable from `Strings.ResourceGenerator.Models.StringsModel` (using [YamlDotNet](https://github.com/aaubry/YamlDotNet))\n\n# How to get started\n\nReference the Strings.ResourceGenerate Nuget package\n\nModify the reference as follows\n```\n\t\t\u003cPackageReference Include=\"Strings.ResourceGenerator\" Version=\"0.6.0\"\u003e\n\t\t\t\u003cPrivateAssets\u003eall\u003c/PrivateAssets\u003e\n\t\t\t\u003cIncludeAssets\u003eruntime; build; native; contentfiles; analyzers; buildtransitive\u003c/IncludeAssets\u003e\n\t\t\u003c/PackageReference\u003e\n```\n\nInclude configuration for AdditionalFiles for the generator, here is one example:\n```\n\t\u003cItemGroup\u003e\n\t\t\u003cAdditionalFiles Include=\"Resources\\*.strings\" /\u003e\n\t\t\u003cAdditionalFiles Include=\"Resources\\JsonExample.json\" /\u003e\n\t\t\u003cAdditionalFiles Include=\"Resources\\NeutralExample.yaml\" /\u003e\n\t\t\u003cAdditionalFiles Include=\"Resources\\JsonExample.json\" /\u003e\n\t\t\u003cAdditionalFiles Include=\"Resources\\strings.config\" /\u003e\n\t\u003c/ItemGroup\u003e\n```\n\n## Configuration\nWhile no configuration is required, the following are options to configure basic settings of the generator.\nConfiguration is done by differently based on the type of source file, but is embedded in the file in all cases except where a strings.config file is used. This should be fairly obvious from the example project on GitHub.\n\nA generic strings.config is the default where a more specific Errors.strings.config could be used for Errors.strings\n\nThe defaults for the parameters are as follows\npublic=false\npreferConst=true\nprefix=\nnamespace=Strings.Resources\n\n### public\n\nif set to true, then the string accessor classes are generated as `public` classes, suitable in library implementations consumed by other assemblies, otherwise the accessors are `internal`\n\n### preferConst\n\nif set to true (the default), then, where possible, accessors are generated as `public const string` instead of `public static string`\nThis is not possible for multiple languages, since there a lookup is done based on the locale, so the value is never constant\n\n### prefix\n\nIf set, then generated classes will be prefixed, e.g. for Errors.strings and a prefix of `Application`, the generated class would be `ApplicationErrors`\n\n## namespace\n\nIf set, then generated classes will be generated in the specified namespace, otherwise they will default to the `Strings.Resources` namespace\n\n## Examples\n\nSee Strings.ResourceGenerator.Examples project. In its Resources folder are examples of \n\n- .strings files and a strings.config file (see [MultiLanguageExample.strings](https://github.com/biggik/Strings.ResourceGenerator/blob/main/Strings.ResourceGenerator.Examples/Resources/MultiLanguageExample.strings), [MultiLanguageExample.is.strings](https://github.com/biggik/Strings.ResourceGenerator/blob/main/Strings.ResourceGenerator.Examples/Resources/MultiLanguageExample.is.strings), [strings.config](https://github.com/biggik/Strings.ResourceGenerator/blob/main/Strings.ResourceGenerator.Examples/Resources/strings.config))\n- .strings file with config and multi-locale resources (see [MultiLocaleStrings.strings](https://github.com/biggik/Strings.ResourceGenerator/blob/main/Strings.ResourceGenerator.Examples/Resources/MultiLocaleStrings.strings))\n- .yml file with config and single-locale resources (see [NeutralExample.yaml](https://github.com/biggik/Strings.ResourceGenerator/blob/main/Strings.ResourceGenerator.Examples/Resources/NeutralExample.yaml))\n- .json file with config and multi-locale resources (see [JsonExample.json](https://github.com/biggik/Strings.ResourceGenerator/blob/main/Strings.ResourceGenerator.Examples/Resources/JsonExample.json))\n\n## Generation\n\nFor .strings files, empty and commented out lines (prefixed by # or //) are ignored in string generation\n\n## Validation\n\nFor multi-language string resources, validation is done on:\n* resource keys - each language must have all the same keys\n* resource string parameters - each parameterized resource key must have the same signature for all languages\n\n## TODO\n\nConsider supporting XLiff [https://en.wikipedia.org/wiki/XLIFF]\n\n# Release notes\n\n## 0.5.0\nInitial release with support for .strings files\n\n## 0.5.1\nAdding support for .json and .yaml files as well as generation that supports direct access to locale resources via generated resource accessors\n\n## 0.5.2\nMinor update. Fixed one typo, and generate configuration entries into source as comments\n\n## 0.5.3\nMinor update. Fixed deserialization of json config\n\n## 0.5.4\nMinor update. Fixed documentation generation for public interface\n\n## 0.5.5\nMinor update. Fixed documentation generation for public properties\n\n## 0.5.6\nMinor update. \n\n## 0.6.0\nUpdate to .strings handling to allow for multi-locale and configuration in a single file\nDocumentation updated\n\n## 0.6.1\nAllow resource key to be optional (.strings file) for additional locale strings\n\n## 0.6.2\nTemporarily stop splitting long lines due to complexity with interpolation\n\n## 0.6.3\nGenerate generator version into header comments (for clarity)\n\n## 0.6.4\nAdded [ExcludeFromCodeCoverage] attribute to generated classes (configurable)\n\n## 0.6.5\nFixed configuration and improved unit tests\n\n## 0.6.6\nFixed issue with full namespaces in type declaration parameters\n\n## 0.6.7\nFixed normalization of escaped strings\n\n## 0.6.8\nEncode documentation for valid XML\n\n## 0.6.9\nRe-fixed normalization. Code requires refactoring from seriously old implementation that mixes responsibilities. But for now ...\n\n## 0.6.10\nSet, and allow to configure, a custom Justification message for ExcludeFromCodeCoverage attributes\n\n## 0.6.11\nAdd rudimentary support for multi-line raw strings\n\n## 0.7.0\nRefactored to use IIncrementalGenerator instead of ISourceGenerator on request https://github.com/biggik/Strings.ResourceGenerator/issues/1","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiggik%2FStrings.ResourceGenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiggik%2FStrings.ResourceGenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiggik%2FStrings.ResourceGenerator/lists"}