ifactory.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * @author Joas Schilling <nickvergessen@owncloud.com>
  4. *
  5. * @copyright Copyright (c) 2016, ownCloud, Inc.
  6. * @license AGPL-3.0
  7. *
  8. * This code is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License, version 3,
  10. * as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License, version 3,
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>
  19. *
  20. */
  21. namespace OCP\L10N;
  22. /**
  23. * @since 8.2.0
  24. */
  25. interface IFactory {
  26. /**
  27. * Get a language instance
  28. *
  29. * @param string $app
  30. * @param string|null $lang
  31. * @return \OCP\IL10N
  32. * @since 8.2.0
  33. */
  34. public function get($app, $lang = null);
  35. /**
  36. * Find the best language
  37. *
  38. * @param string|null $app App id or null for core
  39. * @return string language If nothing works it returns 'en'
  40. * @since 9.0.0
  41. */
  42. public function findLanguage($app = null);
  43. /**
  44. * Find all available languages for an app
  45. *
  46. * @param string|null $app App id or null for core
  47. * @return string[] an array of available languages
  48. * @since 9.0.0
  49. */
  50. public function findAvailableLanguages($app = null);
  51. /**
  52. * @param string|null $app App id or null for core
  53. * @param string $lang
  54. * @return bool
  55. * @since 9.0.0
  56. */
  57. public function languageExists($app, $lang);
  58. /**
  59. * @param string|null $app App id or null for core
  60. * @return string
  61. * @since 9.0.0
  62. */
  63. public function setLanguageFromRequest($app = null);
  64. /**
  65. * Creates a function from the plural string
  66. *
  67. * @param string $string
  68. * @return string Unique function name
  69. * @since 9.0.0
  70. */
  71. public function createPluralFunction($string);
  72. }