LocString.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. using System.Runtime.CompilerServices;
  5. namespace BansheeEngine
  6. {
  7. /** @addtogroup GUI
  8. * @{
  9. */
  10. public partial class LocString
  11. {
  12. /// <summary>
  13. /// Converts a normal string into a localized string by using the normal string as the identifier.
  14. /// </summary>
  15. /// <param name="identifier">Localized string identifier.</param>
  16. /// <returns>Localized string with the provided identifier, from the default string table.</returns>
  17. public static implicit operator LocString(string identifier)
  18. {
  19. return new LocString(identifier);
  20. }
  21. /// <summary>
  22. /// Retrieves localized text for the active language from the localized string.
  23. /// </summary>
  24. /// <param name="text">Localized string to retrieve the text from.</param>
  25. /// <returns>Translated text for the currently active language.</returns>
  26. public static explicit operator string(LocString text)
  27. {
  28. return Internal_getValue(text.mCachedPtr);
  29. }
  30. }
  31. /** @} */
  32. }