Export all strings for external language translation Arguments: None

Return TypeFunction nameArguments
hzEcodehdsApp::ExportStrings(void)

Declared in file: hzDissemino.h
Defined in file : hdsResource.cpp

Function Logic:

0:START 1:items filepath items items 2:unknown 3:Return hzerr(E_OPENFAIL,Cannot open file [%s]\n,*filepath) 4:unknown 5:S items 6:unknown 7:pBlok 8:unknown 9:items 10:unknown 11:pPage 12:unknown 13:items 14:items 15:unknown 16:pVE items 17:items items items items items 18:unknown 19:pAG items items filepath items items 20:unknown 21:items 22:Return E_OPENFAIL 23:unknown 24:pArt 25:unknown 26:pArtStd 27:unknown 28:unknown 29:items 30:unknown 31:pVE items 32:items items items items items 33:Return E_OK

Function body:

hzEcode hdsApp::ExportStrings (void)
{
   //  Export all strings for external language translation
   //  
   //  Arguments: None
   //  
   //  Returns: E_OPENFAIL If the string export output stream cannot be opened
   //     E_OK  If the strings are exported
   _hzfunc("hdsApp::ExportStrings") ;
   hzList<hdsVE*>::Iter    ih ;    //  Html entity iterator
   hdsArticle*     pArt ;          //  Generic article pointer
   hdsArticleStd*  pArtStd ;       //  Standar article pointer
   ofstream        os ;            //  Output stream
   hzChain         Z ;             //  Output chain
   hdsNavtree*     pAG ;           //  Article group
   hdsPage*        pPage ;         //  Page pointer
   hdsBlock*       pBlok ;         //  Include Block
                                   //  hdsSubject*  pSubj ;   // Subject (navbar heading)
   hdsVE*          pVE ;           //  Visible entity
   hzString        filepath ;      //  File path
   hzString        S ;             //  Temp string
   uint32_t        nG ;            //  Article group iterator
   uint32_t        n ;             //  Page iterator
   uint32_t        nV ;            //  Visual entity iterator
   //  Do strings by page
   Z.Printf("%s/website.%s.txt", *m_Docroot, *m_DefaultLang) ;
   filepath = Z ;
   Z.Clear() ;
   os.open(*filepath) ;
   if (os.fail())
       return hzerr(E_OPENFAIL, "Cannot open file [%s]\n", *filepath) ;
   for (n = 0; n < m_setPgSubjects.Count() ; n++)
   {
       S = m_setPgSubjects.GetObj(n) ;
       Z.Printf("s%d) %s\n\n", n, *S) ;
   }
   for (n = 0; n < m_Includes.Count() ; n++)
   {
       pBlok = m_Includes.GetObj(n) ;
       for (pVE = pBlok->Children() ; pVE ; pVE = pVE->Sibling())
           _exportStr(Z, pVE, n+1);    //  pBlok->m_USL) ;
   }
   //  for (n = 0 ; n < m_PagesUid.Count() ; n++)
   for (n = 0; n < m_vecPages.Count() ; n++)
   {
       //  pPage = m_PagesUid.GetObj(n) ;
       pPage = m_vecPages[n] ;
       if (!(pPage->m_flagVE & VE_LANG))
           { m_pLog->Log("Skipping page %s\n", *pPage->m_Url) ; continue ; }
       m_pLog->Log("Doing Page %s\n", *pPage->m_Url) ;
       //  for (ih = pPage->m_VEs ; ih.Valid() ; ih++)
       //  {
       //   pVE = ih.Element() ;
       //   _exportStr(Z, pVE) ;
       //  }
       for (nV = 0; nV < pPage->m_VEs.Count() ; nV++)
       {
           pVE = pPage->m_VEs[nV] ;
           //  _exportStr(Z, pVE, pPage->m_USL) ;
           _exportStr(Z, pVE, pPage->m_RID) ;
       }
   }
   os << Z ;
   os.close() ;
   os.clear() ;
   Z.Clear() ;
   m_pLog->Log("File %s Total %d pages\n", *filepath, n) ;
   //  Do article groups
   for (nG = 0; nG < m_ArticleGroups.Count() ; nG++)
   {
       pAG = m_ArticleGroups.GetObj(nG) ;
       //  m_pLog->Out("Doing article group %s (total %d articles)\n", *pAG->m_Groupname, pAG->m_Articles.Count()) ;
       m_pLog->Out("Doing article group %s (total %d articles)\n", *pAG->m_Groupname, pAG->Count()) ;
       Z.Printf("%s/%s.%s.txt", *m_Docroot, *pAG->m_Groupname, *m_DefaultLang) ;
       filepath = Z ;
       Z.Clear() ;
       os.open(*filepath) ;
       if (os.fail())
       {
           m_pLog->Out("%s. Cannot open file [%s]\n", *filepath) ;
           return E_OPENFAIL ;
       }
       for (n = 0; n < pAG->Count() ; n++)
       {
           pArt = (hdsArticle*) pAG->GetItem(n) ;
           if (!pArt)
               continue ;
           pArtStd = dynamic_cast<hdsArticleStd*>(pArt) ;
           if (pArtStd)
           {
               if (!(pArtStd->m_flagVE & VE_LANG))
                   { m_pLog->Out("Skipping article %s\n", *pArtStd->m_Title) ; continue ; }
               //  for (pVE = pArt->Root() ; pVE ; pVE = pVE->Sibling())
               //   _exportStr(Z, pVE) ;
               for (nV = 0; nV < pArtStd->m_VEs.Count() ; nV++)
               {
                   pVE = pArtStd->m_VEs[nV] ;
                   //  _exportStr(Z, pVE, pArtStd->m_USL) ;
                   _exportStr(Z, pVE, pArtStd->m_RID) ;
               }
           }
       }
       os << Z ;
       os.close() ;
       os.clear() ;
       Z.Clear() ;
       m_pLog->Log("File %s Total %d articles (size now %d)\n", *filepath, n, Z.Size()) ;
   }
   return E_OK ;
}