1
0

reference-libobs-util-text-lookup.rst 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. Text Lookup Interface
  2. =====================
  3. Used for storing and looking up localized strings. Uses an ini-file
  4. like file format for localization lookup.
  5. .. struct:: text_lookup
  6. .. type:: struct text_lookup lookup_t
  7. .. code:: cpp
  8. #include <util/text-lookup.h>
  9. Text Lookup Functions
  10. ---------------------
  11. .. function:: lookup_t *text_lookup_create(const char *path)
  12. Creates a text lookup object from a text lookup file.
  13. :param path: Path to the localization file
  14. :return: New lookup object, or *NULL* if an error occurred
  15. ---------------------
  16. .. function:: bool text_lookup_add(lookup_t *lookup, const char *path)
  17. Adds text lookup from a text lookup file and replaces any values.
  18. For example, you would load a default fallback language such as
  19. english with :c:func:`text_lookup_create()`, and then call this
  20. function to load the actual desired language in case the desired
  21. language isn't fully translated.
  22. :param lookup: Lookup object
  23. :param path: Path to the localization file
  24. :return: *true* if successful, *false* otherwise
  25. ---------------------
  26. .. function:: void text_lookup_destroy(lookup_t *lookup)
  27. Destroys a text lookup object.
  28. :param lookup: Lookup object
  29. ---------------------
  30. .. function:: bool text_lookup_getstr(lookup_t *lookup, const char *lookup_val, const char **out)
  31. Gets a localized text string.
  32. :param lookup: Lookup object
  33. :param lookup_val: Value to look up
  34. :param out: Pointer that receives the translated string
  35. pointer
  36. :return: *true* if the value exists, *false* otherwise