il10n.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. *
  8. */
  9. namespace OCP;
  10. /**
  11. * TODO: Description
  12. */
  13. interface IL10N {
  14. /**
  15. * Translating
  16. * @param $text String The text we need a translation for
  17. * @param array $parameters default:array() Parameters for sprintf
  18. * @return \OC_L10N_String|string Translation or the same text
  19. *
  20. * Returns the translation. If no translation is found, $text will be
  21. * returned.
  22. */
  23. public function t($text, $parameters = array());
  24. /**
  25. * Translating
  26. * @param $text_singular String the string to translate for exactly one object
  27. * @param $text_plural String the string to translate for n objects
  28. * @param $count Integer Number of objects
  29. * @param array $parameters default:array() Parameters for sprintf
  30. * @return \OC_L10N_String|string Translation or the same text
  31. *
  32. * Returns the translation. If no translation is found, $text will be
  33. * returned. %n will be replaced with the number of objects.
  34. *
  35. * The correct plural is determined by the plural_forms-function
  36. * provided by the po file.
  37. *
  38. */
  39. public function n($text_singular, $text_plural, $count, $parameters = array());
  40. /**
  41. * Localization
  42. * @param $type Type of localization
  43. * @param $params parameters for this localization
  44. * @return String or false
  45. *
  46. * Returns the localized data.
  47. *
  48. * Implemented types:
  49. * - date
  50. * - Creates a date
  51. * - l10n-field: date
  52. * - params: timestamp (int/string)
  53. * - datetime
  54. * - Creates date and time
  55. * - l10n-field: datetime
  56. * - params: timestamp (int/string)
  57. * - time
  58. * - Creates a time
  59. * - l10n-field: time
  60. * - params: timestamp (int/string)
  61. */
  62. public function l($type, $data);
  63. }