Skip to content

Commit

Permalink
Japanese translation improvements
Browse files Browse the repository at this point in the history
EmbeddedResourceStringLocalizer:
1. Fixed a problem where translations would not be found if the Visual
Studio folder name had both the language and culture specified, like
"ja-JP".
2. No longer assumes that the source code strings are English. This
allows for translating "programmer English" to "documentation writer
English".

Simple DOM Editor WPF Sample: added localization support by allowing the
use of embedded resources. Added some Japanese translations.

LocalizableStringExtractor tool: now processes source code directories
of *.cs and *.xaml files, instead of assemblies. In *.xaml files, it
looks for the 'Loc' extension.
  • Loading branch information
Ron2 committed Feb 25, 2015
1 parent 1e6f7c9 commit e4f245b
Show file tree
Hide file tree
Showing 47 changed files with 11,461 additions and 7,141 deletions.
Binary file modified DevTools/Localization/ATF Localization Guide.doc
Binary file not shown.
13,479 changes: 8,029 additions & 5,450 deletions DevTools/Localization/ATF.slp

Large diffs are not rendered by default.

20 changes: 0 additions & 20 deletions DevTools/Localization/AssembliesToLocalize.txt

This file was deleted.

20 changes: 20 additions & 0 deletions DevTools/Localization/DirectoriesToLocalize.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This text file specifies the root directories to search code files for and
# the resulting XML file to produce from those code files.
# Each line has a pair of paths. The first is the path to a directory of code files.
# The second path is the destination XML file.
# The two paths must be separated by a single space.
# Each path needs to be a relative path to the root ATF directory.
# The root of the ATF directory is found by searching from LocalizableStringExtractor's starting
# directory and going up the directory hierarchy until a directory name containing "atf" is
# found.
# Paths with spaces in them need double quotes around the path.
Framework\Atf.Core Framework\Atf.Core\Resources\Localization.xml
Framework\Atf.Gui Framework\Atf.Gui\Resources\Localization.xml
Framework\Atf.Gui.OpenGL Framework\Atf.Gui.OpenGL\Resources\Localization.xml
Framework\Atf.Gui.WinForms Framework\Atf.Gui.WinForms\Resources\Localization.xml
Framework\Atf.Gui.Wpf Framework\Atf.Gui.Wpf\Resources\Localization.xml
Framework\Atf.Perforce Framework\Atf.Perforce\Resources\Localization.xml
"Samples\CircuitEditor" Samples\CircuitEditor\Resources\Localization.xml
"Samples\CodeEditor" "Samples\CodeEditor\Resources\Localization.xml"
"Samples\TimelineEditor" "Samples\TimelineEditor\Resources\Localization.xml"
"Samples\SimpleDomEditorWpf" "Samples\SimpleDomEditorWpf\Resources\Localization.xml"
661 changes: 486 additions & 175 deletions DevTools/Localization/LocalizableStringExtractor/Extractor.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
//Copyright © 2014 Sony Computer Entertainment America LLC. See License.txt.

using System;

namespace LocalizableStringExtractor
{
/// <summary>
/// Contains the data for each English word or phrase that is to be translated.</summary>
public class LocalizableString
public class LocalizableString : IComparable<LocalizableString>
{
public LocalizableString(string text, string context)
{
Expand All @@ -14,6 +16,15 @@ public LocalizableString(string text, string context)
public readonly string Text;
public readonly string Context;

#region IComparable

public int CompareTo(LocalizableString other)
{
return Text.CompareTo(other.Text);
}

#endregion

public override bool Equals(object obj)
{
var other = obj as LocalizableString;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalizableStringExtractor", "LocalizableStringExtractor.csproj", "{DE007657-9550-426E-B276-3DE94D956EF9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "..\UnitTests\UnitTests.csproj", "{91552BDF-8404-48D5-87BE-B35D84ED47BD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -13,6 +17,10 @@ Global
{DE007657-9550-426E-B276-3DE94D956EF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE007657-9550-426E-B276-3DE94D956EF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE007657-9550-426E-B276-3DE94D956EF9}.Release|Any CPU.Build.0 = Release|Any CPU
{91552BDF-8404-48D5-87BE-B35D84ED47BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91552BDF-8404-48D5-87BE-B35D84ED47BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91552BDF-8404-48D5-87BE-B35D84ED47BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91552BDF-8404-48D5-87BE-B35D84ED47BD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
5 changes: 3 additions & 2 deletions DevTools/Localization/LocalizableStringExtractor/Window1.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ATF Localizable String Extractor" Height="163" Width="311" Name="MainWindow" ResizeMode="NoResize">
<Grid Height="75" Width="279" VerticalAlignment="Top" Margin="6,0">
<TextBlock Name="textBlock1" Text="Press Start to create the Localization.xml files for each assembly. If these files need to be checked out from your versioning control system, do that now." TextWrapping="Wrap" Height="54" VerticalAlignment="Top" />
<TextBlock Name="textBlock1" Text="Press Start to create the Localization.xml files for each directory. If these XML files need to be checked out from your versioning control system, do that now." TextWrapping="Wrap" Height="75" VerticalAlignment="Top" />
<Button Height="23" Margin="0,0,80,-44" Name="StartBtn" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75" TabIndex="2147483647" Click="StartBtn_Click">Start</Button>
<Button Height="23" Margin="0,0,0,-44" Name="CancelBtn" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75" Click="CancelBtn_Click">Cancel</Button>
<Button x:Name="AssembliesBtn" Content="Assemblies..." HorizontalAlignment="Left" Height="23" Margin="0,96,0,-44" VerticalAlignment="Top" Width="75" RenderTransformOrigin="0.373,-1.909" Click="AssembliesBtn_Click"/>
<Button x:Name="DirectoriesBtn" Content="Directories..." HorizontalAlignment="Left" Height="23" Margin="0,96,0,-44" VerticalAlignment="Top" Width="75" RenderTransformOrigin="0.373,-1.909" Click="DirectoriesBtn_Click"/>
<ProgressBar x:Name="ExtractionProgressBar" HorizontalAlignment="Left" Height="11" Margin="0,80,0,-16" VerticalAlignment="Top" Width="279"/>
</Grid>
</Window>
17 changes: 14 additions & 3 deletions DevTools/Localization/LocalizableStringExtractor/Window1.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
//Copyright © 2014 Sony Computer Entertainment America LLC. See License.txt.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
Expand All @@ -22,6 +24,15 @@ public partial class Window1 : Window
public Window1()
{
InitializeComponent();

var progressBar = (ProgressBar)this.FindName("ExtractionProgressBar");
progressBar.Minimum = 0;
progressBar.Maximum = 1;
progressBar.Value = 0;
m_extractor.ProgressChanged += (sender, args) =>
{
progressBar.Value = m_extractor.Progress;
};
}

private void StartBtn_Click(object sender, RoutedEventArgs e)
Expand All @@ -35,11 +46,11 @@ private void CancelBtn_Click(object sender, RoutedEventArgs e)
Close();
}

private void AssembliesBtn_Click(object sender, RoutedEventArgs e)
private void DirectoriesBtn_Click(object sender, RoutedEventArgs e)
{
m_extractor.OpenSettingsFile();
}

private Extractor m_extractor = new Extractor();
private readonly Extractor m_extractor = new Extractor();
}
}
6 changes: 6 additions & 0 deletions DevTools/Localization/UnitTests/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
Loading

0 comments on commit e4f245b

Please sign in to comment.