Skip to content

Commit

Permalink
Merge pull request #18 from EQAditu/Localization-267
Browse files Browse the repository at this point in the history
Localization 267
  • Loading branch information
EQAditu committed Jan 27, 2020
2 parents a475269 + 9ed27dd commit 3e56263
Show file tree
Hide file tree
Showing 13 changed files with 565 additions and 374 deletions.
3 changes: 1 addition & 2 deletions Localization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ Starting ACT with the `-exportcontroltext` commandline switch will export easily
Each form will export a single XML file that can technically be used by the `-importcontroltext` switch, but should be used as a plugin resource and fed into a method such as [`ImportControlTextXML()`](https://advancedcombattracker.com/apidoc/?topic=html/M_Advanced_Combat_Tracker_FormActMain_ImportControlTextXML.htm).

Additionally ***.InternalStrings.cs** will also be exported with dynamically used strings. (These should be sorted alphabetically to make tracking easier)
This *.cs file can be directly loaded by ACT as a plugin, or you may compile the **ActLocalization.csproj** project to include the XML files as well.

Lastly, there will be localizable strings used in parsing/data. These should be changed by parsing plugins, however secondary plugins loaded afterwards could also do this localization. See the [EQ2 English parsing plugin](https://github.com/EQAditu/AdvancedCombatTracker/blob/master/Plugins/Standalone/ACT_English_Parser.cs#L1877) as a primary example of localizing all of these objects by replacing them. ACT by default will start with these **EQ2 English** objects and plugins can remove these objects and recreate them with different localized strings.

The "en-US" folder will contain ACT's default exports for the most recent version. Any localization efforts/pull requests should target a different folder labeled after their locale and contain the same files.

Contols in the XML exports prefixed with `tb`, `nud` and `ddl` are typically config options that should not be localized in the XML files, as they are logical settings. They might be excluded in future exports to be safe.
72 changes: 72 additions & 0 deletions Localization/en-US/ActLocalization.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E8253A9D-199D-46A9-A017-572CD97701A0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ActLocalization</RootNamespace>
<AssemblyName>ActLocalization</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;XMLINCLUDED</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;XMLINCLUDED</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Advanced Combat Tracker">
<HintPath>C:\Program Files (x86)\Advanced Combat Tracker\Advanced Combat Tracker.exe</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<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="ActLocalizationPlugin.cs" />
<Compile Include="Advanced Combat Tracker.exe.InternalStrings.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormActMain.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormAlliesEdit.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormByCombatantLookup.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormCombatantSearch.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormCustomTriggerBenchmark.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormEncounterLogs.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormEncounterVcr.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormExportFormat.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormImportProgress.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormMiniParse.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormPerformanceWizard.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormResistsDeathReport.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormScratchRange.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormSpellRecastCalc.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormSpellTimers.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormSqlQuery.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormStartupWizard.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormTimeLine.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormUpdater.xml" />
<EmbeddedResource Include="Advanced Combat Tracker.exe.FormXmlSettingsIO.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
64 changes: 64 additions & 0 deletions Localization/en-US/ActLocalizationPlugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using Advanced_Combat_Tracker;
using System.IO;
using System.Reflection;
using System.Windows.Forms;

namespace ActLocalization
{
class ActLocalizationPlugin : IActPluginV1
{
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
{
ActLocalization.InternalStrings.EditLocalizations();
if (ActGlobals.oFormActMain.InitActDone == false) // Will throw a lot of exceptions if loaded after startup
{
Assembly asm = Assembly.GetExecutingAssembly();
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormActMain.xml"))
ActGlobals.oFormActMain.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormAlliesEdit.xml"))
ActGlobals.oFormAlliesEdit.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormByCombatantLookup.xml"))
ActGlobals.oFormByCombatantLookup.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormCombatantSearch.xml"))
ActGlobals.oFormCombatantSearch.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormCustomTriggerBenchmark.xml"))
ActGlobals.oFormCustomTriggerBenchmark.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormEncounterLogs.xml"))
ActGlobals.oFormEncounterLogs.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormEncounterVcr.xml"))
ActGlobals.oFormEncounterVcr.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormExportFormat.xml"))
ActGlobals.oFormExportFormat.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormImportProgress.xml"))
ActGlobals.oFormImportProgress.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormMiniParse.xml"))
ActGlobals.oFormMiniParse.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormPerformanceWizard.xml"))
ActGlobals.oFormPerformanceWizard.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormResistsDeathReport.xml"))
ActGlobals.oFormResistsDeathReport.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormScratchRange.xml"))
ActGlobals.oFormScratchRange.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormSpellRecastCalc.xml"))
ActGlobals.oFormSpellRecastCalc.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormSpellTimers.xml"))
ActGlobals.oFormSpellTimers.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormSqlQuery.xml"))
ActGlobals.oFormSqlQuery.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormStartupWizard.xml"))
ActGlobals.oFormStartupWizard.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormTimeLine.xml"))
ActGlobals.oFormTimeLine.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormUpdater.xml"))
ActGlobals.oFormUpdater.ImportControlTextXML(s);
using (Stream s = asm.GetManifestResourceStream("ActLocalization.Advanced Combat Tracker.exe.FormXmlSettingsIO.xml"))
ActGlobals.oFormXmlSettingsIO.ImportControlTextXML(s);
}
pluginStatusText.Text = "Localization Complete";
pluginScreenSpace.Parent.Controls.Remove(pluginScreenSpace);
}
public void DeInitPlugin()
{
}
}
}
Loading

0 comments on commit 3e56263

Please sign in to comment.