This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string GetStudioProjectPath(string projectName) | |
{ | |
var folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); | |
var sdlProjectPath = Path.Combine(folderPath,string.Format("Studio 2014\\Projects\\{0}",projectName)); | |
return sdlProjectPath; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override SearchResults[] SearchTranslationUnitsMasked(SearchSettings settings, TranslationUnit[] translationUnits, bool[] mask) | |
{ | |
var results = base.SearchTranslationUnitsMasked(settings, translationUnits, mask); | |
//iterate thru results and take the translation units which have context now | |
return results; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//create a translation provider entry and specify the path to the tm | |
var entry = new TranslationProviderCascadeEntry(@"path to the tm", true, true, true); | |
//get default project translation provider configuration | |
var providerConfiguration = project.GetTranslationProviderConfiguration(); | |
//override project default settings in order to allow us to specify tm's | |
providerConfiguration.OverrideParent = true; | |
//add the translation provider to the configuration | |
providerConfiguration.Entries.Add(entry); | |
//set tm for all language pairs | |
project.UpdateTranslationProviderConfiguration(providerConfiguration); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IExtensionPoint extensionPoint = PluginManager.DefaultPluginRegistry.GetExtensionPoint<FileTypeComponentBuilderAttribute>(); | |
foreach (IExtension extension in extensionPoint.Extensions) | |
{ | |
IFileTypeComponentBuilder extensionFileTypeComponentBuilder = (IFileTypeComponentBuilder) extension.CreateInstance(); | |
extensionFileTypeComponentBuilder.FileTypeManager = fileTypeManager; | |
IFileTypeInformation extensionFileTypeInformation = extensionFileTypeComponentBuilder.BuildFileTypeInformation(string.Empty); | |
string extensionFileTypeDefinitionId = extensionFileTypeInformation.FileTypeDefinitionId.Id; | |
FileTypeComponentBuilderAttribute attr = extension.ExtensionAttribute as FileTypeComponentBuilderAttribute; | |
if (Equals(extensionFileTypeDefinitionId, "XML v 1.2.0.0") && attr.IsTemplate) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//specify project creation information | |
var pi = new ProjectInfo() | |
{ | |
Name = "Your project name", | |
LocalProjectFolder = @"Project path", | |
CreatedBy = "name of the person who created the project", | |
SourceLanguage = new Language(new CultureInfo("source language")), | |
TargetLanguages = new[] {new Language(new CultureInfo("target language"))} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var studioProject = new FileBasedProject(@"Project path"); | |
var projectTargetLanguage = new Language("ES-ES"); | |
TranslationProviderConfiguration tmConf = | |
studioProject.GetTranslationProviderConfiguration(); | |
tmConf.OverrideParent = true; | |
tmConf.Entries.Add( | |
( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//load the project | |
var studioProject = new FileBasedProject(@"{Project file path}"); | |
//get the project settings as settings bundle | |
ISettingsBundle settingsBundle = studioProject.GetSettings(); | |
//obtain all global verifiers registered | |
IExtensionPoint globalVerifiersExtensionPoint = PluginManager.DefaultPluginRegistry.GetExtensionPoint<GlobalVerifierAttribute>()); | |
if (globalVerifiersExtensionPoint != null) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Action("SDL.Community.ManageMT.Translate", Name = "Translate", Icon = "icon", Description = "Translate current segment in the editor")] | |
[ActionLayout(typeof(ControlledMTProvidersRibbon), 60, DisplayType.Normal)] | |
[Shortcut(Keys.Alt | Keys.T)] | |
class ControlledMtTranslateViewPartAction : AbstractAction | |
{ | |
private EditorController _editorController; | |
private bool _disableMt = CascadeLanguageDirection.DisableMt; | |
public ControlledMtTranslateViewPartAction() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var activeParagraphProperties = | |
_editorController.ActiveDocument.ActiveSegmentPair.GetParagraphUnitProperties(); | |
var segmentPairs = _editorController.ActiveDocument.GetSegmentPairsFromParagraph(activeParagraphProperties.ParagraphUnitId).ToList(); | |
foreach (var segmentPair in segmentPairs) | |
{ | |
//do some processing on the segment pairs | |
} |
OlderNewer