📝 Updated docs for LookupWithContext
This commit is contained in:
		| @@ -1,9 +1,10 @@ | |||||||
| { | { | ||||||
| 	"scripts": { |     "scripts": { | ||||||
| 		"deploy": "gh-pages -d doc/html" |         "build": "node genDocs.js", | ||||||
| 	}, |         "deploy": "gh-pages -d doc/html" | ||||||
| 	"dependencies": { |     }, | ||||||
| 		"doxygen": "^0.3.0", |     "dependencies": { | ||||||
| 		"gh-pages": "^2.0.1" |         "doxygen": "^0.3.0", | ||||||
| 	} |         "gh-pages": "^2.0.1" | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -352,7 +352,7 @@ public: | |||||||
|  |  | ||||||
|     /** \brief Returns the searched translation or returns the input, restricted to the context given by context. |     /** \brief Returns the searched translation or returns the input, restricted to the context given by context. | ||||||
|       * See https://www.gnu.org/software/gettext/manual/html_node/Contexts.html for more info. |       * See https://www.gnu.org/software/gettext/manual/html_node/Contexts.html for more info. | ||||||
|       * \param[in] context The id of the translation to search for. |       * \param[in] context Restrict to the context given. | ||||||
|       * \param[in] id The id of the translation to search for. |       * \param[in] id The id of the translation to search for. | ||||||
|       * \return The value you passed in via _id or the translated string. |       * \return The value you passed in via _id or the translated string. | ||||||
|       */ |       */ | ||||||
| @@ -448,16 +448,6 @@ inline std::string _(const char* id) | |||||||
|     return r; |     return r; | ||||||
| } | } | ||||||
|  |  | ||||||
| /** \brief Looks for the spec. string to translate. |  | ||||||
|   * \param[in] id The string-id to search. |  | ||||||
|   * \return The translation if found, otherwise it returns id. |  | ||||||
|   */ |  | ||||||
| inline std::string _L(const char* id) |  | ||||||
| { |  | ||||||
|     std::string r = moFileReaderSingleton::GetInstance().Lookup(id); |  | ||||||
|     return r; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /// \brief Resets the Lookup-Table. | /// \brief Resets the Lookup-Table. | ||||||
| inline void moFileClearTable() | inline void moFileClearTable() | ||||||
| { | { | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ | |||||||
| #include "gtest/gtest.h" | #include "gtest/gtest.h" | ||||||
|  |  | ||||||
| using namespace moFileLib; | using namespace moFileLib; | ||||||
|  | #define _L(str) moFileReaderSingleton::GetInstance().Lookup(str) | ||||||
| #define _LC(ctx,str) moFileReaderSingleton::GetInstance().LookupWithContext(ctx,str) | #define _LC(ctx,str) moFileReaderSingleton::GetInstance().LookupWithContext(ctx,str) | ||||||
|  |  | ||||||
| auto testMo = "test.mo"; | auto testMo = "test.mo"; | ||||||
| @@ -16,11 +17,11 @@ TEST(moFileReader, Lookup) | |||||||
| { | { | ||||||
|     moFileReaderSingleton::GetInstance ().ReadFile (testMo); |     moFileReaderSingleton::GetInstance ().ReadFile (testMo); | ||||||
|     /* This is the first comment. */ |     /* This is the first comment. */ | ||||||
|     EXPECT_EQ ("Text Nederlands Een", _ ("String English One")); |     EXPECT_EQ ("Text Nederlands Een", _L ("String English One")); | ||||||
|     /* This is the second comment. */ |     /* This is the second comment. */ | ||||||
|     EXPECT_EQ ("Text Nederlands Twee", _ ("String English Two")); |     EXPECT_EQ ("Text Nederlands Twee", _L ("String English Two")); | ||||||
|     /* This is the third comment.  */ |     /* This is the third comment.  */ | ||||||
|     EXPECT_EQ ("Text Nederlands Drie", _ ("String English Three")); |     EXPECT_EQ ("Text Nederlands Drie", _L ("String English Three")); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user