src/hbcore/devicedialogbase/hbtextresolversymbian.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
    31 #include <QString>
    31 #include <QString>
    32 #include <QDebug>
    32 #include <QDebug>
    33 #include <QFile>
    33 #include <QFile>
    34 #include <QTextStream>
    34 #include <QTextStream>
    35 
    35 
    36 class HbTextResolverSymbianPrivate: public CBase
    36 NONSHARABLE_CLASS(HbTextResolverSymbianPrivate) : public CBase
    37     {
    37     {
    38 public:
    38 public:
    39     HbTextResolverSymbianPrivate();    
    39     HbTextResolverSymbianPrivate();    
    40     virtual ~HbTextResolverSymbianPrivate();
    40     virtual ~HbTextResolverSymbianPrivate();
    41     static HbTextResolverSymbianPrivate* Instance();
    41     static HbTextResolverSymbianPrivate* Instance();
    43     TBool Initialize(const TDesC& aFilename, const TDesC& aPath);
    43     TBool Initialize(const TDesC& aFilename, const TDesC& aPath);
    44     HBufC* LoadLC(const TDesC& aMessageId, TInt aPlural); // Simple string. + %n message(s). Plural and replaces all occurrences of %n in the string.
    44     HBufC* LoadLC(const TDesC& aMessageId, TInt aPlural); // Simple string. + %n message(s). Plural and replaces all occurrences of %n in the string.
    45     HBufC* LoadLC(const TDesC& aMessageId, const TDesC& aString, TInt aPlural); // One and %1. %n and %1. Plural and replaces all occurrences of %n in the string.
    45     HBufC* LoadLC(const TDesC& aMessageId, const TDesC& aString, TInt aPlural); // One and %1. %n and %1. Plural and replaces all occurrences of %n in the string.
    46     HBufC* LoadLC(const TDesC& aMessageId, const MDesCArray& aStrings, TInt aPlural);
    46     HBufC* LoadLC(const TDesC& aMessageId, const MDesCArray& aStrings, TInt aPlural);
    47     HBufC* LoadLC(const TDesC& aMessageId, TInt aInt, TInt aPlural);
    47     HBufC* LoadLC(const TDesC& aMessageId, TInt aInt, TInt aPlural);
    48     HBufC* LoadLC(const TDesC& aMessageId, const RArray<TInt>& aInts, TInt aPlural);    
    48     HBufC* LoadLC(const TDesC& aMessageId, const RArray<TInt>& aInts, TInt aPlural);
    49         
    49 
    50     QString ConvertToQString(const TDesC& aMessageId, TInt aPlural = -1);
    50     QString ConvertToQString(const TDesC& aMessageId, TInt aPlural = -1);
    51     QTranslator iTranslator;
    51     QTranslator iTranslator;
    52     QByteArray iByteArray;
    52     QByteArray iByteArray;
    53     TBool iLoaded; 
    53     TBool iLoaded; 
    54     QString fileName;
    54     QString fileName;
    55     QString path;                 
    55     QString path;
    56     };
    56     };
    57 
    57 
    58 Q_GLOBAL_STATIC(HbTextResolverSymbianPrivate, hbTextResolverSymbianPrivate)
    58 Q_GLOBAL_STATIC(HbTextResolverSymbianPrivate, hbTextResolverSymbianPrivate)
    59 
    59 
    60 HbTextResolverSymbianPrivate* HbTextResolverSymbianPrivate::Instance()
    60 HbTextResolverSymbianPrivate* HbTextResolverSymbianPrivate::Instance()
    61     {
    61     {
    62     HbTextResolverSymbianPrivate* resolver = hbTextResolverSymbianPrivate();
    62     HbTextResolverSymbianPrivate* resolver = hbTextResolverSymbianPrivate();
    63     return resolver;         
    63     return resolver;
    64     }
    64     }
    65     
    65 
    66 static void replacePercentN(QString *result, int n)
    66 static void replacePercentN(QString *result, int n)
    67 {
    67 {
    68     if (n >= 0) {
    68     if (n >= 0) {
    69         int percentPos = 0;
    69         int percentPos = 0;
    70         int len = 0;
    70         int len = 0;
    86         }
    86         }
    87     }
    87     }
    88 }
    88 }
    89 
    89 
    90 HbTextResolverSymbianPrivate::HbTextResolverSymbianPrivate()
    90 HbTextResolverSymbianPrivate::HbTextResolverSymbianPrivate()
    91     {        
    91     {
    92     }
    92     }
    93     
    93 
    94 HbTextResolverSymbianPrivate::~HbTextResolverSymbianPrivate()
    94 HbTextResolverSymbianPrivate::~HbTextResolverSymbianPrivate()
    95     {
    95     {
    96     }
    96     }
    97 
    97 
    98 TBool HbTextResolverSymbianPrivate::LoadTranslationFile()
    98 TBool HbTextResolverSymbianPrivate::LoadTranslationFile()
    99     {
    99     {
   100     QString locale = QLocale::system().name();        
   100     QString locale = QLocale::system().name();
   101     return iTranslator.load(fileName + locale, path);                
   101     return iTranslator.load(fileName + locale, path);
   102     }     
   102     }
   103 
   103 
   104 TBool HbTextResolverSymbianPrivate::Initialize(const TDesC& aFilename, const TDesC& aPath)
   104 TBool HbTextResolverSymbianPrivate::Initialize(const TDesC& aFilename, const TDesC& aPath)
   105     {
   105     {
   106     fileName = QString::fromUtf16(aFilename.Ptr(), aFilename.Length());
   106     fileName = QString::fromUtf16(aFilename.Ptr(), aFilename.Length());
   107     path = QString::fromUtf16(aPath.Ptr(), aPath.Length());
   107     path = QString::fromUtf16(aPath.Ptr(), aPath.Length());
   108     return LoadTranslationFile();  
   108     return LoadTranslationFile();
   109     }
   109     }
   110        
   110 
   111 HBufC* HbTextResolverSymbianPrivate::LoadLC(const TDesC& aMessageId, TInt aPlural)
   111 HBufC* HbTextResolverSymbianPrivate::LoadLC(const TDesC& aMessageId, TInt aPlural)
   112     {
   112     {
   113     QString string = ConvertToQString(aMessageId, aPlural);
   113     QString string = ConvertToQString(aMessageId, aPlural);
   114         
   114 
   115     TPtrC descriptor(static_cast<const TUint16*>(string.utf16()),
   115     TPtrC descriptor(static_cast<const TUint16*>(string.utf16()),
   116                     string.length());
   116                     string.length());
   117     return descriptor.AllocLC();
   117     return descriptor.AllocLC();
   118     }
   118     }
   119  
   119 
   120 HBufC* HbTextResolverSymbianPrivate::LoadLC(const TDesC& aMessageId, const TDesC& aString, TInt aPlural)
   120 HBufC* HbTextResolverSymbianPrivate::LoadLC(const TDesC& aMessageId, const TDesC& aString, TInt aPlural)
   121     {
   121     {
   122     QString string = ConvertToQString(aMessageId, aPlural);
   122     QString string = ConvertToQString(aMessageId, aPlural);
   123     QString result = ConvertToQString(aString);
   123     QString result = ConvertToQString(aString);
   124     
   124 
   125     if (result.isEmpty())
   125     if (result.isEmpty())
   126         {
   126         {
   127         result = QString::fromUtf16(aString.Ptr(), aString.Length());
   127         result = QString::fromUtf16(aString.Ptr(), aString.Length());
   128         }
   128         }
   129     string = string.arg(result);     
   129     string = string.arg(result);
   130     TPtrC descriptor(static_cast<const TUint16*>(string.utf16()),
   130     TPtrC descriptor(static_cast<const TUint16*>(string.utf16()),
   131                     string.length());
   131                     string.length());
   132     return descriptor.AllocLC();       
   132     return descriptor.AllocLC();
   133     }
   133     }
   134 
   134 
   135 HBufC* HbTextResolverSymbianPrivate::LoadLC(const TDesC& aMessageId, const MDesCArray& aStrings, TInt aPlural)
   135 HBufC* HbTextResolverSymbianPrivate::LoadLC(const TDesC& aMessageId, const MDesCArray& aStrings, TInt aPlural)
   136     {
   136     {
   137     QString string = ConvertToQString(aMessageId, aPlural);
   137     QString string = ConvertToQString(aMessageId, aPlural);
   138     
   138 
   139     QString tmp;
   139     QString tmp;
   140     for (int i(0); i < aStrings.MdcaCount(); i++)
   140     for (int i(0); i < aStrings.MdcaCount(); i++)
   141         {
   141         {
   142         TPtrC ptr = aStrings.MdcaPoint(i);
   142         TPtrC ptr = aStrings.MdcaPoint(i);
   143         tmp = ConvertToQString(ptr);
   143         tmp = ConvertToQString(ptr);
   144         
   144 
   145         if (tmp.isEmpty() == 0)
   145         if (tmp.isEmpty() == 0)
   146             {
   146             {
   147             tmp = QString::fromUtf16(ptr.Ptr(), ptr.Length());
   147             tmp = QString::fromUtf16(ptr.Ptr(), ptr.Length());
   148             }      
   148             }
   149         string = string.arg(tmp);
   149         string = string.arg(tmp);
   150         }            
   150         }
   151     TPtrC descriptor(static_cast<const TUint16*>(string.utf16()),
   151     TPtrC descriptor(static_cast<const TUint16*>(string.utf16()),
   152                     string.length());
   152                     string.length());
   153     return descriptor.AllocLC();
   153     return descriptor.AllocLC();
   154     }
   154     }
   155        
   155 
   156 HBufC* HbTextResolverSymbianPrivate::LoadLC(const TDesC& aMessageId, TInt aInt, TInt aPlural)
   156 HBufC* HbTextResolverSymbianPrivate::LoadLC(const TDesC& aMessageId, TInt aInt, TInt aPlural)
   157     {
   157     {
   158     QString string = ConvertToQString(aMessageId, aPlural);       
   158     QString string = ConvertToQString(aMessageId, aPlural);
   159     string = string.arg(aInt); 
   159     string = string.arg(aInt); 
   160     
   160 
   161     TPtrC descriptor(static_cast<const TUint16*>(string.utf16()),
   161     TPtrC descriptor(static_cast<const TUint16*>(string.utf16()),
   162                     string.length());
   162                     string.length());
   163     return descriptor.AllocLC(); 
   163     return descriptor.AllocLC(); 
   164     }    
   164     }
   165         
   165 
   166 HBufC* HbTextResolverSymbianPrivate::LoadLC(const TDesC& aMessageId, const RArray<TInt>& aInts, TInt aPlural)
   166 HBufC* HbTextResolverSymbianPrivate::LoadLC(const TDesC& aMessageId, const RArray<TInt>& aInts, TInt aPlural)
   167     {
   167     {
   168     QString string = ConvertToQString(aMessageId, aPlural);
   168     QString string = ConvertToQString(aMessageId, aPlural);
   169     
   169 
   170     for (int i(0); i < aInts.Count(); i++)
   170     for (int i(0); i < aInts.Count(); i++)
   171         {                              
   171         {
   172         string = string.arg(aInts[i]);
   172         string = string.arg(aInts[i]);
   173         }            
   173         }
   174              
   174 
   175     TPtrC descriptor(static_cast<const TUint16*>(string.utf16()),
   175     TPtrC descriptor(static_cast<const TUint16*>(string.utf16()),
   176                     string.length());
   176                     string.length());
   177     return descriptor.AllocLC();
   177     return descriptor.AllocLC();
   178     }
   178     }
   179         
   179 
   180 QString HbTextResolverSymbianPrivate::ConvertToQString(const TDesC& aMessageId, TInt aPlural)
   180 QString HbTextResolverSymbianPrivate::ConvertToQString(const TDesC& aMessageId, TInt aPlural)
   181     {        
   181     {
   182     QString result = QString::fromUtf16(aMessageId.Ptr(), aMessageId.Length());
   182     QString result = QString::fromUtf16(aMessageId.Ptr(), aMessageId.Length());
   183     iByteArray = result.toLatin1();
   183     iByteArray = result.toLatin1();
   184     const char* tmp = iByteArray.data();        
   184     const char* tmp = iByteArray.data();
   185 
   185 
   186     QString string;
   186     QString string;
   187     if (aPlural == -1)
   187     if (aPlural == -1)
   188         {        
   188         {
   189         string = iTranslator.translate(0, tmp, 0);           
   189         string = iTranslator.translate(0, tmp, 0);
   190         }
   190         }
   191     else
   191     else
   192         {
   192         {
   193         string = iTranslator.translate(0, tmp, 0, aPlural);
   193         string = iTranslator.translate(0, tmp, 0, aPlural);
   194         }
   194         }
   195 
   195 
   196     if (string.isEmpty()) 
   196     if (string.isEmpty())
   197         {
   197         {
   198         string = result;
   198         string = result;
   199         }
   199         }
   200     replacePercentN(&string, aPlural);
   200     replacePercentN(&string, aPlural);
   201     return string;
   201     return string;
   202     }
   202     }
   203 
   203 
   204 /*!
   204 /*!
   205     \class HbTextResolverSymbian
   205     \class HbTextResolverSymbian
   206     \brief HbTextResolverSymbian implements translation support for Symbian OS applications.
   206     \brief HbTextResolverSymbian implements translation support for Symbian OS applications.
   207     
   207 
   208     HbTextResolverSymbian is class that provides convenience API for translation support and
   208     HbTextResolverSymbian is a class that provides convenience API for translation support and
   209     is meant to be used only by pure Symbian OS applications. Dynamic strings and plurals are
   209     is meant to be used only by pure Symbian OS applications. Dynamic strings and plurals are
   210     also supported. 
   210     also supported. 
   211     
   211 
   212     Before using the translation support HbTextResolverSymbian must be initialized. Note that 
   212     Before using the translation support HbTextResolverSymbian must be initialized. In the following
   213     the filename must not have language specific suffix, because that is handled internally by
   213     example HbTextResolverSymbian is initialized using somefile_en.qm Qt translation binary file 
   214     HbTextResolverSymbian.
   214     from c:\\resource directory. Note that the filename must not have language specific suffix, 
   215     
   215     because that is handled internally by HbTextResolverSymbian using QLocale.
       
   216 
   216     \code
   217     \code
   217     _LIT(KSomeFile, "somefile_");
   218     // Using somefile_en.qm translation file, when language is english. Language spesific suffix is
       
   219     // omitted in the file name.
       
   220     _LIT(KFileName, "somefile_");
   218     _LIT(KPath, "c:\\resource");
   221     _LIT(KPath, "c:\\resource");
   219     
   222 
   220     TBool result = HbTextResolverSymbian::Init(KSomeFile, KPath);
   223     TBool result = HbTextResolverSymbian::Init(KFileName, KPath);
   221     \endcode
   224     \endcode
   222     
   225 
   223     Translating a string given the snippet from a translation file (.ts) below:
   226     Translating a string given the snippet from a translation file (.ts) below:
   224     ...
   227 
   225     \code
   228     \code
   226     <message id="text_test">
   229     <message id="text_test">
   227         <source>Test</source>
   230         <source>Test</source>
   228         <translation>Text test</translation>
   231         <translation>Text test</translation>
   229     </message>
   232     </message>
   230     
   233 
   231     _LIT(KTextTest, "text_test");
   234     _LIT(KTextTest, "text_test");
   232     // returns the string "Text test"
   235     // returns the string "Text test"
   233     HBufC* tmp = HbTextResolverSymbian::LoadL(KTextTest);
   236     HBufC* tmp = HbTextResolverSymbian::LoadL(KTextTest);
   234     \endcode
   237     \endcode
   235     
   238 
   236     Translating a string with replacement string given the snippet from a translation
   239     Translating a string with replacement string given the snippet from a translation
   237     file below:
   240     file below:
   238     
   241 
   239     \code
   242     \code
   240     <message id="text_test2">
   243     <message id="text_test2">
   241         <source>Test2</source>
   244         <source>Test2</source>
   242         <translation>Test2 %1</translation>
   245         <translation>Test2 %1</translation>
   243     </message>
   246     </message>
   244     
   247 
   245     
       
   246     _LIT(KTextTest2, "text_test2");
   248     _LIT(KTextTest2, "text_test2");
   247     _LIT(KTextTestReplace,"passed.");
   249     _LIT(KTextTestReplace,"passed.");
   248     // returns the string "Test2 passed." 
   250     // returns the string "Test2 passed." 
   249     HBufC* tmp = HbTextResolverSymbian::LoadL(KTextTest2, KTextTestReplace);
   251     HBufC* tmp = HbTextResolverSymbian::LoadL(KTextTest2, KTextTestReplace);
   250     \endcode
   252     \endcode
   251    
   253 
   252     Translating a string with replacement strings given the snippet from a translation
   254     Translating a string with replacement strings given the snippet from a translation
   253     file below:
   255     file below:
   254     
   256 
   255     \code
   257     \code
   256     <message id="text_test3">
   258     <message id="text_test3">
   257         <source>Test3</source>
   259         <source>Test3</source>
   258         <translation>Test3 %1 %2</translation>
   260         <translation>Test3 %1 %2</translation>
   259     </message>
   261     </message>
   260     
   262 
   261     
       
   262     _LIT(KTextTest3, "text_test3");
   263     _LIT(KTextTest3, "text_test3");
   263     _LIT(KTextTest3Replace1,"is");
   264     _LIT(KTextTest3Replace1,"is");
   264     _LIT(KTextTest3Replace2,"passed.");
   265     _LIT(KTextTest3Replace2,"passed.");
   265     
   266 
   266     CDesC16ArrayFlat* array = new CDesC16ArrayFlat(8);
   267     CDesC16ArrayFlat* array = new CDesC16ArrayFlat(8);
   267     TBufC<20> buffer;
   268     TBufC<20> buffer;
   268     buffer = KTextTest3Replace1;
   269     buffer = KTextTest3Replace1;
   269     array->AppendL(buffer);
   270     array->AppendL(buffer);
   270     buffer = KTextTest3Replace2;
   271     buffer = KTextTest3Replace2;
   271     array->AppendL(buffer);
   272     array->AppendL(buffer);
   272     // returns the string "Test3 is passed."
   273     // returns the string "Test3 is passed."
   273     HBufC* tmp = HbTextResolverSymbian::LoadL(KTextTest3, *array);
   274     HBufC* tmp = HbTextResolverSymbian::LoadL(KTextTest3, *array);
   274    \endcode       
   275    \endcode
   275    
   276 
   276    Note: String e.g. "Moving %1 files of %2 from %3" where place markers %1 and %2 are
       
   277    for integer values and the %3 is for a string, requires that the integers are converted
       
   278    to descriptors and appended to MDesArray. Those are converted back to integers during 
       
   279    replacement.
       
   280    
       
   281    Translating a string with replacement integer given the snippet from a translation
   277    Translating a string with replacement integer given the snippet from a translation
   282    file below:
   278    file below:
   283    \code
   279    \code
   284     </message>
   280     </message>
   285         <message id="text_test4" numerus="yes">
   281         <message id="text_test4" numerus="yes">
   287         <translation>
   283         <translation>
   288         <numerusform>%n message of %1</numerusform>
   284         <numerusform>%n message of %1</numerusform>
   289         <numerusform>%n messages of %1</numerusform>
   285         <numerusform>%n messages of %1</numerusform>
   290         </translation>
   286         </translation>
   291     </message>
   287     </message>
   292     
   288 
   293     
       
   294     _LIT(KTextTest4, "text_test4");
   289     _LIT(KTextTest4, "text_test4");
   295     // returns the string "1 message of 5"
   290     // returns the string "1 message of 5"
   296     HBufC* tmp = HbTextResolverSymbian::LoadL(KTextTest4, 5, 1);
   291     HBufC* tmp = HbTextResolverSymbian::LoadL(KTextTest4, 5, 1);
   297     // // returns the string "2 messages of 5"
   292     // returns the string "2 messages of 5"
   298     tmp = HbTextResolverSymbian::LoadL(KTextTest4, 5, 2);
   293     tmp = HbTextResolverSymbian::LoadL(KTextTest4, 5, 2);
   299     \endcode
   294     \endcode
   300     
   295 
   301     Translating a string with replacement integers given the snippet from a translation
   296     Translating a string with replacement integers given the snippet from a translation
   302     file below:
   297     file below:
   303     \code
   298     \code
   304     <message id="text_test3">
   299     <message id="text_test3">
   305         <source>Test3</source>
   300         <source>Test3</source>
   306         <translation>Test3 %1 %2</translation>
   301         <translation>Test3 %1 %2</translation>
   307     </message>
   302     </message>
   308     
   303 
   309     
       
   310     RArray<TInt> intarray;
   304     RArray<TInt> intarray;
   311     intarray.Append(20);
   305     intarray.Append(20);
   312     intarray.Append(30);
   306     intarray.Append(30);
   313     
   307     // returns the string "Test3 20 30"
   314     HBufC* tmp = HbTextResolverSymbian::LoadL(KTextTest3, intarray, 1);
   308     HBufC* tmp = HbTextResolverSymbian::LoadL(KTextTest3, intarray, 1);
   315     \endcode
   309     \endcode
   316 
   310 
   317     \stable
   311     \stable
   318     \hbcore
   312     \hbcore
   319 */
   313 */
   320 
   314 
   321 /*!
   315 /*!
   322     Initializes the translator. 
   316     Initializes the translator.
   323         
   317 
   324     \param aFilename specifies the used translation file. 
   318     \param aFilename specifies the used translation file. Note that file name is ended
       
   319     with underscore e.g. somefile_.
   325     \param aPath specifies path to translation file.
   320     \param aPath specifies path to translation file.
       
   321 
       
   322     \return Returns ETrue if initialization was successful.
       
   323 */
       
   324 EXPORT_C TBool HbTextResolverSymbian::Init(const TDesC& aFilename, const TDesC& aPath)
       
   325     {
       
   326     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
       
   327     return resolver->Initialize(aFilename, aPath);
       
   328     }
       
   329 
       
   330 /*!
       
   331     Translates the string.
       
   332     If aPlural is equal to zero or greater, then the translation depending on the
       
   333     plural value is returned. Returns a pointer to a heap descriptor containing the translated
       
   334     string.
       
   335 
       
   336     \param aMessageId Identifier of the string to be translated.
       
   337     \param aPlural Specifies the plural format of the translation.
   326     
   338     
   327     Returns ETrue if initialization was successful.
   339     \return Returns translated string on success or if the translation file does not contain a
   328 */
   340     translation for \a aMessageId in context, this function returns a string equivalent of \a aMessageId.
   329 EXPORT_C TBool HbTextResolverSymbian::Init(const TDesC& aFilename, const TDesC& aPath)
   341 
   330     {
       
   331     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
       
   332     return resolver->Initialize(aFilename, aPath);
       
   333     }    
       
   334 
       
   335 /*!
       
   336     Translates the string. 
       
   337     If aPlural is equal to zero or greater, then the translation depending on the 
       
   338     value is returned. Returns a pointer to a heap descriptor containing the translated
       
   339     string.  
       
   340     If the string for passed \a aMessageId is not found from the translation file then 
       
   341     the source string is returned. 
       
   342         
       
   343     \param aMessageId Identifier of the string to be translated.
       
   344     \param aPlural Specifies the plural format of the translation.    
       
   345 */
   342 */
   346 EXPORT_C HBufC* HbTextResolverSymbian::LoadL(const TDesC& aMessageId, TInt aPlural)
   343 EXPORT_C HBufC* HbTextResolverSymbian::LoadL(const TDesC& aMessageId, TInt aPlural)
   347     {
   344     {
   348     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();    
   345     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   349     HBufC* buf = resolver->LoadLC(aMessageId, aPlural);
   346     HBufC* buf = resolver->LoadLC(aMessageId, aPlural);
   350     CleanupStack::Pop(buf);        
   347     CleanupStack::Pop(buf);
   351     return buf;
   348     return buf;
   352     }
   349     }
   353 
   350 
   354 /*!
   351 /*!
   355     Translates the string and replaces the lowest place marker with the replacement string. 
   352     Translates the string and replaces the lowest place marker with the replacement string.
   356     If \a aPlural is equal to zero or greater, then translation depending on the value
   353     If \a aPlural is equal to zero or greater, then translation depending on the value
   357     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   354     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   358     If the string for passed \a aMessageId or \a aString is not found from the translation
   355     If the string for passed \a aMessageId or \a aString is not found from the translation
   359     file then the source string is used. 
   356     file then the source string is used.
   360         
   357 
   361     \param aMessageId Identifier of the string to be translated.
   358     \param aMessageId Identifier of the string to be translated.
   362     \param aString Replacement string for the lowest %N.
   359     \param aString Replacement string for the lowest %N.
   363     \param aPlural Specifies the plural format of the translation.   
   360     \param aPlural Specifies the plural format of the translation.
   364 */       
   361 
       
   362     \return Returns translated string on success or if the translation file does not contain a
       
   363     translation for \a aMessageId in context, this function returns a string equivalent of \a aMessageId.
       
   364 */
   365 EXPORT_C HBufC* HbTextResolverSymbian::LoadL(const TDesC& aMessageId, const TDesC& aString, TInt aPlural)
   365 EXPORT_C HBufC* HbTextResolverSymbian::LoadL(const TDesC& aMessageId, const TDesC& aString, TInt aPlural)
   366     {
   366     {
   367     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   367     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   368     HBufC* buf = resolver->LoadLC(aMessageId, aString, aPlural);
   368     HBufC* buf = resolver->LoadLC(aMessageId, aString, aPlural);
   369     CleanupStack::Pop(buf);    
   369     CleanupStack::Pop(buf);
   370     return buf;    
   370     return buf;
   371     } 
   371     }
   372 
   372 
   373 /*!
   373 /*!
   374     Translates the string and replaces place markers from the lowest place marker with the 
   374     Translates the string and replaces place markers from the lowest place marker with the
   375     replacement strings provided in the array. 
   375     replacement strings provided in the array.
   376     If \a aPlural is equal to zero or greater, then translation depending on the value
   376     If \a aPlural is equal to zero or greater, then translation depending on the value
   377     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   377     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   378     If the string for passed \a aMessageId or \a aStrings are not found from the translation
   378     If the string for passed \a aMessageId or \a aStrings are not found from the translation
   379     file then the source string is used.      
   379     file then the source string is used.
   380         
   380 
   381     \param aMessageId Identifier of the string to be translated.
   381     \param aMessageId Identifier of the string to be translated.
   382     \param aStrings Replacement strings for the place markers.
   382     \param aStrings Replacement strings for the place markers.
   383     \param aPlural Specifies the plural format of the translation.   
   383     \param aPlural Specifies the plural format of the translation.
       
   384 
       
   385     \return Returns translated string on success or if the translation file does not contain a
       
   386     translation for \a aMessageId in context, this function returns a string equivalent of \a aMessageId.
   384 */          
   387 */          
   385 EXPORT_C HBufC* HbTextResolverSymbian::LoadL(const TDesC& aMessageId, const MDesCArray& aStrings, TInt aPlural)
   388 EXPORT_C HBufC* HbTextResolverSymbian::LoadL(const TDesC& aMessageId, const MDesCArray& aStrings, TInt aPlural)
   386     {
   389     {
   387     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   390     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   388     HBufC* buf = resolver->LoadLC(aMessageId, aStrings, aPlural);
   391     HBufC* buf = resolver->LoadLC(aMessageId, aStrings, aPlural);
   389     CleanupStack::Pop(buf);
   392     CleanupStack::Pop(buf);
   390     return buf; 
   393     return buf; 
   391     }
   394     }
   392 
   395 
   393 /*!
   396 /*!
   394     Translates the string and replaces the lowest place marker with the replacement integer. 
   397     Translates the string and replaces the lowest place marker with the replacement integer.
   395     If \a aPlural is equal to zero or greater, then translation depending on the value
   398     If \a aPlural is equal to zero or greater, then translation depending on the value
   396     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   399     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   397     If the string for passed \a aMessageId is not found from the translation
   400     If the string for passed \a aMessageId is not found from the translation
   398     file then the source string is used. 
   401     file then the source string is used.
   399         
   402 
   400     \param aMessageId Identifier of the string to be translated.
   403     \param aMessageId Identifier of the string to be translated.
   401     \param aInt Replacement integer for the lowest place marker %(index).
   404     \param aInt Replacement integer for the lowest place marker %(index).
   402     \param aPlural Specifies the plural format of the translation.   
   405     \param aPlural Specifies the plural format of the translation. 
   403 */    
   406 
       
   407     \return Returns translated string on success or if the translation file does not contain a
       
   408     translation for \a aMessageId in context, this function returns a string equivalent of \a aMessageId.
       
   409 */
   404 EXPORT_C HBufC* HbTextResolverSymbian::LoadL(const TDesC& aMessageId, TInt aInt, TInt aPlural)
   410 EXPORT_C HBufC* HbTextResolverSymbian::LoadL(const TDesC& aMessageId, TInt aInt, TInt aPlural)
   405     {
   411     {
   406     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   412     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   407     HBufC* buf = resolver->LoadLC(aMessageId, aInt, aPlural);      
   413     HBufC* buf = resolver->LoadLC(aMessageId, aInt, aPlural);
   408     CleanupStack::Pop(buf);
   414     CleanupStack::Pop(buf);
   409     return buf;     
   415     return buf;
   410     } 
   416     }
   411 
   417 
   412 /*!
   418 /*!
   413     Translates the string and replaces place markers from the lowest place marker with the 
   419     Translates the string and replaces place markers from the lowest place marker with the
   414     replacement integers provided in the array. 
   420     replacement integers provided in the array.
   415     If \a aPlural is equal to zero or greater, then translation depending on the value
   421     If \a aPlural is equal to zero or greater, then translation depending on the value
   416     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   422     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   417     If the string for passed \a aMessageId is not found from the translation
   423     If the string for passed \a aMessageId is not found from the translation
   418     file then the source string is used.
   424     file then the source string is used.
   419            
   425 
   420     \param aMessageId Identifier of the string to be translated.
   426     \param aMessageId Identifier of the string to be translated.
   421     \param aInts Replacement integers for the place markers.
   427     \param aInts Replacement integers for the place markers.
   422     \param aPlural Specifies the plural format of the translation.   
   428     \param aPlural Specifies the plural format of the translation.
   423 */         
   429 
       
   430     \return Returns translated string on success or if the translation file does not contain a
       
   431     translation for \a aMessageId in context, this function returns a string equivalent of \a aMessageId.
       
   432 */
   424 EXPORT_C HBufC* HbTextResolverSymbian::LoadL(const TDesC& aMessageId, const RArray<TInt>& aInts, TInt aPlural)
   433 EXPORT_C HBufC* HbTextResolverSymbian::LoadL(const TDesC& aMessageId, const RArray<TInt>& aInts, TInt aPlural)
   425     {
   434     {
   426     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   435     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   427     HBufC* buf = resolver->LoadLC(aMessageId, aInts, aPlural);
   436     HBufC* buf = resolver->LoadLC(aMessageId, aInts, aPlural);
   428     CleanupStack::Pop(buf);    
   437     CleanupStack::Pop(buf);
   429     return buf;
   438     return buf;
   430     }
   439     }
   431 
   440 
   432 /*!
   441 /*!
   433     Translates the string. 
   442     Translates the string.
   434     If aPlural is equal to zero or greater, then the translation depending on the 
   443     If aPlural is equal to zero or greater, then the translation depending on the
   435     value is returned. Returns a pointer to a heap descriptor containing the translated
   444     value is returned. Returns a pointer to a heap descriptor containing the translated
   436     string. Pointer is pushed to cleanup stack.  
   445     string. Pointer is pushed to cleanup stack.
   437     If the string for passed \a aMessageId is not found from the translation file then 
   446     If the string for passed \a aMessageId is not found from the translation file then
   438     the source string is returned. 
   447     the source string is returned.
   439         
   448 
   440     \param aMessageId Identifier of the string to be translated.
   449     \param aMessageId Identifier of the string to be translated.
   441     \param aPlural Specifies the plural format of the translation.    
   450     \param aPlural Specifies the plural format of the translation.
       
   451 
       
   452     \return Returns translated string on success or if the translation file does not contain a
       
   453     translation for \a aMessageId in context, this function returns a string equivalent of \a aMessageId.
   442 */     
   454 */     
   443 EXPORT_C HBufC* HbTextResolverSymbian::LoadLC(const TDesC& aMessageId, TInt aPlural)
   455 EXPORT_C HBufC* HbTextResolverSymbian::LoadLC(const TDesC& aMessageId, TInt aPlural)
   444     {
   456     {
   445     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   457     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   446     return resolver->LoadLC(aMessageId, aPlural);       
   458     return resolver->LoadLC(aMessageId, aPlural);       
   447     }
   459     }
   448 
   460 
   449 /*!
   461 /*!
   450     Translates the string and replaces the lowest place marker with the replacement string. 
   462     Translates the string and replaces the lowest place marker with the replacement string.
   451     If \a aPlural is equal to zero or greater, then translation depending on the value
   463     If \a aPlural is equal to zero or greater, then translation depending on the value
   452     is returned. Returns a pointer to a heap descriptor containing the formatted string. 
   464     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   453     Pointer is pushed to cleanup stack.
   465     Pointer is pushed to cleanup stack.
   454     If the string for passed \a aMessageId or \a aString is not found from the translation
   466     If the string for passed \a aMessageId or \a aString is not found from the translation
   455     file then the source string is used. 
   467     file then the source string is used.
   456         
   468 
   457     \param aMessageId Identifier of the string to be translated.
   469     \param aMessageId Identifier of the string to be translated.
   458     \param aString Replacement string for the lowest %N.
   470     \param aString Replacement string for the lowest %N.
   459     \param aPlural Specifies the plural format of the translation.   
   471     \param aPlural Specifies the plural format of the translation.
   460 */         
   472 
       
   473     \return Returns translated string on success or if the translation file does not contain a
       
   474     translation for \a aMessageId in context, this function returns a string equivalent of \a aMessageId.
       
   475 */
   461 EXPORT_C HBufC* HbTextResolverSymbian::LoadLC(const TDesC& aMessageId, const TDesC& aString, TInt aPlural)
   476 EXPORT_C HBufC* HbTextResolverSymbian::LoadLC(const TDesC& aMessageId, const TDesC& aString, TInt aPlural)
   462     {
   477     {
   463     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   478     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   464     return resolver->LoadLC(aMessageId, aString, aPlural);
   479     return resolver->LoadLC(aMessageId, aString, aPlural);
   465     }
   480     }
   466 
   481 
   467 /*!
   482 /*!
   468     Translates the string and replaces place markers from the lowest place marker with the 
   483     Translates the string and replaces place markers from the lowest place marker with the
   469     replacement strings provided in the array. 
   484     replacement strings provided in the array.
   470     If \a aPlural is equal to zero or greater, then translation depending on the value
   485     If \a aPlural is equal to zero or greater, then translation depending on the value
   471     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   486     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   472     Pointer is pushed to cleanup stack.
   487     Pointer is pushed to cleanup stack.
   473     If the string for passed \a aMessageId or \a aStrings are not found from the translation
   488     If the string for passed \a aMessageId or \a aStrings are not found from the translation
   474     file then the source string is used.
   489     file then the source string is used.
   475         
   490 
   476     \param aMessageId Identifier of the string to be translated.
   491     \param aMessageId Identifier of the string to be translated.
   477     \param aStrings Replacement strings for the place markers.
   492     \param aStrings Replacement strings for the place markers.
   478     \param aPlural Specifies the plural format of the translation.   
   493     \param aPlural Specifies the plural format of the translation.
       
   494 
       
   495     \return Returns translated string on success or if the translation file does not contain a
       
   496     translation for \a aMessageId in context, this function returns a string equivalent of \a aMessageId.
   479 */
   497 */
   480 EXPORT_C HBufC* HbTextResolverSymbian::LoadLC(const TDesC& aMessageId, const MDesCArray& aStrings, TInt aPlural)
   498 EXPORT_C HBufC* HbTextResolverSymbian::LoadLC(const TDesC& aMessageId, const MDesCArray& aStrings, TInt aPlural)
   481     {
   499     {
   482     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   500     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   483     return resolver->LoadLC(aMessageId, aStrings, aPlural);
   501     return resolver->LoadLC(aMessageId, aStrings, aPlural);
   484     }
   502     }
   485 
   503 
   486 /*!
   504 /*!
   487     Translates the string and replaces the lowest place marker with the replacement integer. 
   505     Translates the string and replaces the lowest place marker with the replacement integer.
   488     If \a aPlural is equal to zero or greater, then translation depending on the value
   506     If \a aPlural is equal to zero or greater, then translation depending on the value
   489     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   507     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   490     If the string for passed \a aMessageId is not found from the translation
   508     If the string for passed \a aMessageId is not found from the translation
   491     file then the source string is used. 
   509     file then the source string is used.
   492         
   510 
   493     \param aMessageId Identifier of the string to be translated.
   511     \param aMessageId Identifier of the string to be translated.
   494     \param aInt Replacement integer for the lowest place marker %(index).
   512     \param aInt Replacement integer for the lowest place marker %(index).
   495     \param aPlural Specifies the plural format of the translation.   
   513     \param aPlural Specifies the plural format of the translation. 
   496 */ 
   514     \return Returns translated string on success or if the translation file does not contain a
       
   515     translation for \a aMessageId in context, this function returns a string equivalent of \a aMessageId.
       
   516 */
   497 EXPORT_C HBufC* HbTextResolverSymbian::LoadLC(const TDesC& aMessageId, TInt aInt, TInt aPlural)
   517 EXPORT_C HBufC* HbTextResolverSymbian::LoadLC(const TDesC& aMessageId, TInt aInt, TInt aPlural)
   498     {
   518     {
   499     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();   
   519     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   500     return resolver->LoadLC(aMessageId, aInt, aPlural);
   520     return resolver->LoadLC(aMessageId, aInt, aPlural);
   501     }
   521     }
   502 
   522 
   503 /*!
   523 /*!
   504     Translates the string and replaces place markers from the lowest place marker with the 
   524     Translates the string and replaces place markers from the lowest place marker with the
   505     replacement integers provided in the array. 
   525     replacement integers provided in the array.
   506     If \a aPlural is equal to zero or greater, then translation depending on the value
   526     If \a aPlural is equal to zero or greater, then translation depending on the value
   507     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   527     is returned. Returns a pointer to a heap descriptor containing the formatted string.
   508     If the string for passed \a aMessageId is not found from the translation
   528     If the string for passed \a aMessageId is not found from the translation
   509     file then the source string is used.
   529     file then the source string is used.
   510            
   530 
   511     \param aMessageId Identifier of the string to be translated.
   531     \param aMessageId Identifier of the string to be translated.
   512     \param aInts Replacement integers for the place markers.
   532     \param aInts Replacement integers for the place markers.
   513     \param aPlural Specifies the plural format of the translation.   
   533     \param aPlural Specifies the plural format of the translation.
   514 */            
   534 
       
   535     \return Returns translated string on success or if the translation file does not contain a
       
   536     translation for \a aMessageId in context, this function returns a string equivalent of \a aMessageId.
       
   537 */
   515 EXPORT_C HBufC* HbTextResolverSymbian::LoadLC(const TDesC& aMessageId, const RArray<TInt>& aInts, TInt aPlural)
   538 EXPORT_C HBufC* HbTextResolverSymbian::LoadLC(const TDesC& aMessageId, const RArray<TInt>& aInts, TInt aPlural)
   516     {
   539     {
   517     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   540     HbTextResolverSymbianPrivate* resolver = HbTextResolverSymbianPrivate::Instance();
   518     return resolver->LoadLC(aMessageId, aInts, aPlural);
   541     return resolver->LoadLC(aMessageId, aInts, aPlural);
   519     }
   542     }
   520