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 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. /**
  10. * Public interface of ownCloud for apps to use.
  11. * L10n interface
  12. *
  13. */
  14. // use OCP namespace for all classes that are considered public.
  15. // This means that they should be used by apps instead of the internal ownCloud classes
  16. namespace OCP;
  17. /**
  18. * TODO: Description
  19. */
  20. interface IL10N {
  21. /**
  22. * Translating
  23. * @param string $text The text we need a translation for
  24. * @param array $parameters default:array() Parameters for sprintf
  25. * @return \OC_L10N_String Translation or the same text
  26. *
  27. * Returns the translation. If no translation is found, $text will be
  28. * returned.
  29. */
  30. public function t($text, $parameters = array());
  31. /**
  32. * Translating
  33. * @param string $text_singular the string to translate for exactly one object
  34. * @param string $text_plural the string to translate for n objects
  35. * @param integer $count Number of objects
  36. * @param array $parameters default:array() Parameters for sprintf
  37. * @return \OC_L10N_String Translation or the same text
  38. *
  39. * Returns the translation. If no translation is found, $text will be
  40. * returned. %n will be replaced with the number of objects.
  41. *
  42. * The correct plural is determined by the plural_forms-function
  43. * provided by the po file.
  44. *
  45. */
  46. public function n($text_singular, $text_plural, $count, $parameters = array());
  47. /**
  48. * Localization
  49. * @param string $type Type of localization
  50. * @param array $data parameters for this localization
  51. * @return string|false
  52. *
  53. * Returns the localized data.
  54. *
  55. * Implemented types:
  56. * - date
  57. * - Creates a date
  58. * - l10n-field: date
  59. * - params: timestamp (int/string)
  60. * - datetime
  61. * - Creates date and time
  62. * - l10n-field: datetime
  63. * - params: timestamp (int/string)
  64. * - time
  65. * - Creates a time
  66. * - l10n-field: time
  67. * - params: timestamp (int/string)
  68. */
  69. public function l($type, $data);
  70. /**
  71. * find the best language
  72. * @param array|string $app details below
  73. * @return string language
  74. *
  75. * If $app is an array, ownCloud assumes that these are the available
  76. * languages. Otherwise ownCloud tries to find the files in the l10n
  77. * folder.
  78. *
  79. * If nothing works it returns 'en'
  80. */
  81. public function getLanguageCode($app=null);
  82. }