Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pwiz_tools/Skyline/CleanSkyline.bat
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ IF EXIST Executables\Installer\FileList64.txt del /q Executables\Installer\FileL
IF EXIST Executables\Hardklor\obj rmdir /s /q Executables\Hardklor\obj
IF EXIST Executables\Hardklor\x64 rmdir /s /q Executables\Hardklor\x64
IF EXIST Executables\SkylineBatch\SkylineBatch\Properties\AssemblyInfo.cs del /q Executables\SkylineBatch\SkylineBatch\Properties\AssemblyInfo.cs
IF EXIST Executables\DevTools\TutorialLocalizer\obj rmdir /s /q Executables\DevTools\TutorialLocalizer\obj
IF EXIST Executables\DevTools\TutorialLocalizer\bin rmdir /s /q Executables\DevTools\TutorialLocalizer\bin
IF EXIST Properties\AssemblyInfo.cs del /q Properties\AssemblyInfo.cs
IF EXIST SkylineCmd\Properties\AssemblyInfo.cs del /q SkylineCmd\Properties\AssemblyInfo.cs
IF EXIST SkylineNightly\Properties\AssemblyInfo.cs del /q SkylineNightly\Properties\AssemblyInfo.cs
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import modules path feature ;

rule build-properties ( targets + : sources * : properties * )
{
local .msvcSetupScript = [ get-current-msvc-setup-script $(properties) ] ;

path-constant SKYLINE_PATH : $(PWIZ_ROOT_PATH)/pwiz_tools/Skyline ;
path-constant CURRENT_DIR : $(SKYLINE_PATH)/Executables/DevTools/TutorialLocalization ;
path-constant OUTPUT_DIR : $(CURRENT_DIR)/TutorialLocalization/bin/Release ;
JAM_SEMAPHORE on $(targets) = "dotNetSemaphore" ;
MSVC_CURRENT_SETUP_SCRIPT on $(targets) = $(.msvcSetupScript) ;
}

rule do_tutorial_localization ( targets + : sources * : properties * )
{
return [ build-properties $(targets) : $(sources) : $(properties) ] ;
}

actions do_tutorial_localization
{
$(MSVC_CURRENT_SETUP_SCRIPT)
echo Building $(current-dir) TutorialLocalization.exe
msbuild $(CURRENT_DIR)\TutorialLocalization\TutorialLocalization.csproj /p:Configuration=Release;OutDir=$(OUTPUT_DIR) /nologo /verbosity:minimal
set status=%ERRORLEVEL%
exit %status%
}

make TutorialLocalization.exe
: # sources
: # actions
@do_tutorial_localization
: # requirements
<link>shared:<build>no
<conditional>@no-express-requirement
<conditional>@msvc-dotnet-requirement
;

rule do_merged_tutorials ( targets + : sources * : properties * )
{
return [ build-properties $(targets) : $(sources) : $(properties) ] ;
}

actions do_merged_tutorials
{
echo creating MergedTutorials.zip
$(OUTPUT_DIR)\TutorialLocalization.exe $(SKYLINE_PATH)/Documentation/Tutorials --output $(OUTPUT_DIR)/MergedTutorials.zip
set status=%ERRORLEVEL%
exit %status%
}


make MergedTutorials.zip
: # sources
: # actions
@do_merged_tutorials
: # requirements
<link>shared:<build>no
<conditional>@no-express-requirement
<conditional>@msvc-dotnet-requirement
<dependency>TutorialLocalization.exe
;


Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35222.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TutorialLocalization", "TutorialLocalization\TutorialLocalization.csproj", "{B61C5AAE-F385-41D6-B2D1-6FAA8818FB43}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B61C5AAE-F385-41D6-B2D1-6FAA8818FB43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B61C5AAE-F385-41D6-B2D1-6FAA8818FB43}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B61C5AAE-F385-41D6-B2D1-6FAA8818FB43}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B61C5AAE-F385-41D6-B2D1-6FAA8818FB43}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D6850040-8E3F-4C9D-958E-EC4F251BC0AC}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Original author: Nicholas Shulman <nicksh .at. u.washington.edu>,
* MacCoss Lab, Department of Genome Sciences, UW
*
* Copyright 2024 University of Washington - Seattle, WA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace TutorialLocalization
{
/// <summary>
/// Entry for text which needs to be localized
/// </summary>
public class LocalizationRecord
{
public LocalizationRecord(string tutorialName, string xPath, string english)
{
TutorialName = tutorialName;
XPath = xPath;
English = english;
}
public string TutorialName { get; }
public string XPath { get; }
public string English { get; }
public string Localized { get; private set; }
public string OriginalEnglish { get; private set; }

public LocalizationRecord ChangeOriginalEnglish(string originalEnglish, string originalLocalized)
{
var localizationRecord = (LocalizationRecord)MemberwiseClone();
if (originalEnglish != English)
{
localizationRecord.OriginalEnglish = originalEnglish;
}
localizationRecord.Localized = originalLocalized;
return localizationRecord;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Original author: Nicholas Shulman <nicksh .at. u.washington.edu>,
* MacCoss Lab, Department of Genome Sciences, UW
*
* Copyright 2024 University of Washington - Seattle, WA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using CommandLine;

namespace TutorialLocalization
{
internal class Program
{
public class Options
{
[Value(0)]
public string Folder { get; set; }
[Option(Default = "MergedTutorials.zip")]
public string Output { get; set; }
}
static int Main(string[] args)
{
int result = -1;
Parser.Default.ParseArguments<Options>(args).WithParsed(options=>result = LocalizeTutorials(options)).WithNotParsed(HandleParseError);
return result;
}

public static int LocalizeTutorials(Options options)
{
var folderPath = Path.GetFullPath(options.Folder);
if (!Directory.Exists(folderPath))
{
Console.Error.WriteLine("Folder {0} does not exist", folderPath);
return -1;
}

var outputFile = options.Output;
File.Delete(outputFile);
var zipFile = new Ionic.Zip.ZipFile(outputFile, Encoding.UTF8);
var tutorialsLocalizer = new TutorialsLocalizer(zipFile);
foreach (var subfolder in Directory.GetDirectories(folderPath))
{
tutorialsLocalizer.AddTutorialFolder(subfolder, Path.GetFileName(subfolder));
}
tutorialsLocalizer.SaveLocalizationCsvFiles();
zipFile.Save();
return 0;
}

static void HandleParseError(IEnumerable<Error> errors)
{
foreach (var e in errors)
{
if (e is HelpRequestedError || e is VersionRequestedError)
{
continue;
}
Console.WriteLine($"Error: {e}");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TutorialLocalization")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TutorialLocalization")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b61c5aae-f385-41d6-b2d1-6faa8818fb43")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B61C5AAE-F385-41D6-B2D1-6FAA8818FB43}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>TutorialLocalization</RootNamespace>
<AssemblyName>TutorialLocalization</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="CommandLine">
<HintPath>..\lib\CommandLine.dll</HintPath>
</Reference>
<Reference Include="CsvHelper">
<HintPath>..\lib\CsvHelper.dll</HintPath>
</Reference>
<Reference Include="DotNetZip">
<HintPath>..\..\..\..\..\Shared\Lib\DotNetZip\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="F23.StringSimilarity">
<HintPath>..\lib\F23.StringSimilarity.dll</HintPath>
</Reference>
<Reference Include="HtmlAgilityPack">
<HintPath>..\..\..\..\..\Shared\Lib\HtmlAgilityPack.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Shared\Lib\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Shared\Lib\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="LocalizationRecord.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TutorialLocalizer.cs" />
<Compile Include="TutorialsLocalizer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Loading