localized file type descriptors.

This commit is contained in:
morkt 2014-07-30 01:48:37 +04:00
parent 0249ecf40e
commit 8e0f1a36ff
5 changed files with 43 additions and 12 deletions

View File

@ -20,6 +20,7 @@
<BitmapImage x:Key="Icon32x32Help" UriSource="Images/32x32/help.png"/>
<CollectionViewSource x:Key="ListViewSource" Source="{Binding}"/>
<local:BooleanToCollapsedVisibilityConverter x:Key="booleanToCollapsedVisibilityConverter" />
<local:EntryTypeConverter x:Key="entryTypeConverter"/>
<Style x:Key="HeaderLeftAlign" TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="HorizontalContentAlignment" Value="Left"></Setter>
</Style>
@ -217,7 +218,7 @@
<DataTemplate><TextBlock x:Name="item_Name" Text="{Binding Path=Name}"/></DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn HeaderContainerStyle="{StaticResource HeaderLeftAlign}" Width="{Binding Source={x:Static p:Settings.Default}, Path=lvTypeColumnWidth, Mode=TwoWay}" HeaderTemplate="{StaticResource SortArrowNone}" DisplayMemberBinding="{Binding Path=Type}">
<GridViewColumn HeaderContainerStyle="{StaticResource HeaderLeftAlign}" Width="{Binding Source={x:Static p:Settings.Default}, Path=lvTypeColumnWidth, Mode=TwoWay}" HeaderTemplate="{StaticResource SortArrowNone}" DisplayMemberBinding="{Binding Path=Type, Mode=OneWay, Converter={StaticResource entryTypeConverter}}">
<GridViewColumn.Header>
<GridViewColumnHeader Tag="Type" Content="{x:Static s:guiStrings.HeaderType}"/>
</GridViewColumn.Header>

View File

@ -594,15 +594,6 @@ namespace GARbro.GUI.Strings {
}
}
/// <summary>
/// Looks up a localized string similar to &lt;DIR&gt;.
/// </summary>
public static string TextDirType {
get {
return ResourceManager.GetString("TextDirType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Text encoding.
/// </summary>
@ -692,5 +683,14 @@ namespace GARbro.GUI.Strings {
return ResourceManager.GetString("TooltipForward", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;DIR&gt;.
/// </summary>
public static string Type_directory {
get {
return ResourceManager.GetString("Type_directory", resourceCulture);
}
}
}
}

View File

@ -285,7 +285,7 @@
<data name="TextCreateArchiveError" xml:space="preserve">
<value>Archive creation error</value>
</data>
<data name="TextDirType" xml:space="preserve">
<data name="Type_directory" xml:space="preserve">
<value>&lt;DIR&gt;</value>
</data>
<data name="TextEncoding" xml:space="preserve">

View File

@ -333,4 +333,13 @@
<data name="MsgCreatingArchive" xml:space="preserve">
<value>Создание архива {0}</value>
</data>
<data name="Type_archive" xml:space="preserve">
<value>архив</value>
</data>
<data name="Type_image" xml:space="preserve">
<value>изображение</value>
</data>
<data name="Type_script" xml:space="preserve">
<value>сценарий</value>
</data>
</root>

View File

@ -33,6 +33,7 @@ using System.Collections.Specialized;
using System.ComponentModel;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Windows.Data;
using GameRes;
using GARbro.GUI.Strings;
@ -40,7 +41,7 @@ namespace GARbro.GUI
{
public class SubDirEntry : GameRes.Entry
{
public override string Type { get { return guiStrings.TextDirType; } }
public override string Type { get { return "directory"; } }
public SubDirEntry (string name)
{
@ -320,4 +321,24 @@ namespace GARbro.GUI
Item = System.IO.Path.GetFileName (filename);
}
}
public class EntryTypeConverter : IValueConverter
{
public object Convert (object value, Type targetType, object parameter, CultureInfo culture)
{
var type = value as string;
if (!string.IsNullOrEmpty (type))
{
var translation = guiStrings.ResourceManager.GetString ("Type_"+type, guiStrings.Culture);
if (!string.IsNullOrEmpty (translation))
return translation;
}
return value;
}
public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}