il10n.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /**
  3. * @author Bart Visscher <bartv@thisnet.nl>
  4. * @author Bernhard Posselt <dev@bernhard-posselt.com>
  5. * @author Joas Schilling <nickvergessen@owncloud.com>
  6. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
  9. *
  10. * @copyright Copyright (c) 2015, ownCloud, Inc.
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. /**
  27. * Public interface of ownCloud for apps to use.
  28. * L10n interface
  29. *
  30. */
  31. // use OCP namespace for all classes that are considered public.
  32. // This means that they should be used by apps instead of the internal ownCloud classes
  33. namespace OCP;
  34. /**
  35. * TODO: Description
  36. */
  37. interface IL10N {
  38. /**
  39. * Translating
  40. * @param string $text The text we need a translation for
  41. * @param array $parameters default:array() Parameters for sprintf
  42. * @return \OC_L10N_String Translation or the same text
  43. *
  44. * Returns the translation. If no translation is found, $text will be
  45. * returned.
  46. */
  47. public function t($text, $parameters = array());
  48. /**
  49. * Translating
  50. * @param string $text_singular the string to translate for exactly one object
  51. * @param string $text_plural the string to translate for n objects
  52. * @param integer $count Number of objects
  53. * @param array $parameters default:array() Parameters for sprintf
  54. * @return \OC_L10N_String Translation or the same text
  55. *
  56. * Returns the translation. If no translation is found, $text will be
  57. * returned. %n will be replaced with the number of objects.
  58. *
  59. * The correct plural is determined by the plural_forms-function
  60. * provided by the po file.
  61. *
  62. */
  63. public function n($text_singular, $text_plural, $count, $parameters = array());
  64. /**
  65. * Localization
  66. * @param string $type Type of localization
  67. * @param array $data parameters for this localization
  68. * @return string|false
  69. *
  70. * Returns the localized data.
  71. *
  72. * Implemented types:
  73. * - date
  74. * - Creates a date
  75. * - l10n-field: date
  76. * - params: timestamp (int/string)
  77. * - datetime
  78. * - Creates date and time
  79. * - l10n-field: datetime
  80. * - params: timestamp (int/string)
  81. * - time
  82. * - Creates a time
  83. * - l10n-field: time
  84. * - params: timestamp (int/string)
  85. */
  86. public function l($type, $data);
  87. /**
  88. * The code (en, de, ...) of the language that is used for this OC_L10N object
  89. *
  90. * @return string language
  91. */
  92. public function getLanguageCode();
  93. }