VSProps: Support compiling Qt translation files

pull/680/head
Connor McLaughlin 5 years ago
parent a4e9adad25
commit bb56b169fc

@ -13,6 +13,7 @@
<QtPluginsDir>$(QTDIR)plugins\</QtPluginsDir> <QtPluginsDir>$(QTDIR)plugins\</QtPluginsDir>
<QtToolOutDir>$(SolutionDir)build\$(ProjectName)-$(Platform)-$(Configuration)\</QtToolOutDir> <QtToolOutDir>$(SolutionDir)build\$(ProjectName)-$(Platform)-$(Configuration)\</QtToolOutDir>
<QtMocOutPrefix>$(QtToolOutDir)moc_</QtMocOutPrefix> <QtMocOutPrefix>$(QtToolOutDir)moc_</QtMocOutPrefix>
<QtTsOutDir>$(BinaryOutputDir)translations\</QtTsOutDir>
<QtDebugSuffix>d</QtDebugSuffix> <QtDebugSuffix>d</QtDebugSuffix>
<QtLibSuffix Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='DebugFast'">$(QtDebugSuffix)</QtLibSuffix> <QtLibSuffix Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='DebugFast'">$(QtDebugSuffix)</QtLibSuffix>
<QtPluginFolder>QtPlugins</QtPluginFolder> <QtPluginFolder>QtPlugins</QtPluginFolder>
@ -113,6 +114,9 @@
<AvailableItemName Include="QtMoc"> <AvailableItemName Include="QtMoc">
<Targets>QtMoc</Targets> <Targets>QtMoc</Targets>
</AvailableItemName> </AvailableItemName>
<AvailableItemName Include="QtTs">
<Targets>QtTs</Targets>
</AvailableItemName>
</ItemGroup> </ItemGroup>
<!--Copy the needed dlls--> <!--Copy the needed dlls-->
@ -157,4 +161,25 @@
Overwrite="true" Overwrite="true"
/> />
</Target> </Target>
<!--Compiles all translation files-->
<ItemGroup>
<TsFiles Include="$(MSBuildProjectDirectory)\**\*.ts" />
</ItemGroup>
<Target Name="QtTs"
BeforeTargets="ClCompile"
Inputs="@(TsFiles)"
Condition="'@(QtTs)'!=''"
Outputs="@(TsFiles->'$(QtTsOutDir)%(Filename).qm')">
<Message Text="lrelease %(TsFiles.Filename)" Importance="High" />
<Error Condition="!$(QtDirValid)" Text="QTDIR not set or non-existent (pull the submodule?)" />
<MakeDir Directories="$(QtTsOutDir)" />
<Exec Command="&quot;$(QtBinDir)lrelease.exe&quot; &quot;%(TsFiles.FullPath)&quot; -qm &quot;$(QtTsOutDir)%(TsFiles.Filename).qm&quot;" />
</Target>
<ItemGroup>
<TsOutputs Include="$(QtTsOutDir)*.qm" />
</ItemGroup>
<Target Name="QtTsClean">
<Delete Files="@(TsOutputs)" />
</Target>
</Project> </Project>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<CleanDependsOn>QtResourceClean;QtUiClean;QtMocClean;$(CleanDependsOn)</CleanDependsOn> <CleanDependsOn>QtResourceClean;QtUiClean;QtMocClean;QtTsClean;$(CleanDependsOn)</CleanDependsOn>
<!-- <!--
<ComputeLinkInputsTargets>$(ComputeLinkInputsTargets);QtComputeMocOutput;</ComputeLinkInputsTargets> <ComputeLinkInputsTargets>$(ComputeLinkInputsTargets);QtComputeMocOutput;</ComputeLinkInputsTargets>
<ComputeLibInputsTargets>$(ComputeLibInputsTargets);QtComputeMocOutput;</ComputeLibInputsTargets> <ComputeLibInputsTargets>$(ComputeLibInputsTargets);QtComputeMocOutput;</ComputeLibInputsTargets>

@ -3,9 +3,12 @@
<ItemType Name="QtResource" DisplayName="Qt Resource File" /> <ItemType Name="QtResource" DisplayName="Qt Resource File" />
<ItemType Name="QtUi" DisplayName="Qt User Interface File" /> <ItemType Name="QtUi" DisplayName="Qt User Interface File" />
<ItemType Name="QtMoc" DisplayName="Qt Meta Object File" /> <ItemType Name="QtMoc" DisplayName="Qt Meta Object File" />
<ItemType Name="QtTs" DisplayName="Qt Translation File" />
<ContentType Name="QtUi" DisplayName="Qt User Interface Compiler" /> <ContentType Name="QtUi" DisplayName="Qt User Interface Compiler" />
<ContentType Name="QtResource" DisplayName="Qt Resource Compiler" /> <ContentType Name="QtResource" DisplayName="Qt Resource Compiler" />
<ContentType Name="QtMoc" DisplayName="Qt Meta Object Compiler" /> <ContentType Name="QtMoc" DisplayName="Qt Meta Object Compiler" />
<ContentType Name="QtTs" DisplayName="Qt Translation Compiler" />
<FileExtension Name="*.qrc" ContentType="QtResource" /> <FileExtension Name="*.qrc" ContentType="QtResource" />
<FileExtension Name="*.ui" ContentType="QtUi" /> <FileExtension Name="*.ui" ContentType="QtUi" />
<FileExtension Name="*.ts" ContentType="QtTs" />
</ProjectSchemaDefinitions> </ProjectSchemaDefinitions>
Loading…
Cancel
Save