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

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