mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-25 07:05:40 +00:00
MSBuild: Generate combined .qm files
This commit is contained in:
parent
99c30b1e80
commit
7120b19ab7
|
@ -136,7 +136,7 @@
|
|||
AfterTargets="Build"
|
||||
Inputs="@(QtDlls);@(QtPlugins);@(QtTLSDlls)"
|
||||
Outputs="@(QtDlls -> '$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(Extension)');@(QtPluginsDest);@(QtTLSDllsDest)">
|
||||
<Message Text="Copying Qt .dlls" Importance="High" />
|
||||
<Message Text="Copying Qt .dlls" />
|
||||
<Copy
|
||||
SourceFiles="@(QtDlls)"
|
||||
DestinationFolder="$(BinaryOutputDir)"
|
||||
|
@ -167,25 +167,38 @@
|
|||
/>
|
||||
</Target>
|
||||
|
||||
<!--Copies base translation files, need to rename them from qtbase_ to qt_ -->
|
||||
<!--Copies base translation files, and combines split into one -->
|
||||
<ItemGroup>
|
||||
<BaseTsFiles Include="$(QtTranslationsDir)\qtbase*.qm" />
|
||||
<AllQmFiles Include="$(QtTranslationsDir)qt*.qm">
|
||||
<Language>$([System.String]::Copy('%(Filename)').Substring($([MSBuild]::Add($([System.String]::Copy('%(Filename)').IndexOf('_')), 1))))</Language>
|
||||
</AllQmFiles>
|
||||
<BaseQmFiles Include="$(QtTranslationsDir)qtbase_*.qm" />
|
||||
<SourceMergeQmFileNames Include="@(BaseQmFiles -> '%(Filename)%(Extension)'->Replace('qtbase_', 'qt_'))" />
|
||||
<SourceMergeQmFiles Include="@(SourceMergeQmFileNames -> '$(QtTranslationsDir)%(Filename)%(Extension)')" />
|
||||
<MergedQmFiles Include="@(SourceMergeQmFileNames -> '$(QtTsOutDir)%(Filename)%(Extension)')">
|
||||
<Language>$([System.String]::Copy('%(Filename)').Replace('qt_', ''))</Language>
|
||||
</MergedQmFiles>
|
||||
<CopyTsFilesSource Include="$(QtTranslationsDir)qt_*.qm" Exclude="@(SourceMergeQmFiles);$(QtTranslationsDir)\qt_help_*.qm" />
|
||||
<CopyTsFilesDest Include="@(CopyTsFilesSource -> '$(QtTsOutDir)%(Filename)%(Extension)')" />
|
||||
</ItemGroup>
|
||||
<Target Name="QtGenerateBaseTranslations" AfterTargets="Build" Inputs="@(SourceMergeQmFiles)" Outputs="%(MergedQmFiles.FullPath)">
|
||||
<PropertyGroup>
|
||||
<Language>%(MergedQmFiles.Language)</Language>
|
||||
</PropertyGroup>
|
||||
<Message Text="Generate Base Translation qt_$(Language).qm" Importance="High" />
|
||||
<ItemGroup>
|
||||
<SourceQmFiles Include="%(AllQmFiles.FullPath)" Condition="'%(AllQmFiles.Language)' == '$(Language)'" />
|
||||
</ItemGroup>
|
||||
<Error Condition="!$(DSQTDIRValid)" Text="Qt directory non-existent (download/extract the zip)" />
|
||||
<MakeDir Directories="$(QtTsOutDir)" />
|
||||
<Exec Command=""$(QtHostBinDir)lconvert.exe" -verbose -of qm -o "$(QtTsOutDir)qt_$(Language).qm" @(SourceQmFiles -> '"%(FullPath)"', ' ')" />
|
||||
</Target>
|
||||
<Target Name="QtCopyBaseTranslations"
|
||||
AfterTargets="Build"
|
||||
Inputs="@(BaseTsFiles)"
|
||||
Outputs="@(BaseTsFiles -> '$(QtTsOutDir)%(RecursiveDir)%(Filename.Replace('qtbase_', 'qt_'))%(Extension)')">
|
||||
<!-- https://stackoverflow.com/a/15379344 -->
|
||||
<ItemGroup>
|
||||
<TempItems Include="@(BaseTsFiles->'%(Filename)%(Extension)'->Replace('qtbase_', 'qt_'))">
|
||||
<OriginalPath>%(Identity)</OriginalPath>
|
||||
<SavedRecursiveDir>%(RecursiveDir)</SavedRecursiveDir>
|
||||
</TempItems>
|
||||
</ItemGroup>
|
||||
<Message Text="Copying base translation files" Importance="High" />
|
||||
<Copy SourceFiles="@(TempItems->'%(OriginalPath)')"
|
||||
DestinationFiles="@(TempItems->'$(QtTsOutDir)%(SavedRecursiveDir)%(Identity)')"
|
||||
SkipUnchangedFiles="true" />
|
||||
Inputs="@(CopyTsFilesSource)"
|
||||
Outputs="@(CopyTsFilesDest.FullPath)">
|
||||
<Message Text="Copy Base Translation %(CopyTsFilesSource.Filename)%(CopyTsFilesSource.Extension)" />
|
||||
<Copy SourceFiles="@(CopyTsFilesSource)" DestinationFiles="@(CopyTsFilesDest)" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
|
||||
<!--Compiles all translation files-->
|
||||
|
|
Loading…
Reference in a new issue