Support for PO files compilation added

This commit is contained in:
Simon Rozman 2016-02-08 12:02:24 +01:00
parent d7e5920cc2
commit efc1746db1
10 changed files with 217 additions and 2 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@
temp
/*.opensdf
/ZRCola/locale/*.mo
/output/locale/sl/ZRCola.mo

View File

@ -6,6 +6,9 @@
<OutDir>..\output\$(Platform).$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup>
<POCompile>
<OutputFile>..\output\locale\%(Filename)\$(ProjectName).mo</OutputFile>
</POCompile>
<ClCompile>
<AdditionalIncludeDirectories>..\lib\wxExtend\include</AdditionalIncludeDirectories>
</ClCompile>

View File

@ -102,7 +102,11 @@
<ItemGroup>
<ResourceCompile Include="ZRCola.rc" />
</ItemGroup>
<ItemGroup>
<POCompile Include="locale\sl.po" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\include\xgettext.targets" />
</ImportGroup>
</Project>

View File

@ -13,6 +13,10 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Resource Files\Localization">
<UniqueIdentifier>{e43059ae-37ac-4b28-84fb-18d1b3972b30}</UniqueIdentifier>
<Extensions>po;pot</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
@ -55,4 +59,9 @@
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<POCompile Include="locale\sl.po">
<Filter>Resource Files\Localization</Filter>
</POCompile>
</ItemGroup>
</Project>

View File

@ -18,7 +18,9 @@
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<ImportGroup Label="ExtensionSettings">
<Import Project="xgettext.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>temp\$(ProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</IntDir>
@ -45,6 +47,9 @@
<ResourceCompile>
<PreprocessorDefinitions>WINVER=0x0501;_WIN32_WINNT=0x0501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<POCompile>
<CheckAccel>Amperstand</CheckAccel>
</POCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

45
include/xgettext.props Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 1991-2016 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(POCompileBeforeTargets)' == '' and '$(POCompileAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
<POCompileBeforeTargets>Midl</POCompileBeforeTargets>
<POCompileAfterTargets>CustomBuild</POCompileAfterTargets>
</PropertyGroup>
<PropertyGroup>
<POCompilationDependsOn Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(POCompilationDependsOn)</POCompilationDependsOn>
</PropertyGroup>
<ItemDefinitionGroup>
<POCompile>
<OperationMode>MO</OperationMode>
<Strict>false</Strict>
<CheckFormat>false</CheckFormat>
<CheckHeader>false</CheckHeader>
<CheckDomain>false</CheckDomain>
<CheckCompat>false</CheckCompat>
<CheckAccel>None</CheckAccel>
<OutputFile>$(OutDir)%(Filename).mo</OutputFile>
<UseFuzzy>false</UseFuzzy>
<Alignment>1</Alignment>
<Endianess>LSB</Endianess>
<AdditionalOptions></AdditionalOptions>
<CommandLineTemplate>msgfmt.exe [AllOptions] [AdditionalOptions] [Inputs]</CommandLineTemplate>
</POCompile>
</ItemDefinitionGroup>
</Project>

65
include/xgettext.targets Normal file
View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 1991-2016 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
<AvailableItemName Include="POCompile">
<Targets>POCompile</Targets>
</AvailableItemName>
</ItemGroup>
<UsingTask TaskName="POCompile" TaskFactory="XamlTaskFactory" AssemblyName="Microsoft.Build.Tasks.v4.0">
<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
</UsingTask>
<Target
Name="POCompile"
BeforeTargets="$(POCompileBeforeTargets)"
AfterTargets="$(POCompileAfterTargets)"
DependsOnTargets="$(POCompilationDependsOn)"
Inputs="@(POCompile);$(MSBuildProjectFile)"
Outputs="%(POCompile.OutputFile)"
>
<ItemGroup Condition="'@(SelectedFiles)' != ''">
<POCompile Remove="@(POCompile)" Condition="'%(Identity)' != '@(SelectedFiles)'" />
</ItemGroup>
<Message Text="Compiling localization catalogues..." />
<POCompile
Condition="'@(POCompile)' != '' and '%(POCompile.ExcludedFromBuild)' != 'true'"
Inputs="@(POCompile)"
OperationMode="%(POCompile.OperationMode)"
Strict="%(POCompile.Strict)"
CheckFormat="%(POCompile.CheckFormat)"
CheckHeader="%(POCompile.CheckHeader)"
CheckDomain="%(POCompile.CheckDomain)"
CheckCompat="%(POCompile.CheckCompat)"
CheckAccel="%(POCompile.CheckAccel)"
OutputFile="%(POCompile.OutputFile)"
UseFuzzy="%(POCompile.UseFuzzy)"
Alignment="%(POCompile.Alignment)"
Endianess="%(POCompile.Endianess)"
AdditionalOptions="%(POCompile.AdditionalOptions)"
CommandLineTemplate="%(POCompile.CommandLineTemplate)" />
</Target>
<Target Name="POCompilationClean">
<Delete Files="%(POCompile.OutputFile)" ContinueOnError="true" />
</Target>
<PropertyGroup>
<CleanDependsOn>POCompilationClean;$(CleanDependsOn);</CleanDependsOn>
</PropertyGroup>
</Project>

83
include/xgettext.xml Normal file
View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 1991-2016 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
-->
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertPropertyCallback">
<Rule Name="POCompile" PageTemplate="tool" DisplayName="PO Compiler" SwitchPrefix="--" Order="200">
<Rule.DataSource>
<DataSource Persistence="ProjectFile" ItemType="POCompile" />
</Rule.DataSource>
<Rule.Categories>
<Category Name="General" DisplayName="General" />
<Category Name="Input" DisplayName="Input" />
<Category Name="Output" DisplayName="Output" />
<Category Name="Command Line" DisplayName="Command Line" Subtype="CommandLine" />
</Rule.Categories>
<EnumProperty Category="General" Name="OperationMode" DisplayName="Operation Mode" Description="Specifies the operation mode.">
<EnumValue Name="MO" DisplayName="Default" Description="Generate MO file (default)." />
<EnumValue Name="Java" Switch="java" DisplayName="Java" Description="Generate a Java ResourceBundle class." />
<EnumValue Name="Java2" Switch="java2" DisplayName="Java2" Description="Like Java, and assume Java2 (JDK 1.2 or higher)." />
<EnumValue Name="Csharp" Switch="csharp" DisplayName="C#" Description="Generate a .NET .dll file." />
<EnumValue Name="CsharpRes" Switch="csharp-resources" DisplayName="C# Resource" Description="Generate a .NET .resources file." />
<EnumValue Name="Tcl" Switch="tcl" DisplayName="Tcl" Description="Generate a tcl/msgcat .msg file." />
<EnumValue Name="Qt" Switch="qt" DisplayName="Qt" Description="Generate a Qt .qm file." />
<EnumValue Name="Desktop" Switch="desktop" DisplayName="Desktop Entry" Description="Generate a .desktop file." />
</EnumProperty>
<BoolProperty Category="General" Name="Strict" Switch="strict" DisplayName="Enable strict mode" Description="Enable strict Uniforum mode." />
<BoolProperty Category="Input" Name="CheckFormat" Switch="check-format" DisplayName="Check Format" Description="Check language dependent format strings." />
<BoolProperty Category="Input" Name="CheckHeader" Switch="check-header" DisplayName="Check Header" Description="Verify presence and contents of the header entry." />
<BoolProperty Category="Input" Name="CheckDomain" Switch="check-domain" DisplayName="Check Domain" Description="Check for conflicts between domain directives and the --output-file option." />
<BoolProperty Category="Input" Name="CheckCompat" Switch="check-compatibility" DisplayName="Check Compatibility" Description="Check that GNU msgfmt behaves like X/Open msgfmt." />
<EnumProperty Category="Input" Name="CheckAccel" DisplayName="Check Accelerators" Description="Check presence of keyboard accelerators for menu items.">
<EnumValue Name="None" DisplayName="None" Description="No check" />
<EnumValue Name="Amperstand" Switch="check-accelerators=&quot;&amp;&quot;" DisplayName="Amperstand" Description="Check keyborad accellerator marked with an amperstand &amp;." />
</EnumProperty>
<StringProperty Category="Output" Name="OutputFile" Switch="output-file=" DisplayName="Output File" Description="The name and location of the output file that compiler creates." Subtype="file" />
<BoolProperty Category="Output" Name="UseFuzzy" Switch="use-fuzzy" DisplayName="Use Fuzzy Entries" Description="Use fuzzy entries in output." />
<IntProperty Category="Output" Name="Alignment" Switch="alignment=" DisplayName="Align Strings" Description="Align strings to given bytes (default: 1)." />
<EnumProperty Category="Output" Name="Endianess" DisplayName="Endianess" Description="Write out 32-bit numbers in the given byte order (default: platform specific).">
<EnumValue Name="LSB" Switch="endianness=little" DisplayName="LSB" Description="Least significant byte first" />
<EnumValue Name="MSB" Switch="endianness=big" DisplayName="MSB" Description="Most significant byte first" />
</EnumProperty>
<StringListProperty Category="Command Line" Name="Inputs" Subtype="file" IsRequired="true" >
<StringListProperty.DataSource>
<DataSource Persistence="ProjectFile" ItemType="POCompile" SourceType="Item" />
</StringListProperty.DataSource>
</StringListProperty>
<StringProperty Category="Command Line" Name="AdditionalOptions" Subtype="AdditionalOptions" DisplayName="Additional Options" Description="Additional Options" />
<DynamicEnumProperty Category="Command Line" Name="POCompileBeforeTargets" EnumProvider="Targets" DisplayName="Execute Before" Description="Specifies the targets for the build customization to run before." IncludeInCommandLine="False">
<DynamicEnumProperty.ProviderSettings>
<NameValuePair Name="Exclude" Value="^POCompileBeforeTargets|^Compute" />
</DynamicEnumProperty.ProviderSettings>
<DynamicEnumProperty.DataSource>
<DataSource Persistence="ProjectFile" HasConfigurationCondition="true" />
</DynamicEnumProperty.DataSource>
</DynamicEnumProperty>
<DynamicEnumProperty Category="Command Line" Name="POCompileAfterTargets" EnumProvider="Targets" DisplayName="Execute After" Description="Specifies the targets for the build customization to run after." IncludeInCommandLine="False">
<DynamicEnumProperty.ProviderSettings>
<NameValuePair Name="Exclude" Value="^POCompileAfterTargets|^Compute" />
</DynamicEnumProperty.ProviderSettings>
<DynamicEnumProperty.DataSource>
<DataSource Persistence="ProjectFile" ItemType="" HasConfigurationCondition="true" />
</DynamicEnumProperty.DataSource>
</DynamicEnumProperty>
</Rule>
<ItemType Name="POCompile" DisplayName="PO Compiler" />
<FileExtension Name="*.po" ContentType="POCompile" />
<ContentType Name="POCompile" DisplayName="PO Compiler" ItemType="POCompile" />
</ProjectSchemaDefinitions>

@ -1 +1 @@
Subproject commit c86e4f51b5c99f51abca368270084672466fcb42
Subproject commit 62c74b569466bd74da766c761be96a1e017c025e

Binary file not shown.