Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bangla (Bangladesh) translation. #301

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
###In Development
- [#301](https://github.com/MehdiK/Humanizer/pull/301): Added Bangla (Bangladesh) localisation
- [#297](https://github.com/MehdiK/Humanizer/pull/297): Added support for all integer types in Fluent Date
- [#294](https://github.com/MehdiK/Humanizer/pull/294): Added support for untyped comparison of ByteSize
- [#277](https://github.com/MehdiK/Humanizer/pull/277): Added support for custom enum description attribute property names
Expand Down
3 changes: 3 additions & 0 deletions src/Humanizer.Tests/Humanizer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
<Compile Include="Bytes\ToStringTests.cs" />
<Compile Include="CasingTests.cs" />
<Compile Include="DateHumanize.cs" />
<Compile Include="Localisation\bn-BD\DateHumanizeTests.cs" />
<Compile Include="Localisation\bn-BD\NumberToWordsTests.cs" />
<Compile Include="Localisation\bn-BD\TimeSpanHumanizeTests.cs" />
<Compile Include="CollectionHumanizeTests.cs" />
<Compile Include="EnumHumanizeWithCustomDescriptionPropertyNamesTests.cs" />
<Compile Include="Localisation\bg\DateHumanizeTests.cs" />
Expand Down
108 changes: 108 additions & 0 deletions src/Humanizer.Tests/Localisation/bn-BD/DateHumanizeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
using System;
using Humanizer.Localisation;
using Xunit;
using Xunit.Extensions;

namespace Humanizer.Tests.Localisation.bnBD
{
public class DateHumanizeTests : AmbientCulture
{
public DateHumanizeTests() : base("bn-BD") { }

[Theory]
[InlineData(1, "আগামিকাল")]
[InlineData(13, "13 দিন পর")]
public void DaysFromNow(int days, string expected)
{
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future);
}

[Theory]
[InlineData(-1, "গতকাল")]
[InlineData(-11, "11 দিন আগে")]
public void DaysAgo(int days, string expected)
{
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past);
}

[Theory]
[InlineData(1, "এক ঘণ্টা পর")]
[InlineData(11, "11 ঘণ্টা পর")]
public void HoursFromNow(int hours, string expected)
{
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future);
}

[Theory]
[InlineData(-1, "এক ঘণ্টা আগে")]
[InlineData(-11, "11 ঘণ্টা আগে")]
public void HoursAgo(int hours, string expected)
{
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past);
}

[Theory]
[InlineData(1, "এক মিনিট পর")]
[InlineData(13, "13 মিনিট পর")]
public void MinutesFromNow(int minutes, string expected)
{
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future);
}

[Theory]
[InlineData(-1, "এক মিনিট আগে")]
[InlineData(-13, "13 মিনিট আগে")]
public void MinutesAgo(int minutes, string expected)
{
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past);
}

[Theory]
[InlineData(1, "এক মাস পর")]
[InlineData(10, "10 মাস পর")]
public void MonthsFromNow(int months, string expected)
{
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future);
}

[Theory]
[InlineData(-1, "এক মাস আগে")]
[InlineData(-10, "10 মাস আগে")]
public void MonthsAgo(int months, string expected)
{
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past);
}

[Theory]
[InlineData(1, "এক সেকেন্ড পর")]
[InlineData(11, "11 সেকেন্ড পর")]
public void SecondsFromNow(int seconds, string expected)
{
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future);
}

[Theory]
[InlineData(-1, "এক সেকেন্ড আগে")]
[InlineData(-11, "11 সেকেন্ড আগে")]
public void SecondsAgo(int seconds, string expected)
{
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past);
}

[Theory]
[InlineData(1, "এক বছর পর")]
[InlineData(21, "21 বছর পর")]
public void YearsFromNow(int years, string expected)
{
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future);
}

[Theory]
[InlineData(-1, "এক বছর আগে")]
[InlineData(-21, "21 বছর আগে")]
public void YearsAgo(int years, string expected)
{
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past);
}
}
}
88 changes: 88 additions & 0 deletions src/Humanizer.Tests/Localisation/bn-BD/NumberToWordsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
using Xunit;
using Xunit.Extensions;

namespace Humanizer.Tests.Localisation.bnBD
{
public class NumberToWordsTests : AmbientCulture
{
public NumberToWordsTests() : base("bn-BD") { }

[InlineData(0, "শূন্য")]
[InlineData(1, "এক")]
[InlineData(10, "দশ")]
[InlineData(11, "এগারো")]
[InlineData(20, "বিশ")]
[InlineData(122, "একশ বাইশ")]
[InlineData(3501, "তিন হাজার পাঁচশ এক")]
[InlineData(100, "একশ")]
[InlineData(1000, "এক হাজার")]
[InlineData(100000, "এক লক্ষ")]
[InlineData(1000000, "দশ লক্ষ")]
[InlineData(10000000, "এক কোটি")]
[InlineData(100000000, "দশ কোটি")]
[InlineData(1000000000, "একশ কোটি")]
[InlineData(111, "একশ এগারো")]
[InlineData(1111, "এক হাজার একশ এগারো")]
[InlineData(111111, "এক লক্ষ এগারো হাজার একশ এগারো")]
[InlineData(1111111, "এগারো লক্ষ এগারো হাজার একশ এগারো")]
[InlineData(11111111, "এক কোটি এগারো লক্ষ এগারো হাজার একশ এগারো")]
[InlineData(111111111, "এগারো কোটি এগারো লক্ষ এগারো হাজার একশ এগারো")]
[InlineData(1111111111, "একশ এগারো কোটি এগারো লক্ষ এগারো হাজার একশ এগারো")]
[InlineData(123, "একশ তেইশ")]
[InlineData(1234, "এক হাজার দুইশ চৌঁতিরিশ")]
[InlineData(12345, "বারো হাজার তিনশ পঁয়তাল্লিশ")]
[InlineData(123456, "এক লক্ষ তেইশ হাজার চারশ ছাপ্পান্ন")]
[InlineData(1234567, "বারো লক্ষ চৌঁতিরিশ হাজার পাঁচশ সাতষট্টি")]
[InlineData(12345678, "এক কোটি তেইশ লক্ষ পঁয়তাল্লিশ হাজার ছয়শ আটাত্তর")]
[InlineData(123456789, "বারো কোটি চৌঁতিরিশ লক্ষ ছাপ্পান্ন হাজার সাতশ উননব্বই")]
[InlineData(1234567890, "একশ তেইশ কোটি পঁয়তাল্লিশ লক্ষ সাতষট্টি হাজার আটশ নব্বই")]
[InlineData(-1234567890, "ঋণাত্মক একশ তেইশ কোটি পঁয়তাল্লিশ লক্ষ সাতষট্টি হাজার আটশ নব্বই")]
[Theory]
public void ToWords(int number, string expected)
{
Assert.Equal(expected, number.ToWords());
}



[Theory]
[InlineData(0, "শূন্য তম")]
[InlineData(1, "প্রথম")]
[InlineData(2, "দ্বিতীয়")]
[InlineData(3, "তৃতীয়")]
[InlineData(4, "চতুর্থ")]
[InlineData(5, "পঞ্চম")]
[InlineData(6, "ষষ্ট")]
[InlineData(7, "সপ্তম")]
[InlineData(8, "অষ্টম")]
[InlineData(9, "নবম")]
[InlineData(10, "দশম")]
[InlineData(11, "একাদশ")]
[InlineData(12, "দ্বাদশ")]
[InlineData(13, "ত্রয়োদশ")]
[InlineData(14, "চতুর্দশ")]
[InlineData(15, "পঞ্চদশ")]
[InlineData(16, "ষোড়শ")]
[InlineData(17, "সপ্তদশ")]
[InlineData(18, "অষ্টাদশ")]
[InlineData(19, "উনিশ তম")]
[InlineData(20, "বিশ তম")]
[InlineData(21, "একুশ তম")]
[InlineData(100, "শত তম")]
[InlineData(112, "একশ বারো তম")]
[InlineData(118, "একশ আঠারো তম")]
[InlineData(1000, "হাজার তম")]
[InlineData(1001, "এক হাজার এক তম")]
[InlineData(1021, "এক হাজার একুশ তম")]
[InlineData(10000, "দশ হাজার তম")]
[InlineData(10121, "দশ হাজার একশ একুশ তম")]
[InlineData(100000, "লক্ষ তম")]
[InlineData(1000000, "দশ লক্ষ তম")]
[InlineData(10000000, "কোটি তম")]

public void ToOrdinalWords(int number, string words)
{
Assert.Equal(words, number.ToOrdinalWords());
}
}
}
66 changes: 66 additions & 0 deletions src/Humanizer.Tests/Localisation/bn-BD/TimeSpanHumanizeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using System;
using Xunit;
using Xunit.Extensions;

namespace Humanizer.Tests.Localisation.bnBD
{
public class TimeSpanHumanizeTests : AmbientCulture
{
public TimeSpanHumanizeTests() : base("bn-BD") { }

[Theory]
[InlineData(7, "এক সপ্তাহ")]
[InlineData(14, "2 সপ্তাহ")]
public void Weeks(int days, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize());
}

[Theory]
[InlineData(1, "এক দিন")]
[InlineData(2, "2 দিন")]
public void Days(int days, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize());
}

[Theory]
[InlineData(1, "এক ঘণ্টা")]
[InlineData(2, "2 ঘণ্টা")]
public void Hours(int hours, string expected)
{
Assert.Equal(expected, TimeSpan.FromHours(hours).Humanize());
}

[Theory]
[InlineData(1, "এক মিনিট")]
[InlineData(2, "2 মিনিট")]
public void Minutes(int minutes, string expected)
{
Assert.Equal(expected, TimeSpan.FromMinutes(minutes).Humanize());
}

[Theory]
[InlineData(1, "এক সেকেন্ড")]
[InlineData(2, "2 সেকেন্ড")]
public void Seconds(int seconds, string expected)
{
Assert.Equal(expected, TimeSpan.FromSeconds(seconds).Humanize());
}

[Theory]
[InlineData(1, "এক মিলিসেকেন্ড")]
[InlineData(2, "2 মিলিসেকেন্ড")]
public void Milliseconds(int milliseconds, string expected)
{
Assert.Equal(expected, TimeSpan.FromMilliseconds(milliseconds).Humanize());
}

[Fact]
public void NoTime()
{
// This one really doesn't make a lot of sense but again... w/e
Assert.Equal("শূন্য সময়", TimeSpan.Zero.Humanize());
}
}
}
1 change: 1 addition & 0 deletions src/Humanizer/Configuration/FormatterRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public FormatterRegistry() : base(new DefaultFormatter("en-US"))
RegisterDefaultFormatter("nb");
RegisterDefaultFormatter("nb-NO");
RegisterDefaultFormatter("nl");
RegisterDefaultFormatter("bn-BD");
}

private void RegisterDefaultFormatter(string localeCode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public NumberToWordsConverterRegistry() : base(new DefaultNumberToWordsConverter
Register("he", new HebrewNumberToWordsConverter());
Register("sl", new SlovenianNumberToWordsConverter());
Register("de", new GermanNumberToWordsConverter());
Register("bn-BD", new BanglaNumberToWordsConverter());
}
}
}
4 changes: 4 additions & 0 deletions src/Humanizer/Humanizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<Compile Include="Configuration\FormatterRegistry.cs" />
<Compile Include="Configuration\NumberToWordsConverterRegistry.cs" />
<Compile Include="Configuration\OrdinalizerRegistry.cs" />
<Compile Include="Localisation\NumberToWords\BanglaNumberToWordsConverter.cs" />
<Compile Include="Localisation\NumberToWords\BrazilianPortugueseNumberToWordsConverter.cs" />
<Compile Include="GrammaticalCase.cs" />
<Compile Include="GrammaticalGender.cs" />
Expand Down Expand Up @@ -168,6 +169,9 @@
<None Include="Humanizer.snk" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.bn-BD.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.nb.resx" />
<EmbeddedResource Include="Properties\Resources.sl.resx" />
<EmbeddedResource Include="Properties\Resources.tr.resx" />
Expand Down
Loading