Skip to content

Commit

Permalink
localization support
Browse files Browse the repository at this point in the history
  • Loading branch information
CreepGin committed Oct 13, 2012
1 parent 0695c13 commit 7a77629
Show file tree
Hide file tree
Showing 30 changed files with 743 additions and 224 deletions.
Binary file modified Build/D3Bit.dll
Binary file not shown.
Binary file added Build/D3BitConsole.exe
Binary file not shown.
Binary file modified Build/D3BitGUI.exe
Binary file not shown.
3 changes: 3 additions & 0 deletions Build/D3BitGUI.exe.config
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
<setting name="D3UpDefaultBuildNumber" serializeAs="String">
<value>0</value>
</setting>
<setting name="ScanLanguage" serializeAs="String">
<value>eng</value>
</setting>
</D3BitGUI.Properties.Settings>
</userSettings>
</configuration>
3 changes: 3 additions & 0 deletions Build/D3BitGUI.vshost.exe.config
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
<setting name="D3UpDefaultBuildNumber" serializeAs="String">
<value>0</value>
</setting>
<setting name="ScanLanguage" serializeAs="String">
<value>eng</value>
</setting>
</D3BitGUI.Properties.Settings>
</userSettings>
</configuration>
129 changes: 129 additions & 0 deletions Build/data/affixes.eng.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"Str" : "+{I} Strength",
"Int" : "+{I} Intelligence",
"Dex" : "+{I} Dexterity",
"Vit" : "+{I} Vitality",

"AR" : "+{I} Resistance to All Elements",
"ArcR" : "+{I} Arcane Resistance",
"ColdR" : "+{I} Cold Resistance",
"FireR" : "+{I} Fire Resistance",
"PoisonR" : "+{I} Poison Resistance",
"LtnR" : "+{I} Lightning Resistance",
"PhyR" : "+{I} Physical Resistance",

"ArcD" : "+{I}-{I} Arcane Damage",
"ColdD" : "+{I}-{I} Cold Damage",
"FireD" : "+{I}-{I} Fire Damage",
"HolyD" : "+{I}-{I} Holy Damage",
"PoisonD" : "+{I}-{I} Poison Damage",
"LtnD" : "+{I}-{I} Lightning Damage",
"Dmg" : "+{I}-{I} Damage",
"Dmg%" : "+{I}% Damage",
"MinD" : "+{I} Minimum Damage",
"MaxD" : "+{I} Maximum Damage",
"AtkSpd" : "Increases Attack Speed by {I}%",
"Crit" : "Critical Hit Chance Increased by {F}%",
"CritD" : "Critical Hit Damage Increased by {I}%",

"LoH" : "Each Hit Adds +{I} Life",
"LoK" : "+{I} Life after Each Kill",
"LS" : "{F}% of Damage Dealt Is Converted to Life",
"LPS" : "Gain {F} per Spirit Spent",
"Life%" : "+{I}% Life",
"LRegen" : "Regenerates {I} Life per Second",
"GlobeHP" : "Health Globes grant +{I} Life.",

"MF" : "{I}% Better Chance of Finding Magical Items",
"GF" : "{I}% Extra Gold from Monsters",
"Exp" : "Monster kills grant +{I} experience.",
"MvSpd" : "+{I}% Movement Speed",
"Pick" : "Increases Gold and Health Pickup by {I} Yards",
"LvlRe" : "Level Requirement Reduced by {I}",

"MaxArcP" : "+{I} Maximum Arcane Power",
"ArcPCrit" : "Critical Hits grant {I} Arcane Power",
"HateRegen" : "Increases Hatred Regeneration by {F} per Second",
"MaxMana" : "+{I} Maximum Mana",
"ManaRegen" : "Increases Mana Regeneration by {F} per Second",
"MaxDisc" : "+{I} Maximum Discipline",
"MaxFury" : "+{I} Maximum Fury",
"SpiritRegen" : "Increases Spirit Regeneration by {F} per Second",

"Chill" : "{F}% Chance to Chill on Hit",
"Fear" : "{F}% Chance to Fear on Hit",
"Freeze" : "{F}% Chance to Freeze on Hit",
"Immobilize" : "{F}% Chance to Immobilize on Hit",
"Knockback" : "{F}% Chance to Knockback on Hit",
"Slow" : "{F}% Chance to Slow on Hit",
"Stun" : "{F}% Chance to Stun on Hit",
"ReCC" : "Reduces duration of control impairing effects by {I}%",

"RDElite" : "Reduces damage from elites by {I}%.",
"RDMelee" : "Reduces damage from melee attacks by {I}%.",
"RDRanged" : "Reduces damage from ranged attacks by {I}%.",

"Armor" : "+{I} Armor",
"Block" : "+{I}% Chance to Block",
"Ind" : "Ignores Durability Loss",
"Thorn" : "Melee attackers take {I} damage per hit",
"Bleed" : "{F}% chance to inflict Bleed for {I}-{I} damage over 5 seconds.",
"Soc" : "Empty Socket",

"B-HoA" : "Reduces resource cost of Hammer of the Ancients by {i} Fury.",
"B-OP" : "Increases Critical Chance of Overpower by {i}%",
"B-SS" : "Increases Critical Chance of Seismic Slam by {i}%",
"B-WW" : "Increases Critical Chance of Whirlwind by {i}%",
"D-BS" : "Increases Bola Shot Damage by {i}%",
"D-EA" : "Increases Elemental Arrow Damage by {i}%",
"D-ES" : "Increases Entangling Shot Damage by {i}%",
"D-HA" : "Increases Hungering Arrow Damage by {i}%",
"D-MS" : "Increases Critical Chance of Multishot by {i}%",
"D-RF" : "Increases Critical Chance of Rapid Fire by {i}%",
"M-LTK" : "Reduces resource cost of Lashing Tail Kick by {i} Spirit.",
"M-TR" : "Increases Critical Chance of Tempest Rush by {i}%",
"M-WoL" : "Increases Critical Chance of Wave of Light by {i}%",
"W-FBomb" : "Reduces resource cost of Firebomb by {i} Mana.",
"W-Haunt" : "Increases Haunt Damage by {i}%",
"W-PoT" : "Increases Plague of Toads Damage by {i}%",
"W-PD" : "Increases Poison Dart Damage by {i}%",
"W-SB" : "Increases Spirit Barrage Damage by {i}%",
"W-WoZ" : "Reduces cooldown of Wall of Zombies by {i} seconds.",
"W-ZC" : "Reduces resource cost of Zombie Charger by {i} Mana.",
"Z-ET" : "Increases Critical Chance of Energy Twister by {i}%",
"Z-MM" : "Increases Magic Missile Damage by {i}%",
"Z-AO" : "Increases Critical Chance of Arcane Orb by {i}%",
"Z-Blizz" : "Increases duration of Blizzard by {i} seconds",
"Z-Meteor" : "Reduces resource cost of Meteor by {i} Arcane Power.",
"Z-SP" : "Increases Shock Pulse Damage by {i}%",
"Z-SB" : "Increases Spectral Blade Damage by {i}%",

"B-Bash" : "Increases Bash Damage by {i}%",
"B-Cleave" : "Increases Cleave Damage by {i}%",
"B-Frenzy" : "Increases Frenzy Damage by {i}%",
"B-Rend" : "Reduces resource cost of Rend by {i} Fury.",
"B-Revenge" : "Increases Critical Chance of Revenge by {i}%",
"B-WThrow" : "Reduces resource cost of Weapon Throw by {i} Fury.",
"D-Chakram" : "Reduces resource cost of Chakram by {i} Hatred.",
"D-EFire" : "Increases Evasive Fire Damage by {i}%",
"D-Grenades" : "Increases Grenades Damage by {i}%",
"D-Impale" : "Reduces resource cost of Impale by {i} Hatred.",
"D-STrap" : "Increases Spike Trap Damage by {i}%",
"M-CWave" : "Increases Crippling Wave Damage by {i}%",
"M-CStrke" : "Reduces resource cost of Cyclone Strike by {i} Spirit.",
"M-DReach" : "Increases Deadly Reach Damage by {i}%",
"M-EPalm" : "Increases Exploding Palm Damage by {i}%",
"M-FoT" : "Increases Fists of Thunder Damage by {i}%",
"M-SWind" : "Increases Sweeping Wind Damage by {i}%",
"M-WotHF" : "Increases Way of the Hundred Fists Damage by {i}%",
"W-ACloud" : "Increases Critical Chance of Acid Cloud by {i}%",
"W-FBats" : "Reduces resource cost of Fire Bats by {i} Mana.",
"W-LSwarm" : "Increases Locust Swarm Damage by {i}%",
"W-ZDogs" : "Reduces cooldown of Summon Zombie Dogs by {i} seconds.",
"Z-ATorrent" : "Reduces resource cost of Arcane Torrent by {i} Arcane Power.",
"Z-DisInt" : "Reduces resource cost of Disintegrate by {i} Arcane Power.",
"Z-Elec" : "Increases Electrocute Damage by {i}%",
"Z-EB" : "Increases Critical Chance of Explosive Blast by {i}%",
"Z-Hydra" : "Reduces resource cost of Hydra by {i} Arcane Power.",
"Z-RoF" : "Increases Critical Chance of Ray of Frost by {i}%"
}
4 changes: 0 additions & 4 deletions Build/tmp/.gitignore

This file was deleted.

1 change: 1 addition & 0 deletions D3Bit/D3Bit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" />
<Reference Include="NHunspell, Version=0.9.5.0, Culture=neutral, PublicKeyToken=1ac793ea843b4366, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
9 changes: 9 additions & 0 deletions D3Bit/Data.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace D3Bit
{
Expand Down Expand Up @@ -207,5 +210,11 @@ public static class Data
{"Z-RoF", "Increases Critical Chance of Ray of Frost by {i}%"}
};

public static void LoadAffixes(string languageCode)
{
string json = File.ReadAllText(string.Format(@"data\affixes.{0}.json", languageCode));
affixMatches = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
}

}
}
113 changes: 57 additions & 56 deletions D3Bit/Tesseract.cs
Original file line number Diff line number Diff line change
@@ -1,56 +1,57 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using NHunspell;

namespace D3Bit
{
public static class Tesseract
{
private static Hunspell hunspell = new Hunspell("en_us.aff", "en_us.dic");

public static string GetTextFromBitmap(Bitmap bitmap)
{
return GetTextFromBitmap(bitmap, @"nobatch tesseract\d3letters");
}

public static string GetTextFromBitmap(Bitmap bitmap, string extraParams)
{
//StopWatch sw = new StopWatch();
bitmap.Save(@"tesseract\x.png", ImageFormat.Png);
//sw.Lap("File Save");
ProcessStartInfo info = new ProcessStartInfo(@"tesseract\tesseract.exe", @"tesseract\x.png tesseract\x " + extraParams);
info.WindowStyle = ProcessWindowStyle.Hidden;
Process p = Process.Start(info);
p.WaitForExit();
//sw.Lap("Tesseract");
TextReader tr = new StreamReader(@"tesseract\x.txt");
string res = tr.ReadToEnd();
tr.Close();
//File.Delete(@"tesseract\x.png");
//File.Delete(@"tesseract\x.txt");
return res.Trim();
}

public static string CorrectSpelling(string text)
{
string[] words = text.Split(new[] { ' ' });
string res = "";
foreach (var word in words)
{
var suggestions = hunspell.Suggest(word);
if (suggestions.Count > 0 && !hunspell.Spell(word))
res += suggestions[0] + " ";
else
res += word + " ";
}
return res.Trim();
}

}
}
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using NHunspell;

namespace D3Bit
{
public static class Tesseract
{
private static Hunspell hunspell = new Hunspell("en_us.aff", "en_us.dic");
public static string language_code = "eng";

public static string GetTextFromBitmap(Bitmap bitmap)
{
return GetTextFromBitmap(bitmap, @"nobatch tesseract\d3letters");
}

public static string GetTextFromBitmap(Bitmap bitmap, string extraParams)
{
//StopWatch sw = new StopWatch();
bitmap.Save(@"tesseract\x.png", ImageFormat.Png);
//sw.Lap("File Save");
ProcessStartInfo info = new ProcessStartInfo(@"tesseract\tesseract.exe", string.Format(@"tesseract\x.png tesseract\x -l {0} {1}", language_code, extraParams));
info.WindowStyle = ProcessWindowStyle.Hidden;
Process p = Process.Start(info);
p.WaitForExit();
//sw.Lap("Tesseract");
TextReader tr = new StreamReader(@"tesseract\x.txt");
string res = tr.ReadToEnd();
tr.Close();
//File.Delete(@"tesseract\x.png");
//File.Delete(@"tesseract\x.txt");
return res.Trim();
}

public static string CorrectSpelling(string text)
{
string[] words = text.Split(new[] { ' ' });
string res = "";
foreach (var word in words)
{
var suggestions = hunspell.Suggest(word);
if (suggestions.Count > 0 && !hunspell.Spell(word))
res += suggestions[0] + " ";
else
res += word + " ";
}
return res.Trim();
}

}
}
64 changes: 64 additions & 0 deletions D3BitConsole/D3BitConsole.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{44016DE9-AA93-4C12-86A0-FC47CBA865E0}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>D3BitConsole</RootNamespace>
<AssemblyName>D3BitConsole</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Build\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="D3Bit">
<HintPath>..\Build\D3Bit.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\Build\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Loading

0 comments on commit 7a77629

Please sign in to comment.