Slugify icon indicating copy to clipboard operation
Slugify copied to clipboard

Merging SlugHelper and SlugHelperForNonAsciiLanguages into a single class with a SupportNonAsciiLanguages property in SlugHelperConfiguration class

Open ctolkien opened this issue 7 months ago • 0 comments

Discussed in https://github.com/ctolkien/Slugify/discussions/155

Originally posted by cemilf March 19, 2025 It seems that it is possible to use single class to support Non Ascii Languages without a separate class.

We can add a boolean property to SlugHelperConfiguration to support NonAsciiLanguages. Than a simple if statement will be enough to call UnicodeDecoder.UniDecode(inputString) method.

if (config.SupportNonAsciiLanguages){    
    inputString = UnicodeDecoder.UniDecode(inputString);
}

var normalizedInput = inputString.Normalize(NormalizationForm.FormD);

What do you think?

Steps:

  • [ ] Add new Option
  • [ ] If the option has been selected, then preform the decoding
  • [ ] Add an Obsolete attribute to the SlugHelperForNonAsciiLanguages with instructions to use the new option
  • [ ] Update all the tests to use the new mechanism.

ctolkien avatar Mar 25 '25 00:03 ctolkien