Figure 1   Languages Table

Column Name
Data Type
Example
Description
LangId
int
2
Language ID
HtmlName
varchar(50)
iso-8859-1
HTML character set name (written to generated pages)
CodePage
int
1252
Windows code page appropriate for the language
SiteSuffix
char(2)
de
Directory suffix for the translated site
Name
varchar(50)
German
Human-readable language name (for tools)


Figure 2   StringIds Table

Column Name
Data Type
Example
Description
StringId
int
1009
Numerical string ID


Figure 3   Strings Table

Column Name
Data Type
Example
Description
StringId
int
1009
Numerical string ID
LangId
int
2
The language this string version is in
Str
nvarchar(2000)
Bitte geben sie ihr kennwort ein.
The language-specific version of this string


Figure 4   PageRanges Table

Column Name
Data Type
Example
Description
PageUrl
varchar(200)
/Default.asp
The URL of the page relative to the server name
BaseId
int
1000
The starting ID for strings on this page


Figure 5   The Button DTC in an ASP Page


 <!--METADATA TYPE="DesignerControl" startspan
 <OBJECT classid="clsid:B6FC3A14-F837-11D0-9CC8-006008058731"
 id=Button1 style="LEFT: 0px; TOP: 0px">
     <PARAM NAME="_ExtentX" VALUE="1773">
     <PARAM NAME="_ExtentY" VALUE="714">
     <PARAM NAME="id" VALUE="Button1">
     <PARAM NAME="Caption" VALUE="Button1">
     <PARAM NAME="Image" VALUE="">
     <PARAM NAME="AltText" VALUE="">
     <PARAM NAME="Visible" VALUE="-1">
     <PARAM NAME="Platform" VALUE="256">
     <PARAM NAME="LocalPath" VALUE=""></OBJECT>
 -->
 <!--#INCLUDE FILE="_ScriptLibrary/Button.ASP"-->
<SCRIPT LANGUAGE=JavaScript RUNAT=Server>
function _initButton1()
{
    Button1.value = 'Button1';
    Button1.setStyle(0);
}
function _Button1_ctor()
{
    CreateButton('Button1', _initButton1, null);
}
</script>
<% Button1.display %>
 <!--METADATA TYPE="DesignerControl" endspan-->

Figure 6   Generating Runtime Text


 STDMETHODIMP CTestCtl1::QueryPersistenceInterface(REFIID iid)
 {
   if (iid == IID_IPersistTextStream)
     return S_OK;
   return S_FALSE;
 }
 
 STDMETHODIMP CTestCtl1::SaveRuntimeState(
     REFIID iidPersist, REFIID iidObjStgMed,
     void * pObjStgMed)
 {
   HRESULT          hr = S_OK;
   IStream *        pStm;
   ULONG            cbWritten;
   CComBSTR         sText;
 
   if (iidPersist != IID_IPersistTextStream)
     return E_INVALIDARG;
   if (iidObjStgMed != IID_IStream)
     return E_INVALIDARG;
 
   pStm = static_cast<IStream *>(pObjStgMed);
 
   sText =  L"blah blah blah";
 
   hr = pStm->Write(sText.m_str,
     sText.Length() * sizeof (OLECHAR), &cbWritten);
 
   return hr;
 }

Figure 9   IDesignTimeControl Methods


 STDMETHODIMP CTestCtl1::get_DesignTimeControlSet(BSTR * pbstr)
 {
 (*pbstr) = NULL;        // No-op
 return S_OK;
 }
 
 STDMETHODIMP CTestCtl1::OnGetChoices(Choices *)
 {
 return S_OK;            // No-op
 }
 
 STDMETHODIMP CTestCtl1::OnRebind(Choices *)
 {
 return S_OK;            // No-op
 }
 
 STDMETHODIMP CTestCtl1::OnChoiceConflict(Choice *, VARIANT_BOOL)
 {
 return S_OK;            // No-op
 }
 
 STDMETHODIMP CTestCtl1::OnChoiceChange(ChoiceSink * pCS,
 dtcChoiceChange change)
 {
 return S_OK;
 }
 
 STDMETHODIMP CTestCtl1::OnHostingChange(dtcHostingChange change, VARIANT_BOOL *)
 {
 return S_OK;
 }

Figure 10   putref_DesignTimeControlSite


 STDMETHODIMP
 CTestCtl1::putref_DesignTimeControlSite(IDesignTimeControlSite *pSite)
 {
     HRESULT        hr = S_OK;
 
     m_spSite = pSite;
     if (pSite != NULL)
     {
         CComPtr<ChoiceSinks>    spChoiceSinks;
         CComVariant             vType(L"TargetEnvironment");
         VARIANT                 vText;
         vText.vt = VT_ERROR;
         hr = pSite->get_ChoiceSinks(&spChoiceSinks);
         if (hr != S_OK)
             return hr;
         hr = spChoiceSinks->AddChoiceSink(vType, vText,
             &m_spChoiceSink);
         if (hr != S_OK)
             return hr;
     }
     return hr;
 }

Figure 11   OnChoiceChange


 STDMETHODIMP CSinkDTC::OnChoiceChange(ChoiceSink * pCS,
     dtcChoiceChange change)
 {
     HRESULT    hr = S_OK;
 
     if (pCS == m_spChoiceSink)
     {
         CComPtr<Choice>    spChoice;
 
         hr = pCS->get_BoundChoice(&spChoice);
         if (hr != S_OK)
             return hr;
 
         if (spChoice == NULL)
             return E_POINTER;
 
         CComPtr<Tags>    spTags;
         hr = spChoice->get_Tags (&spTags);
         if (hr != S_OK)
             return hr;
 
         if (spTags == NULL)
             return E_POINTER;
 
         CComVariant varTagIndex = L"path";
         CComVariant varTagValue;
 
         hr = spTags->get_Item (varTagIndex, &varTagValue);
         if (hr != S_OK)
             return hr;
 
         if (varTagValue.vt == VT_BSTR)
             m_strPath = varTagValue.bstrVal;
 
         SetDirty(true);
         SendOnDataChange(0);             // Notify the container.
         FireViewChange();                // Display the change.
     }
 
     return hr;
 }