Documentation > Best Practices and Examples > Services

Implementing the Translation Model Framework in CrownPeak

The Translation Model Framework (TMF) is a collection of templates created and managed by CrownPeak Professional Services that provides the CrownPeak authoring community the ability to manage multi-lingual content within a site, or localization activities across sites.

Overview


You can inser the TMF code specific template files. For example, call the ServicesTMF.LoadOutput from your output template and ServicesTMF.LoadInput from the input file.

Leveraging the CrownPeak TMF enables you to:

  • Manage sites of a multi-language nature (i.e. English and Spanish versions of the US site)
  • Manage sites with similar content and structure, that will be localized for each regional deployment.
  • Manage content that has a single point of origination, with requirements to derive and deploy multiple versions of the content.

You can manage any type of content or number of sites, whether they are global, regional, or local.

Adding the code to your templates will allow you to:

  • Collaborate between content owners.
  • Provide notifications when master content has changed.
  • Provide authors the ability to review change in the master content, for incorporation into their derived content set.
  • Provide the ability to selectively send content out to a translation service.
  • Use a variety of translation services.
  • Supports localization by regional content owners.

Use the Translation Model Framework (TMF)API to publish your translated content. Use the API to identify the source language and destination language for an asset.

ServicesTMF.CreateTranslatedAsset


In this example a relationship asset is also created and named contentSourceID-newTranslatedAssetID.

            Asset contentSourceAsset =  Asset.Load("/SiteQA/TMF_Test_Root/US/en/US_EN");
            Asset sourceLanguageAsset =  Asset.Load("/SiteQA/TMF_Test_Root/US/fr/US_FR");
            Asset destinationLanguageAsset =  Asset.Load("/SiteQA/TMF_Test_Root/MX/sp/MX_SP");
            string sitePath = "/SiteQA/TMF_Test_Root/_TMF";
            string transAssetID =  ServicesTMFGeneralFuntions.CreateTranslatedAsset(contentSourceAsset,  sourceLanguageAsset, destinationLanguageAsset, null, sitePath);
        

ServicesTMF.GetSiteName


This example will return and output: /SiteQA.

            Asset exampleAsset =  Asset.Load("/SiteQA/TMF_Test_Root");
            Out.WriteLine(ServicesTMF.GetSiteName(exampleAsset,0));
        

ServicesTMF.GetSitePath


This example returns the asset: /SiteQA/TMF_Test_Root/_TMF.

            Asset exampleAsset = Asset.Load("/SiteQA/TMF_Test_Root/FR/en/FR_EN");
            Asset tmfFolder = ServicesTMF.GetSitePath(exampleAsset);
        

ServicesTMF.CreateLocaleConfigCache

            IEnumerable<LocaleId> ieLID =  ServicesTMF.CreateLocaleConfigCache("/SiteQA/TMF_Test_Root/_TMF");
        

ServicesTMF.GetLocaleId


            string sitePath =  "/SiteQA/TMF_Test_Root/_TMF";
            Asset asset =  Asset.Load("/SiteQA/TMF_Test_Root/US/en");
            Out.WriteLine(ServicesTMF.GetLocaleId(asset,  sitePath));
        

ServicesTMF.GetInstanceURL


This example requires using the PostInputContext in the template.

            Out.WriteLine(ServicesTMF.GetInstanceURL(context));
        

ServicesTMF.ClearTMFHelperValues


            ServicesTMF.ClearTMFHelperValues(asset);
        

ServicesTMF.SendNotification


            string sitePath = "/SiteQA/TMF_Test_Root/_TMF";
            ServicesTMFGeneralFuntions.SendNotification(asset, transAsset,  langConfigLocaleAsset, instanceName, context, sitePath);
        

ServicesTMF.SendNotificationsToOwners


            string sitePath = "/SiteQA/TMF_Test_Root/_TMF";
            ServicesTMFGeneralFuntions.SendNotificationsToOwners(currentAsset, transAssetIDString, instanceNameString, context, sitePath);
        

ServicesTMF.SendNotificationsToAuthorsAndOwners


            string sitePath = "/SiteQA/TMF_Test_Root/_TMF";
            ServicesTMF.SendNotificationsToAuthorsAndOwners(asset, instanceName, context, sitePath, false);
        

ServicesTMF.UpdateRelationshipHistory


            string sitePath = "/SiteQA/TMF_Test_Root/_TMF";
            ServicesTMF.UpdateRelationshipHistory(asset, sitePath);
        

ServicesTMF.UpdateMasterHistory


This example assumes the current asset is the translated asset.

            string sitePath = "/SiteQA/TMF_Test_Root/_TMF";
            ServicesTMF.UpdateMasterHistory(asset, sitePath);
        

ServicesTMF.FixRelativeLinks


            string sitePath = "/SiteQA/TMF_Test_Root/_TMF";
            ServicesTMF.FixRelativeLinks(contentAsset, sourceFRootAsset, destFRootAsset, sitePath);
        

ServicesTMF.GetRelList


            string sitePath = "/SiteQA/TMF_Test_Root/_TMF";
            List<Asset> relationshipList =  ServicesTMF.GetRelList(assetID, "source", sitePath);
        

ServicesTMF.GetNotificationEmails


            string sitePath = "/SiteQA/TMF_Test_Root/_TMF";
            string emailList = ServicesTMF.GetNotificationEmails(asset, sitePath);
        

ServicesTMF.UpdateBranch


Use this example in copy.aspx.

            sitePath = "/SiteQA/TMF_Test_Root/_TMF";
            ServicesTMF.UpdateBranch(asset, context, sitePath);
        

ServicesTMF.AutoLinkLocales


            string sitePath = "/SiteQA/TMF_Test_Root/_TMF";
            ServicesTMF.AutoLinkLocales(sourceAsset, destinationAsset, sitePath);
        

ServicesTMF.GetTMFTemplateFields


            Dictionary<string, string> tmfFields = new  Dictionary<string, string>();
            tmfFields = ServicesTMF.GetTMFTemplateFields(asset);
        

ServicesTMF.IsMasterAssetChanges


            string sitePath = "/SiteQA/TMF_Test_Root/_TMF";
            bool isChanged = ServicesTMF.IsMasterAssetChanges(asset, sitePath);
        

ServicesTMF.Input.LoadInput


Use this example in the input.aspx of the template.

            ServicesTMF.Input.LoadInput(asset, context);
        

ServicesTMF.Input.ShowSelectUsers


Use this example in the input template file.

            ServicesTMF.Input.ShowSelectUsers();
        

ServicesTMF.PostInput


ServicesTMF.PostInput.LoadPostInput

Use this example in the post_input template file.

            ServicesTMF.PostInput.LoadPostInput(asset, context);
        

ServicesTMF.Output


ServicesTMF.Output.LoadMasterAssetChanges

Use this example in the output_changes template file.

            ServicesTMF.Output.LoadMasterAssetChanges(asset);
        

ServicesTMF.Output.LoadOutput


Use this example in the output template file.

            ServicesTMFOutput.LoadOutput(asset, context);
        

Connect with Crownpeak