Skip to content

Commit

Permalink
Added WanaKanaOptions class, further project structuring
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Mar 18, 2020
1 parent e30b0bc commit 6e709c5
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 14 deletions.
3 changes: 3 additions & 0 deletions WanaKana.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Hiragana/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Kana/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Katakana/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Romaji/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Romanization/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Wana/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
10 changes: 10 additions & 0 deletions src/WanaKana/Checkers/HiraganaChecker.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace WanaKanaNet.Checkers
{
internal static class HiraganaChecker
{
public static bool IsHiragana(string input)
{
return false;
}
}
}
19 changes: 19 additions & 0 deletions src/WanaKana/Enums/ImeMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WanaKanaNet.Enums
{
/// <summary>
/// Represents available IME modes.
/// </summary>
public enum ImeMode
{
None,
Enabled,
ToHiragana,
ToKatakana
}
}
16 changes: 16 additions & 0 deletions src/WanaKana/Enums/RomanizationMap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WanaKanaNet.Enums
{
/// <summary>
/// Choice of romanization maps.
/// </summary>
public enum RomanizationMap
{
Hepburn,
}
}
3 changes: 3 additions & 0 deletions src/WanaKana/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;

[assembly:InternalsVisibleTo("WanaKanaNet.Tests")]
3 changes: 3 additions & 0 deletions src/WanaKana/WanaKanaNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@
<ItemGroup>
<None Include="images/wanikani.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<Folder Include="Converters\" />
</ItemGroup>
</Project>
62 changes: 62 additions & 0 deletions src/WanaKana/WanaKanaOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System.Collections;
using System.Collections.Generic;
using WanaKanaNet.Enums;

namespace WanaKanaNet
{
/// <summary>
/// Represents conversion configuration options for WanaKana.
/// </summary>
public class WanaKanaOptions
{
/// <summary>
/// Set to true to use obsolete characters, such as ゐ and ゑ.
/// <example>
/// ToHiragana('we', new WanaKanaOptions { UseObsoleteKana = true }) => 'ゑ'
/// </example>
/// </summary>
public bool UseObsoleteKana { get; set; } = false;

/// <summary>
/// Set to true to pass romaji when using mixed syllables with ToKatakana() or ToHiragana().
/// <example>
/// ToHiragana('we', new WanaKanaOptions { PassRomaji = true }) => => "only convert the katakana: ひらがな"
/// </example>
/// </summary>
public bool PassRomaji { get; set; } = false;

/// <summary>
/// Set to true to convert katakana to uppercase using ToRomaji()
/// <example>
/// ToRomaji('ひらがな カタカナ', new WanaKanaOptions { UppercaseKatakana = true }) => "hiragana KATAKANA"
/// </example>
/// </summary>
public bool UppercaseKatakana { get; set; } = false;

/// <summary>
/// Set to true, 'ToHiragana', or 'ToKatakana' to handle conversion while it is being typed.
/// </summary>
public ImeMode ImeMode { get; set; } = ImeMode.None;

/// <summary>
/// Choose ToRomaji() romanization map (currently only 'Hepburn').
/// </summary>
public RomanizationMap Romanization { get; set; } = RomanizationMap.Hepburn;

/// <summary>
/// Custom map will be merged with default conversion.
/// <example>
/// ToKana('wanakana', new WanaKanaOptions { CustomKanaMapping = { { na, 'に'}, { ka, 'Bana'} }) => 'わにBanaに'
/// </example>
/// </summary>
public IDictionary<string, string> CustomKanaMapping { get; set; } = new Dictionary<string, string>();

/// <summary>
/// Custom map will be merged with default conversion.
/// <example>
/// ToRomaji('つじぎり', new WanaKanaOptions { CustomRomajiMapping = { { じ, 'zi'}, { つ, 'tu'}, {り, 'li'} }) }) => 'tuzigili'
/// </example>
/// </summary>
public IDictionary<string, string> CustomRomajiMapping { get; set; } = new Dictionary<string, string>();
}
}
13 changes: 13 additions & 0 deletions tests/WanaKana.Tests/Validators/HiraganaValidatorTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WanaKanaNet.Tests.Validators
{
public class HiraganaValidatorTests
{

}
}
4 changes: 4 additions & 0 deletions tests/WanaKana.Tests/WanaKanaNet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@
<ProjectReference Include="..\..\src\WanaKana\WanaKanaNet.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Converters\" />
</ItemGroup>

</Project>
14 changes: 0 additions & 14 deletions tests/WanaKana.Tests/WanaKanaTests.cs

This file was deleted.

0 comments on commit 6e709c5

Please sign in to comment.