mirror of
https://git.femboyfinancial.jp/james/lipsync.git
synced 2025-11-17 20:03:44 -08:00
git-svn-id: http://svn.sourceforge.jp/svnroot/lipsync@4 b1f601f4-4f45-0410-8980-aecacb008692
This commit is contained in:
79
trunk/lang2po/Program.cs
Normal file
79
trunk/lang2po/Program.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
using Boare.Lib.AppUtil;
|
||||
|
||||
namespace Boare {
|
||||
class lang2po {
|
||||
static void Main( string[] args ) {
|
||||
Console.WriteLine( "input source *.lang file name" );
|
||||
string name = Console.ReadLine();
|
||||
Console.WriteLine( "input result file name" );
|
||||
string result = Console.ReadLine();
|
||||
if ( File.Exists( result ) ) {
|
||||
Console.WriteLine( "error; file \"" + result + "\" already exists." );
|
||||
return;
|
||||
}
|
||||
Messaging.AppendFromFile( "template.po" );
|
||||
Messaging.Language = "template";
|
||||
Dictionary<string, string> dict = new Dictionary<string, string>();
|
||||
using ( StreamReader sr = new StreamReader( name ) ) {
|
||||
string line;
|
||||
while ( (line = sr.ReadLine()) != null ) {
|
||||
string[] spl = line.Split( "\t".ToCharArray() );
|
||||
if ( spl.Length >= 2 ) {
|
||||
string id = spl[0];
|
||||
string item = spl[1];
|
||||
item = item.Replace( "\"", "\\\"" );
|
||||
dict.Add( id, item );
|
||||
}
|
||||
}
|
||||
}
|
||||
using ( StreamWriter sw = new StreamWriter( result, false, Encoding.UTF8 ) ) {
|
||||
sw.WriteLine( "msgid \"\"" );
|
||||
sw.WriteLine( "msgstr \"\"" );
|
||||
sw.WriteLine( "\"Project-Id-Version: \\n\"" );
|
||||
sw.WriteLine( "\"Report-Msgid-Bugs-To: \\n\"" );
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime utc = now.ToUniversalTime();
|
||||
DateTime local = now.ToLocalTime();
|
||||
TimeSpan ts = local.Subtract( utc );
|
||||
int minutes = (int)ts.TotalMinutes;
|
||||
int absmin = Math.Abs( minutes );
|
||||
int hours = absmin / 60;
|
||||
int mins = absmin - hours * 60;
|
||||
string dt = (minutes > 0) ? "+" : "-";
|
||||
dt += hours.ToString( "00" ) + mins.ToString( "00" );
|
||||
sw.WriteLine( "\"POT-Creation-Date: " + local.Year + "-" + local.Month.ToString( "00" ) + "-" + local.Day.ToString( "00" ) + " " + local.Hour.ToString( "00" ) + ":" + local.Minute.ToString( "00" ) + dt + "\\n\"" );
|
||||
sw.WriteLine( "\"PO-Revision-Date: \\n\"" );
|
||||
sw.WriteLine( "\"Last-Translator: \\n\"" );
|
||||
sw.WriteLine( "\"Language-Team: \\n\"" );
|
||||
sw.WriteLine( "\"MIME-Version: 1.0\\n\"" );
|
||||
sw.WriteLine( "\"Content-Type: text/plain; charset=UTF-8\\n\"" );
|
||||
sw.WriteLine( "\"Content-Transfer-Encoding: 8bit\\n\"" );
|
||||
sw.WriteLine( "\"X-Poedit-Language: \\n\"" );
|
||||
sw.WriteLine( "\"X-Poedit-Country: \\n\"" );
|
||||
sw.WriteLine( "\"X-Poedit-SourceCharset: utf-8\\n\"" );
|
||||
sw.WriteLine( "\"X-Poedit-Basepath: .\\\\" + "\\n\"" );
|
||||
sw.WriteLine( "\"X-Poedit-KeywordsList: _\\n\"" );
|
||||
sw.WriteLine( "\"X-Poedit-SearchPath-0: Editor\\n\"" );
|
||||
sw.WriteLine( "\"X-Poedit-SearchPath-1: Common\\n\"" );
|
||||
sw.WriteLine( "\"X-Poedit-SearchPath-2: AviFile\\n\"" );
|
||||
string[] keys = Messaging.GetKeys( "template" );
|
||||
foreach ( string key in keys ) {
|
||||
string oldid = Messaging.GetMessage( key );
|
||||
if ( dict.ContainsKey( oldid ) ) {
|
||||
string item = dict[oldid];
|
||||
item = item.Replace( "\"", "\\\"" );
|
||||
string key2 = key.Replace( "\"", "\\\"" );
|
||||
sw.WriteLine( "msgid \"" + key2 + "\"" );
|
||||
sw.WriteLine( "msgstr \"" + item + "\"" );
|
||||
sw.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
trunk/lang2po/Properties/AssemblyInfo.cs
Normal file
36
trunk/lang2po/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
|
||||
// アセンブリに関連付けられている情報を変更するには、
|
||||
// これらの属性値を変更してください。
|
||||
[assembly: AssemblyTitle( "lang2po" )]
|
||||
[assembly: AssemblyDescription( "" )]
|
||||
[assembly: AssemblyConfiguration( "" )]
|
||||
[assembly: AssemblyCompany( "" )]
|
||||
[assembly: AssemblyProduct( "lang2po" )]
|
||||
[assembly: AssemblyCopyright( "Copyright © 2008" )]
|
||||
[assembly: AssemblyTrademark( "" )]
|
||||
[assembly: AssemblyCulture( "" )]
|
||||
|
||||
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
|
||||
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
|
||||
// その型の ComVisible 属性を true に設定してください。
|
||||
[assembly: ComVisible( false )]
|
||||
|
||||
// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
|
||||
[assembly: Guid( "8154a642-4ae5-4ca6-83f9-95df9878de3d" )]
|
||||
|
||||
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
|
||||
// 既定値にすることができます:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion( "1.0.0.0" )]
|
||||
[assembly: AssemblyFileVersion( "1.0.0.0" )]
|
||||
70
trunk/lang2po/lang2po.csproj
Normal file
70
trunk/lang2po/lang2po.csproj
Normal file
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>lang2po</RootNamespace>
|
||||
<AssemblyName>lang2po</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</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>DEBUG;TRACE</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</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="template.po">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Boare.Lib.AppUtil\Boare.Lib.AppUtil.csproj">
|
||||
<Project>{0C58B068-272F-4390-A14F-3D72AFCF3DFB}</Project>
|
||||
<Name>Boare.Lib.AppUtil</Name>
|
||||
</ProjectReference>
|
||||
</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>
|
||||
1076
trunk/lang2po/template.po
Normal file
1076
trunk/lang2po/template.po
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user