aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2022-01-14 16:22:15 +0100
committerKarsten Heimrich <karsten.heimrich@qt.io>2022-01-20 15:06:37 +0000
commit64e6c7b0d576b2e86ca3d41c36f42d2a2bf8ba44 (patch)
tree796b73e84b1a59b585b2155278d6c69977ec7618
parentd84945f51a512fc9a503c84fbbd7604d70884f2c (diff)
Implement templated Qt translation (.ts) file wizard
Change-Id: I0efb2b66c5d7a9e9607b9334bea0212ed8d9cd16 Reviewed-by: Miguel Costa <miguel.costa@qt.io>
-rw-r--r--.gitignore2
-rw-r--r--QtVsTools.Package/QtVsTools.Package.csproj7
-rw-r--r--QtVsTools.Package/source.extension.vsixmanifest_TT4
-rw-r--r--QtVsTools.Wizards/ItemWizard/Translation/TranslationPage.xaml163
-rw-r--r--QtVsTools.Wizards/ItemWizard/Translation/TranslationPage.xaml.cs76
-rw-r--r--QtVsTools.Wizards/ItemWizard/Translation/TranslationWizard.cs115
-rw-r--r--QtVsTools.Wizards/QtVsTools.Wizards.csproj8
-rw-r--r--Templates/translation/Properties/AssemblyInfo.cs67
-rw-r--r--Templates/translation/QtTemplate.Item.Translation.csproj133
-rw-r--r--Templates/translation/translation.icobin0 -> 370070 bytes
-rw-r--r--Templates/translation/translation.ts4
-rw-r--r--Templates/translation/translation.vstemplate_TT69
-rw-r--r--vstools.sln59
13 files changed, 688 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore
index a91868f5..9b2efd8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -319,3 +319,5 @@ templates/widgetsclass/Properties/AssemblyInfo.tt.cs
templates/widgetsclass/widgetsclass.vstemplate
templates/qtclass/Properties/AssemblyInfo.tt.cs
templates/qtclass/qtclass.vstemplate
+templates/translation/Properties/AssemblyInfo.tt.cs
+templates/translation/translation.vstemplate
diff --git a/QtVsTools.Package/QtVsTools.Package.csproj b/QtVsTools.Package/QtVsTools.Package.csproj
index c99d4be4..016d6b99 100644
--- a/QtVsTools.Package/QtVsTools.Package.csproj
+++ b/QtVsTools.Package/QtVsTools.Package.csproj
@@ -181,6 +181,13 @@
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<IncludeOutputGroupsInVSIX>TemplateProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
</ProjectReference>
+ <ProjectReference Include="..\Templates\translation\QtTemplate.Item.Translation.csproj">
+ <Project>{202F4A6D-77CD-4992-AA53-01B585463287}</Project>
+ <Name>QtTemplate.Item.Translation</Name>
+ <VSIXSubPath>ItemTemplates</VSIXSubPath>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ <IncludeOutputGroupsInVSIX>TemplateProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
+ </ProjectReference>
<ProjectReference Include="..\Templates\widgetsclass\QtTemplate.Item.WidgetsClass.csproj">
<Project>{020422DA-33AB-4495-A439-7DAC2690795C}</Project>
<Name>QtTemplate.Item.WidgetsClass</Name>
diff --git a/QtVsTools.Package/source.extension.vsixmanifest_TT b/QtVsTools.Package/source.extension.vsixmanifest_TT
index 0ade6e5f..57f90b05 100644
--- a/QtVsTools.Package/source.extension.vsixmanifest_TT
+++ b/QtVsTools.Package/source.extension.vsixmanifest_TT
@@ -203,6 +203,10 @@
d:TargetPath="|QtTemplate.Item.QtClass;TemplateProjectOutputGroup|" Path="ItemTemplates"
d:VsixSubPath="ItemTemplates" />
<Asset
+ Type="Microsoft.VisualStudio.ItemTemplate" d:Source="Project" d:ProjectName="Translation"
+ d:TargetPath="|QtTemplate.Item.Translation;TemplateProjectOutputGroup|" Path="ItemTemplates"
+ d:VsixSubPath="ItemTemplates" />
+ <Asset
Type="Microsoft.VisualStudio.VsPackage" d:Source="File" Path="QtVsTools.Qml.Debug.pkgdef" />
</Assets>
</PackageManifest>
diff --git a/QtVsTools.Wizards/ItemWizard/Translation/TranslationPage.xaml b/QtVsTools.Wizards/ItemWizard/Translation/TranslationPage.xaml
new file mode 100644
index 00000000..b87402d9
--- /dev/null
+++ b/QtVsTools.Wizards/ItemWizard/Translation/TranslationPage.xaml
@@ -0,0 +1,163 @@
+<!--
+ *****************************************************************************
+ **
+ ** Copyright (C) 2022 The Qt Company Ltd.
+ ** Contact: https://www.qt.io/licensing/
+ **
+ ** This file is part of the Qt VS Tools.
+ **
+ ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and The Qt Company. For licensing terms
+ ** and conditions see https://www.qt.io/terms-conditions. For further
+ ** information use the contact form at https://www.qt.io/contact-us.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3 as published by the Free Software
+ ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+ ** included in the packaging of this file. Please review the following
+ ** information to ensure the GNU General Public License requirements will
+ ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+ **
+ ** $QT_END_LICENSE$
+ **
+ *****************************************************************************
+-->
+
+<common:WizardPage x:Class="QtVsTools.Wizards.ItemWizard.TranslationPage"
+ xmlns:common="clr-namespace:QtVsTools.Wizards.Common"
+ xmlns:util="clr-namespace:QtVsTools.Wizards.Util"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ KeepAlive="True"
+ mc:Ignorable="d"
+ d:DesignHeight="445"
+ d:DesignWidth="585"
+ FocusManager.FocusedElement="{Binding ElementName=LanguageListBox}">
+ <common:WizardPage.Resources>
+ <BooleanToVisibilityConverter x:Key="b2v" />
+ </common:WizardPage.Resources>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="100" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+
+ <Image Grid.Column="0"
+ HorizontalAlignment="Center"
+ Source="/QtVsTools.Wizards;component/Resources/Qt-logo-small.png"
+ VerticalAlignment="Top"
+ Margin="0,25,0,0"
+ RenderTransformOrigin="1,0">
+ <Image.RenderTransform>
+ <TransformGroup>
+ <ScaleTransform ScaleY="0.86"
+ ScaleX="0.86" />
+ </TransformGroup>
+ </Image.RenderTransform>
+ </Image>
+
+ <Grid Grid.Column="1"
+ Margin="25,25,25,0">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <TextBlock TextWrapping="Wrap"
+ Grid.Row="0">
+ <Run FontWeight="Bold"
+ Text="{Binding Path=Header}" />
+ <LineBreak />
+ <LineBreak />
+ <Run Text="{Binding Path=Message}" />
+ <LineBreak />
+ </TextBlock>
+
+ <Grid Grid.Row="1"
+ Margin="0,20,0,20">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <TextBlock Grid.Row="0"
+ Margin="0,0,0,5"
+ Text="Select a Language:" />
+ <Grid Grid.Row="1"
+ MinHeight="22"
+ Background="White">
+ <TextBlock Text=" Filter..."
+ Foreground="LightSteelBlue"
+ VerticalAlignment="Center"
+ Visibility="{Binding ElementName=searchBox,
+ Path=Text.IsEmpty,
+ Converter={StaticResource b2v}}" />
+ <TextBox Name="searchBox"
+ Background="Transparent"
+ TextChanged="OnSearchBoxTextChanged"
+ VerticalContentAlignment="Center" />
+ </Grid>
+ <ListBox Grid.Row="2"
+ Margin="0,10,0,8"
+ Name="LanguageListBox"
+ DisplayMemberPath="Value"
+ SelectedValuePath="Key"
+ ItemsSource="{Binding Path=Data.CultureInfos}"
+ SelectedValue="{Binding Path=Data.CultureInfoName}"
+ SelectionChanged="OnLanguageBoxSelectionChanged" />
+ <TextBlock Grid.Row="3"
+ Text="Save as:"/>
+ <Grid Grid.Row="4">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <TextBox Text="{Binding Path=Data.TsFile}"/>
+ <TextBlock Grid.Column="1"
+ Margin="5,0,0,0">
+ <Run FontWeight="Bold"
+ Text="{Binding Path=Data.CultureInfoName}" />
+ <Run Text=".ts" />
+ </TextBlock>
+ </Grid>
+ </Grid>
+
+ <StackPanel Grid.Row="2"
+ HorizontalAlignment="Right"
+ Orientation="Horizontal"
+ Margin="0,0,0,10">
+ <Button Click="OnPreviousButtonClick"
+ Name="PreviousButton"
+ IsEnabled="{Binding Path=PreviousButtonEnabled}"
+ MinWidth="75">&lt; _Previous</Button>
+ <Button MinWidth="75"
+ Name="NextButton"
+ Click="OnNextButtonClick"
+ IsEnabled="{Binding Path=NextButtonEnabled}"
+ Margin="10,0,0,0">_Next &gt;</Button>
+ <Button MinWidth="75"
+ Click="OnFinishButtonClick"
+ Margin="10,0,0,0"
+ IsDefault="True"
+ IsEnabled="{Binding Path=FinishButtonEnabled}"
+ Name="FinishButton"
+ VerticalAlignment="Bottom">_Finish</Button>
+ <Button Click="OnCancelButtonClick"
+ MinWidth="75"
+ Margin="10,0,0,0"
+ Name="CancelButton"
+ IsEnabled="{Binding Path=CancelButtonEnabled}"
+ IsCancel="True">_Cancel</Button>
+ </StackPanel>
+ </Grid>
+ </Grid>
+</common:WizardPage>
diff --git a/QtVsTools.Wizards/ItemWizard/Translation/TranslationPage.xaml.cs b/QtVsTools.Wizards/ItemWizard/Translation/TranslationPage.xaml.cs
new file mode 100644
index 00000000..aeb82cef
--- /dev/null
+++ b/QtVsTools.Wizards/ItemWizard/Translation/TranslationPage.xaml.cs
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt VS Tools.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using QtVsTools.Wizards.Common;
+
+namespace QtVsTools.Wizards.ItemWizard
+{
+ public partial class TranslationPage : WizardPage
+ {
+ public TranslationPage()
+ {
+ InitializeComponent();
+ DataContext = this;
+ Loaded += OnTranslationPageLoaded;
+ }
+
+ private void OnTranslationPageLoaded(object sender, RoutedEventArgs e)
+ {
+ var view = CollectionViewSource.GetDefaultView(LanguageListBox.ItemsSource);
+ view.Filter = obj =>
+ {
+ if (string.IsNullOrEmpty(searchBox.Text))
+ return true;
+
+ var item = (KeyValuePair<string, string>)obj;
+ return item.Value.IndexOf(searchBox.Text, StringComparison.OrdinalIgnoreCase) >= 0;
+ };
+ LanguageListBox.SelectedIndex = 0;
+ }
+
+ private void OnSearchBoxTextChanged(object sender, TextChangedEventArgs e)
+ {
+ CollectionViewSource.GetDefaultView(LanguageListBox.ItemsSource).Refresh();
+ if (LanguageListBox.Items.Count == 1 || LanguageListBox.SelectedItem == null)
+ LanguageListBox.SelectedIndex = 0;
+ }
+
+ private void OnLanguageBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (e.RemovedItems != null && (e.AddedItems == null || e.AddedItems.Count == 0)) {
+ if (LanguageListBox.Items.Count != 0)
+ LanguageListBox.SelectedIndex = 0;
+ }
+ }
+ }
+}
diff --git a/QtVsTools.Wizards/ItemWizard/Translation/TranslationWizard.cs b/QtVsTools.Wizards/ItemWizard/Translation/TranslationWizard.cs
new file mode 100644
index 00000000..32a44e9b
--- /dev/null
+++ b/QtVsTools.Wizards/ItemWizard/Translation/TranslationWizard.cs
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt VS Tools.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using EnvDTE;
+using QtVsTools.Common;
+using QtVsTools.Core;
+using QtVsTools.Wizards.Common;
+using QtVsTools.Wizards.ProjectWizard;
+
+namespace QtVsTools.Wizards.ItemWizard
+{
+ using static EnumExt;
+
+ public sealed class TsWizardData : WizardData
+ {
+ public string TsFile { get; set; }
+ public string CultureInfoName { get; set; }
+ public List<KeyValuePair<string, string>> CultureInfos { get; set; }
+ }
+
+ public sealed class TranslationWizard : ProjectTemplateWizard
+ {
+ protected override Options TemplateType => Options.ConsoleSystem | Options.GUISystem;
+
+ enum NewTranslationItem
+ {
+ [String("safeitemname")] SafeItemName,
+ [String("tsfilename")] TsFileName,
+ [String("cultureinfoname")] CultureInfoName
+ }
+
+ WizardData _WizardData;
+ protected override WizardData WizardData => _WizardData
+ ?? (_WizardData = new TsWizardData
+ {
+ DefaultModules = new List<string> { "QtCore"}
+ });
+
+ WizardWindow _WizardWindow;
+ protected override WizardWindow WizardWindow => _WizardWindow
+ ?? (_WizardWindow = new WizardWindow(title: "Qt Translation File Wizard")
+ {
+ new TranslationPage
+ {
+ Data = WizardData,
+ Header = @"Welcome to the Qt Translation File Wizard",
+ Message = @"This wizard will add a new Qt empty translation file to your "
+ + @"project. The wizard creates a .ts for the selected language.",
+ PreviousButtonEnabled = false,
+ NextButtonEnabled = false,
+ FinishButtonEnabled = true,
+ CancelButtonEnabled = true
+ },
+ });
+
+ protected override void BeforeWizardRun()
+ {
+ var tmp = WizardData as TsWizardData;
+ tmp.TsFile = Parameter[NewTranslationItem.SafeItemName];
+ tmp.CultureInfos = CultureInfo.GetCultures(CultureTypes.AllCultures)
+ .ToDictionary(
+ mc => mc.Name.Replace("-", "_"),
+ mc => mc.EnglishName,
+ StringComparer.OrdinalIgnoreCase
+ ).OrderBy(item => item.Value).ToList();
+ }
+
+ protected override void BeforeTemplateExpansion()
+ {
+ var tmp = WizardData as TsWizardData;
+ Parameter[NewTranslationItem.CultureInfoName] = tmp.CultureInfoName;
+ Parameter[NewTranslationItem.TsFileName] = tmp.TsFile + "_" + tmp.CultureInfoName + ".ts";
+ }
+
+ protected override void Expand()
+ {
+ // do not call the base class method here
+ }
+
+ public override void ProjectItemFinishedGenerating(ProjectItem projectItem)
+ {
+ Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
+ QtProject.AdjustWhitespace(Dte, projectItem.Properties.Item("FullPath").Value.ToString());
+ }
+ }
+}
diff --git a/QtVsTools.Wizards/QtVsTools.Wizards.csproj b/QtVsTools.Wizards/QtVsTools.Wizards.csproj
index 76aabcf8..f518c06b 100644
--- a/QtVsTools.Wizards/QtVsTools.Wizards.csproj
+++ b/QtVsTools.Wizards/QtVsTools.Wizards.csproj
@@ -124,6 +124,10 @@
</Resource>
</ItemGroup>
<ItemGroup>
+ <Compile Include="ItemWizard\Translation\TranslationPage.xaml.cs">
+ <DependentUpon>TranslationPage.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="ItemWizard\Translation\TranslationWizard.cs" />
<Compile Include="ProjectWizard\ConfigPage.xaml.cs">
<DependentUpon>ConfigPage.xaml</DependentUpon>
</Compile>
@@ -185,6 +189,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="ItemWizard\Translation\TranslationPage.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="ProjectWizard\Designer\DesignerPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
diff --git a/Templates/translation/Properties/AssemblyInfo.cs b/Templates/translation/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..b46b598f
--- /dev/null
+++ b/Templates/translation/Properties/AssemblyInfo.cs
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt VS Tools.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************
+<#@output extension="tt.cs" #>
+<#@include file="$(SolutionDir)\version.tt" #>
+** <#=WARNING_GENERATED_FILE#>
+****************************************************************************/
+
+using System.Reflection;
+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("Translation")]
+[assembly: AssemblyDescription("The Qt Visual Studio Tools allow developers to use the standard development environment without having to worry about any Qt-related build steps or tools.")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("The Qt Company Ltd.")]
+[assembly: AssemblyProduct("Qt Visual Studio Tools")]
+[assembly: AssemblyCopyright("Copyright (C) 2016-2022 The Qt Company Ltd.")]
+[assembly: AssemblyTrademark("The Qt Company Ltd. Qt and their respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.")]
+[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("131278ae-99ef-45c0-8455-423ee8f123dc")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("<#=QT_VS_TOOLS_VERSION_ASSEMBLY#>")]
+[assembly: AssemblyFileVersion("<#=QT_VS_TOOLS_VERSION_ASSEMBLY_FILE#>")]
diff --git a/Templates/translation/QtTemplate.Item.Translation.csproj b/Templates/translation/QtTemplate.Item.Translation.csproj
new file mode 100644
index 00000000..c692fa82
--- /dev/null
+++ b/Templates/translation/QtTemplate.Item.Translation.csproj
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt VS Tools.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+-->
+<Project ToolsVersion="$(VisualStudioVersion)" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <MinimumVisualStudioVersion>$(VisualStudioVersion)</MinimumVisualStudioVersion>
+ <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+ </PropertyGroup>
+ <PropertyGroup>
+ <ApplicationIcon>translation.ico</ApplicationIcon>
+ </PropertyGroup>
+ <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>
+ <ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ProjectGuid>{202F4A6D-77CD-4992-AA53-01B585463287}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Translation</RootNamespace>
+ <AssemblyName>Translation</AssemblyName>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <GeneratePkgDefFile>false</GeneratePkgDefFile>
+ <IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer>
+ <IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
+ <IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
+ <CreateVsixContainer>false</CreateVsixContainer>
+ <DeployExtension>false</DeployExtension>
+ <DeployVSTemplates>false</DeployVSTemplates>
+ <CopyVsixManifestToOutput>false</CopyVsixManifestToOutput>
+ <CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
+ <CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <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' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.VisualStudio.CoreUtility">
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
+ </ItemGroup>
+ <ItemGroup>
+ <T4Template Include="Properties\AssemblyInfo.cs">
+ <Generator>TextTemplatingFileGenerator</Generator>
+ <OutputFile>Properties\AssemblyInfo.tt.cs</OutputFile>
+ <DependsOn>$(SolutionDir)\version.tt;$(SolutionDir)\common.tt</DependsOn>
+ <LastGenOutput>AssemblyInfo.tt.cs</LastGenOutput>
+ </T4Template>
+ <Compile Include="Properties\AssemblyInfo.tt.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>AssemblyInfo.cs</DependentUpon>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="translation.ts" />
+ </ItemGroup>
+ <ItemGroup>
+ <T4Template Include="translation.vstemplate_TT">
+ <Generator>TextTemplatingFileGenerator</Generator>
+ <OutputFile>translation.vstemplate</OutputFile>
+ <DependsOn>$(SolutionDir)\version.tt;$(SolutionDir)\common.tt</DependsOn>
+ <LastGenOutput>translation.vstemplate</LastGenOutput>
+ </T4Template>
+ <VSTemplate Include="translation.vstemplate">
+ <SubType>Designer</SubType>
+ <OutputSubPath>Qt</OutputSubPath>
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>translation.vstemplate_TT</DependentUpon>
+ </VSTemplate>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="translation.ico" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
+ <Import Project="$(SolutionDir)\transform.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/Templates/translation/translation.ico b/Templates/translation/translation.ico
new file mode 100644
index 00000000..1c4fb80d
--- /dev/null
+++ b/Templates/translation/translation.ico
Binary files differ
diff --git a/Templates/translation/translation.ts b/Templates/translation/translation.ts
new file mode 100644
index 00000000..2d374b45
--- /dev/null
+++ b/Templates/translation/translation.ts
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS >
+<TS version="2.1" language="$cultureinfoname$">
+</TS>
diff --git a/Templates/translation/translation.vstemplate_TT b/Templates/translation/translation.vstemplate_TT
new file mode 100644
index 00000000..c5bb243a
--- /dev/null
+++ b/Templates/translation/translation.vstemplate_TT
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ *****************************************************************************
+ **
+ ** Copyright (C) 2022 The Qt Company Ltd.
+ ** Contact: https://www.qt.io/licensing/
+ **
+ ** This file is part of the Qt VS Tools.
+ **
+ ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and The Qt Company. For licensing terms
+ ** and conditions see https://www.qt.io/terms-conditions. For further
+ ** information use the contact form at https://www.qt.io/contact-us.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3 as published by the Free Software
+ ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+ ** included in the packaging of this file. Please review the following
+ ** information to ensure the GNU General Public License requirements will
+ ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+ **
+ ** $QT_END_LICENSE$
+ **
+ *****************************************************************************
+<#@output extension="vstemplate" #>
+<#@include file="$(SolutionDir)\version.tt" #>
+ ** <#=WARNING_GENERATED_FILE#>
+ *****************************************************************************
+-->
+
+<VSTemplate Version="3.0.0"
+ xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"
+ xmlns:sdk="http://schemas.microsoft.com/developer/vstemplate-sdkextension/2010"
+ Type="Item">
+ <TemplateData>
+ <Name>Qt Translation File</Name>
+ <Description>Qt Translation File (.ts)</Description>
+ <ProjectType>VC</ProjectType>
+ <DefaultName>Translation.ts</DefaultName>
+ <ProvideDefaultName>true</ProvideDefaultName>
+ <LocationField>Enabled</LocationField>
+ <EnableLocationBrowseButton>true</EnableLocationBrowseButton>
+ <Icon>translation.ico</Icon>
+ <LanguageTag>Cpp</LanguageTag>
+ <PlatformTag>Windows</PlatformTag>
+ <PlatformTag>Linux</PlatformTag>
+ <ProjectTypeTag>Qt</ProjectTypeTag>
+ <ProjectTypeTag>Desktop</ProjectTypeTag>
+ <AppliesTo>VisualC</AppliesTo>
+ <TemplateGroupID>QtVsTools</TemplateGroupID>
+ <TemplateID>QtVsTools-QTranslation</TemplateID>
+ </TemplateData>
+ <TemplateContent>
+ <ProjectItem OpenInEditor="false"
+ ReplaceParameters="true"
+ TargetFileName="$tsfilename$">translation.ts</ProjectItem>
+ </TemplateContent>
+ <WizardExtension>
+ <!-- BEGIN Generated Text <#=XML_COMMENT_END#>
+ <Assembly>QtVsTools.Wizards, Version=<#=QT_VS_TOOLS_VERSION_ASSEMBLY#>, Culture=neutral, PublicKeyToken=null</Assembly>
+ <#=XML_COMMENT_BEGIN#> END Generated Text -->
+ <FullClassName>QtVsTools.Wizards.ItemWizard.TranslationWizard</FullClassName>
+ </WizardExtension>
+</VSTemplate>
diff --git a/vstools.sln b/vstools.sln
index 873f732e..5b02f7a4 100644
--- a/vstools.sln
+++ b/vstools.sln
@@ -43,6 +43,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QtTemplate.Item.Resource",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QtTemplate.Project.Server", "Templates\server\QtTemplate.Project.Server.csproj", "{8AE9D385-A379-4F5F-A703-3DF643DA6742}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QtTemplate.Item.Translation", "Templates\translation\QtTemplate.Item.Translation.csproj", "{202F4A6D-77CD-4992-AA53-01B585463287}"
+EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QtTemplate.Item.Widget", "Templates\widget\QtTemplate.Item.Widget.csproj", "{40ADFD6A-64EA-4C77-9D4B-3A91D6AB76B4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QtTemplate.Item.WidgetsClass", "Templates\widgetsclass\QtTemplate.Item.WidgetsClass.csproj", "{020422DA-33AB-4495-A439-7DAC2690795C}"
@@ -380,6 +382,24 @@ Global
{7AF6C34B-65D2-4010-92F6-420E59DDE9BF}.Tests|x64.Build.0 = Release|Any CPU
{7AF6C34B-65D2-4010-92F6-420E59DDE9BF}.Tests|x86.ActiveCfg = Release|Any CPU
{7AF6C34B-65D2-4010-92F6-420E59DDE9BF}.Tests|x86.Build.0 = Release|Any CPU
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Debug|x64.Build.0 = Debug|Any CPU
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Debug|x86.ActiveCfg = Debug|x86
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Debug|x86.Build.0 = Debug|x86
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Release|x64.ActiveCfg = Release|Any CPU
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Release|x64.Build.0 = Release|Any CPU
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Release|x86.ActiveCfg = Release|x86
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Release|x86.Build.0 = Release|x86
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Tests|Any CPU.ActiveCfg = Debug|Any CPU
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Tests|Any CPU.Build.0 = Debug|Any CPU
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Tests|x64.ActiveCfg = Debug|Any CPU
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Tests|x64.Build.0 = Debug|Any CPU
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Tests|x86.ActiveCfg = Debug|x86
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Tests|x86.Build.0 = Debug|x86
{4833E4C7-FFFF-4DA5-A7A5-36C6C3840F16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4833E4C7-FFFF-4DA5-A7A5-36C6C3840F16}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4833E4C7-FFFF-4DA5-A7A5-36C6C3840F16}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -593,24 +613,24 @@ Global
{E809DDE3-AE76-4F7A-8DC5-775AC4900138}.Tests|x64.Build.0 = Release|Any CPU
{E809DDE3-AE76-4F7A-8DC5-775AC4900138}.Tests|x86.ActiveCfg = Release|Any CPU
{E809DDE3-AE76-4F7A-8DC5-775AC4900138}.Tests|x86.Build.0 = Release|Any CPU
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Debug|x64.ActiveCfg = Debug|Any CPU
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Debug|x64.Build.0 = Debug|Any CPU
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Debug|x86.ActiveCfg = Debug|x86
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Debug|x86.Build.0 = Debug|x86
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Release|Any CPU.Build.0 = Release|Any CPU
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Release|x64.ActiveCfg = Release|Any CPU
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Release|x64.Build.0 = Release|Any CPU
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Release|x86.ActiveCfg = Release|x86
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Release|x86.Build.0 = Release|x86
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Tests|Any CPU.ActiveCfg = Debug|Any CPU
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Tests|Any CPU.Build.0 = Debug|Any CPU
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Tests|x64.ActiveCfg = Debug|Any CPU
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Tests|x64.Build.0 = Debug|Any CPU
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Tests|x86.ActiveCfg = Debug|x86
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404}.Tests|x86.Build.0 = Debug|x86
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Debug|x64.Build.0 = Debug|Any CPU
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Debug|x86.ActiveCfg = Debug|x86
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Debug|x86.Build.0 = Debug|x86
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Release|Any CPU.Build.0 = Release|Any CPU
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Release|x64.ActiveCfg = Release|Any CPU
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Release|x64.Build.0 = Release|Any CPU
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Release|x86.ActiveCfg = Release|x86
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Release|x86.Build.0 = Release|x86
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Tests|Any CPU.ActiveCfg = Debug|Any CPU
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Tests|Any CPU.Build.0 = Debug|Any CPU
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Tests|x64.ActiveCfg = Debug|Any CPU
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Tests|x64.Build.0 = Debug|Any CPU
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Tests|x86.ActiveCfg = Debug|x86
+ {202F4A6D-77CD-4992-AA53-01B585463287}.Tests|x86.Build.0 = Debug|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -626,6 +646,7 @@ Global
{20055427-1352-44FB-8442-BF7F15F9C59E} = {A7918293-56E9-465A-AE1C-0724576ADD66}
{DC1AE91B-45CE-4C5B-8F77-CDB58566038F} = {A7918293-56E9-465A-AE1C-0724576ADD66}
{7AF6C34B-65D2-4010-92F6-420E59DDE9BF} = {A7918293-56E9-465A-AE1C-0724576ADD66}
+ {4981AAE8-9AC7-4758-87EA-FB2397D6C404} = {A7918293-56E9-465A-AE1C-0724576ADD66}
{4833E4C7-FFFF-4DA5-A7A5-36C6C3840F16} = {DD307619-BF80-4E5D-AE54-196057187702}
{BDA1CD69-624B-4D9D-9B88-ACBEB14AC471} = {A7918293-56E9-465A-AE1C-0724576ADD66}
{8AE9D385-A379-4F5F-A703-3DF643DA6742} = {DD307619-BF80-4E5D-AE54-196057187702}
@@ -643,7 +664,7 @@ Global
{A5320606-37B8-4F15-97E2-16314109CAF9} = {D6FB29A4-8921-46F5-B170-B15538AB4D69}
{12857847-9877-466C-B056-DD286A219093} = {D6FB29A4-8921-46F5-B170-B15538AB4D69}
{E809DDE3-AE76-4F7A-8DC5-775AC4900138} = {D6FB29A4-8921-46F5-B170-B15538AB4D69}
- {4981AAE8-9AC7-4758-87EA-FB2397D6C404} = {A7918293-56E9-465A-AE1C-0724576ADD66}
+ {202F4A6D-77CD-4992-AA53-01B585463287} = {A7918293-56E9-465A-AE1C-0724576ADD66}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {17FF4AFE-273C-47CD-8D84-F0D023B10BE5}