Add i18n system
This commit is contained in:
parent
d5f46925a3
commit
77be338e46
11 changed files with 340 additions and 17 deletions
|
|
@ -24,6 +24,7 @@
|
|||
<PackageReference Include="MySql.Data" Version="8.0.31" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.10" />
|
||||
<PackageReference Include="ModFramework" Version="1.1.6" GeneratePathProperty="true" /> <!-- only used to extract out to ./bin. -->
|
||||
<PackageReference Include="GetText.NET" Version="1.6.6" /> <!-- only used to extract out to ./bin. -->
|
||||
|
||||
<!-- the launcher doesnt need the direct OTAPI reference, but since PackageReference[ExcludeFromSingleFile] doesnt work, exclude the assets and copy manually -->
|
||||
<PackageReference Include="OTAPI.Upcoming" Version="3.1.14" ExcludeAssets="all" GeneratePathProperty="true" />
|
||||
|
|
@ -41,6 +42,31 @@
|
|||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CheckMsgfmtCallable">
|
||||
<Exec Command="msgfmt --help > NUL" IgnoreExitCode="True" Condition=" '$(OS)' == 'Windows_NT' ">
|
||||
<Output TaskParameter="ExitCode" PropertyName="MsgfmtExitCode" />
|
||||
</Exec>
|
||||
<Exec Command="msgfmt --help 2>/dev/null >/dev/null" IgnoreExitCode="True" Condition=" '$(OS)' != 'Windows_NT' ">
|
||||
<Output TaskParameter="ExitCode" PropertyName="MsgfmtExitCode" />
|
||||
</Exec>
|
||||
</Target>
|
||||
|
||||
<!-- The condition for a Target can't come from the values of another target, so instead we have to put the same condition on all three of the items inside. -->
|
||||
<Target
|
||||
Name="GenerateMOFiles"
|
||||
DependsOnTargets="CheckMsgfmtCallable"
|
||||
AfterTargets="PostBuildEvent;Publish"
|
||||
Inputs="..\i18n\**\*.po"
|
||||
Outputs="$(OutDir)i18n\**\*.mo">
|
||||
<ItemGroup Condition="'$(MsgfmtExitCode)' == '0'">
|
||||
<POFiles Include="..\i18n\**\*.po" />
|
||||
</ItemGroup>
|
||||
<MakeDir Directories="$(OutDir)i18n/%(POFiles.RecursiveDir)" Condition="'$(MsgfmtExitCode)' == '0'" />
|
||||
<Exec Command="msgfmt -o $(OutDir)i18n/%(RecursiveDir)%(Filename).mo @(POFiles)" Outputs="$(OutDir)i18n\**\*.mo" Condition="'$(MsgfmtExitCode)' == '0'">
|
||||
<Output ItemName="Generated" TaskParameter="Outputs"/>
|
||||
</Exec>
|
||||
</Target>
|
||||
|
||||
<Target Name="CreateServerPlugins" AfterTargets="PostBuildEvent;Publish">
|
||||
<MakeDir Directories="$(OutDir)ServerPlugins" />
|
||||
<MakeDir Directories="$(PublishDir)ServerPlugins" />
|
||||
|
|
@ -50,6 +76,12 @@
|
|||
<Copy SourceFiles="@(ApiFiles)" DestinationFolder="$(OutDir)ServerPlugins" ContinueOnError="true" />
|
||||
<Copy SourceFiles="@(ApiFiles)" DestinationFolder="$(PublishDir)ServerPlugins" ContinueOnError="true" />
|
||||
</Target>
|
||||
<Target Name="CopyI18n" AfterTargets="Publish">
|
||||
<ItemGroup>
|
||||
<MOFiles Include="$(OutDir)**/*.mo"/>
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(MOFiles)" DestinationFolder="$(PublishDir)%(RecursiveDir)" />
|
||||
</Target>
|
||||
<Target Name="MoveBin" AfterTargets="Publish">
|
||||
<ItemGroup>
|
||||
<MoveBinaries Include="$(PublishDir)*" Exclude="$(PublishDir)\TShock.Server*" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue