## Apache Zeta Components Manual :: File Source for ts_backend.php

## Source for file ts_backend.php

Documentation is available at ts_backend.php

1. <?php
2. /**
3. * File containing the ezcTranslationTsBackendOptions class.
4. *
5. * Licensed to the Apache Software Foundation (ASF) under one
6. * or more contributor license agreements. See the NOTICE file
7. * distributed with this work for additional information
8. * regarding copyright ownership. The ASF licenses this file
9. * to you under the Apache License, Version 2.0 (the
10. * "License"); you may not use this file except in compliance
11. * with the License. You may obtain a copy of the License at
12. *
13. * http://www.apache.org/licenses/LICENSE-2.0
14. *
15. * Unless required by applicable law or agreed to in writing,
16. * software distributed under the License is distributed on an
17. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18. * KIND, either express or implied. See the License for the
19. * specific language governing permissions and limitations
20. * under the License.
21. *
22. * @package Translation
23. * @version //autogentag//
24. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
25. * @filesource
26. */
28. /**
29. * Struct class to store the options of the ezcTranslationTsBackend class.
30. *
31. * This class stores the options for the {@link ezcTranslationTsBackend} class.
32. *
33. * @property string $location
34. * Path to the directory that contains all TS .xml files.
35. * @property string $format
36. * Format for the translation file's name. In this format
37. * string the special place holder [LOCALE] will be
38. * replaced with the requested locale's name. For example a
39. * format of "translations/[LOCALE].xml" will result in the
40. * filename for the translation file to be
41. * "translations/nl_NL.xml" if the nl_NL locale is
42. * requested.
43. * @property bool $keepObsolete
44. * When this option is set to "true" the reader will not drop
45. * translation messages with the "obsolete" type set.
46. *
47. * @package Translation
48. * @version //autogentag//
49. * @mainclass
50. */
51. class ezcTranslationTsBackendOptions extends ezcBaseOptions
52. {
53. /**
54. * Constructs a new options class.
55. *
56. * It also sets the default values of the format property
57. *
58. * @param array(string=>mixed) $array The initial options to set.
59. *
60. * @throws ezcBasePropertyNotFoundException
61. * If a the value for the property options is not an instance of
62. * @throws ezcBaseValueException
63. * If a the value for a property is out of range.
64. */
65. public function __construct ( $array = array() )
66. {
67. $this-> properties ['format'] = '[LOCALE].xml';
68. $this-> properties ['keepObsolete'] = false;
69. parent:: __construct ( $array );
70. }
72. /**
73. * Property write access.
74. *
75. * @throws ezcBasePropertyNotFoundException
76. * If a desired property could not be found.
77. * @throws ezcBaseSettingValueException
78. * If a desired property value is out of range.
79. *
80. * @param string $propertyName Name of the property.
81. * @param mixed $val The value for the property.
82. * @ignore
83. */
84. public function __set( $propertyName, $val )
85. {
86. switch ( $propertyName )
87. {
88. case 'location':
89. if ( $val[ strlen ( $val ) - 1] != '/' )
90. {
91. $val .= '/';
92. }
93. break;
94. case 'format':
95. case 'keepObsolete':
96. break;
97. default:
98. throw new ezcBaseSettingNotFoundException ( $propertyName );
99. }
100. $this-> properties [$propertyName] = $val;
101. }
102. }
104. ?>

Documentation generated by phpDocumentor 1.4.3