A .NET library that converts currency values into words in Bulgarian for accounting purposes.
Example: Input: 32048.27
Outpud: тридесет и две хиляди и четиридесет и осем лева и 27 ст.
- It takes into consideration the grammatical gender.
- It writes decimal fractions in the short form:
X лева и ст.
when the value is above zero, and the full word when it is under the value of1
:девет стотинки
. - The current maximum value is
999999.99
and the minimum is0.
.
This project is my first attempt to build something with GitHub Copilot, with as little intervention as possible. GitHub Copilot just couldn't understand my requirements thoroughly enough and it never gave something that satisfies all requirements together. I made many attempts to improve functions with detailed prompts, but code was always unsatisfactory. I did my best to not give up on it, however my patience was over at one point.
Generating InlineData for the tests failed into an infinite loop (and the token limits kicked in). Nothing generated as code passed all the tests no matter how I structured prompts. Prompting it to fix the code so tests pass never got the necessary results.
I eventually had to correct the code myself. The end result is an abomination, but it works. I still feel that I would have spent less time writing it from scratch.
You can install the OneBitSoftware.Slovom assembly through the NuGet package NuGet:
Install-Package OneBitSoftware.Slovom
Or via the .NET Core command line interface:
dotnet add package OneBitSoftware.Slovom
Input | Output |
---|---|
0 | нула лева |
1 | един лев |
2 | два лева |
19 | деветнадесет лева |
0.1 | десет стотинки |
1.20 | един лев и 20 ст. |
1019.78 | хиляда и деветнадесет лева и 78 ст. |
1119.78 | хиляда сто и деветнадесет лева и 78 ст. |
2014.78 | две хиляди и четиринадесет лева и 78 ст. |
32478.27 | тридесет и две хиляди четиристотин седемдесет и осем лева и 27 ст. |
Feel free to raise a PR to improve the code quality or add new features.
Inspired by: