You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

il10n.php 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. * Interface IL10N
  36. *
  37. * @package OCP
  38. * @since 6.0.0
  39. */
  40. interface IL10N {
  41. /**
  42. * Translating
  43. * @param string $text The text we need a translation for
  44. * @param array $parameters default:array() Parameters for sprintf
  45. * @return \OC_L10N_String Translation or the same text
  46. *
  47. * Returns the translation. If no translation is found, $text will be
  48. * returned.
  49. * @since 6.0.0
  50. */
  51. public function t($text, $parameters = array());
  52. /**
  53. * Translating
  54. * @param string $text_singular the string to translate for exactly one object
  55. * @param string $text_plural the string to translate for n objects
  56. * @param integer $count Number of objects
  57. * @param array $parameters default:array() Parameters for sprintf
  58. * @return \OC_L10N_String Translation or the same text
  59. *
  60. * Returns the translation. If no translation is found, $text will be
  61. * returned. %n will be replaced with the number of objects.
  62. *
  63. * The correct plural is determined by the plural_forms-function
  64. * provided by the po file.
  65. * @since 6.0.0
  66. *
  67. */
  68. public function n($text_singular, $text_plural, $count, $parameters = array());
  69. /**
  70. * Localization
  71. * @param string $type Type of localization
  72. * @param int|string $data parameters for this localization
  73. * @param array $options currently supports following options:
  74. * - 'width': handed into \Punic\Calendar::formatDate as second parameter
  75. * @return string|false
  76. *
  77. * Returns the localized data.
  78. *
  79. * Implemented types:
  80. * - date
  81. * - Creates a date
  82. * - l10n-field: date
  83. * - params: timestamp (int/string)
  84. * - datetime
  85. * - Creates date and time
  86. * - l10n-field: datetime
  87. * - params: timestamp (int/string)
  88. * - time
  89. * - Creates a time
  90. * - l10n-field: time
  91. * - params: timestamp (int/string)
  92. * @since 6.0.0 - parameter $options was added in 8.0.0
  93. */
  94. public function l($type, $data, $options = array());
  95. /**
  96. * The code (en, de, ...) of the language that is used for this IL10N object
  97. *
  98. * @return string language
  99. * @since 7.0.0
  100. */
  101. public function getLanguageCode();
  102. }