pdevito3 / craftsman

A .NET scaffolding tool to help you stop worrying about boilerplate and focus on your business logic 🚀
https://wrapt.dev
MIT License
1.12k stars 65 forks source link

Case conversion of names is not culture-independent #137

Open scria1000 opened 3 weeks ago

scria1000 commented 3 weeks ago

On machines where the current culture is set to Turkish, case conversion of identifiers result in the letter I being lowercased to the dotless-i (ı) variant instead of i.

I noticed that the code uses culture-specific ToLower(), ToUpper() instead of ToLowerInvariant(), ToUpperInvariant()

Generated docker-compose.yml causes issues with docker compose due to non-English letters not being allowed.

This does not appear to break the tool for now, and it can be remedied with a simple search and replace.

Generated docker-compose.yaml

Generated appsettings.json

Steps to reproduce

If you are on Windows, install the Language pack for Turkish and set just the Regional format to Turkish. Or you can just add these lines to the Program.cs of craftsman:

CultureInfo.DefaultThreadCurrentCulture = CultureInfo.GetCultureInfo("tr-TR");
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("tr-TR");

Have a ProjectName/ContextName/DatabaseName and/or Entity/Property name that begins with the letter I such as Ingredients.

Further technical details

Craftsman version (dotnet tool list -g): 0.26.4

Similar issues in other projects

https://github.com/CommunityToolkit/dotnet/issues/230

pdevito3 commented 3 weeks ago

Appreciate the callout on this! Will try and take a look at it soon