| @@ 126-170 (lines=45) @@ | ||
| 123 | * |
|
| 124 | * @return string |
|
| 125 | */ |
|
| 126 | public static function initialLetter($name) { |
|
| 127 | $name = I18N::strtoupper($name); |
|
| 128 | switch (WT_LOCALE) { |
|
| 129 | case 'cs': |
|
| 130 | if (substr($name, 0, 2) == 'CH') { |
|
| 131 | return 'CH'; |
|
| 132 | } |
|
| 133 | break; |
|
| 134 | case 'da': |
|
| 135 | case 'nb': |
|
| 136 | case 'nn': |
|
| 137 | if (substr($name, 0, 2) == 'AA') { |
|
| 138 | return 'Å'; |
|
| 139 | } |
|
| 140 | break; |
|
| 141 | case 'hu': |
|
| 142 | if (substr($name, 0, 2) == 'CS') { |
|
| 143 | return 'CS'; |
|
| 144 | } elseif (substr($name, 0, 3) == 'DZS') { |
|
| 145 | return 'DZS'; |
|
| 146 | } elseif (substr($name, 0, 2) == 'DZ') { |
|
| 147 | return 'DZ'; |
|
| 148 | } elseif (substr($name, 0, 2) == 'GY') { |
|
| 149 | return 'GY'; |
|
| 150 | } elseif (substr($name, 0, 2) == 'LY') { |
|
| 151 | return 'LY'; |
|
| 152 | } elseif (substr($name, 0, 2) == 'NY') { |
|
| 153 | return 'NY'; |
|
| 154 | } elseif (substr($name, 0, 2) == 'SZ') { |
|
| 155 | return 'SZ'; |
|
| 156 | } elseif (substr($name, 0, 2) == 'TY') { |
|
| 157 | return 'TY'; |
|
| 158 | } elseif (substr($name, 0, 2) == 'ZS') { |
|
| 159 | return 'ZS'; |
|
| 160 | } |
|
| 161 | break; |
|
| 162 | case 'nl': |
|
| 163 | if (substr($name, 0, 2) == 'IJ') { |
|
| 164 | return 'IJ'; |
|
| 165 | } |
|
| 166 | break; |
|
| 167 | } |
|
| 168 | // No special rules - just take the first character |
|
| 169 | return mb_substr($name, 0, 1); |
|
| 170 | } |
|
| 171 | ||
| 172 | /** |
|
| 173 | * Generate SQL to match a given letter, taking care of cases that |
|
| @@ 127-171 (lines=45) @@ | ||
| 124 | * |
|
| 125 | * @return string |
|
| 126 | */ |
|
| 127 | public function initialLetter($name) { |
|
| 128 | $name = I18N::strtoupper($name); |
|
| 129 | switch (WT_LOCALE) { |
|
| 130 | case 'cs': |
|
| 131 | if (substr($name, 0, 2) == 'CH') { |
|
| 132 | return 'CH'; |
|
| 133 | } |
|
| 134 | break; |
|
| 135 | case 'da': |
|
| 136 | case 'nb': |
|
| 137 | case 'nn': |
|
| 138 | if (substr($name, 0, 2) == 'AA') { |
|
| 139 | return 'Å'; |
|
| 140 | } |
|
| 141 | break; |
|
| 142 | case 'hu': |
|
| 143 | if (substr($name, 0, 2) == 'CS') { |
|
| 144 | return 'CS'; |
|
| 145 | } elseif (substr($name, 0, 3) == 'DZS') { |
|
| 146 | return 'DZS'; |
|
| 147 | } elseif (substr($name, 0, 2) == 'DZ') { |
|
| 148 | return 'DZ'; |
|
| 149 | } elseif (substr($name, 0, 2) == 'GY') { |
|
| 150 | return 'GY'; |
|
| 151 | } elseif (substr($name, 0, 2) == 'LY') { |
|
| 152 | return 'LY'; |
|
| 153 | } elseif (substr($name, 0, 2) == 'NY') { |
|
| 154 | return 'NY'; |
|
| 155 | } elseif (substr($name, 0, 2) == 'SZ') { |
|
| 156 | return 'SZ'; |
|
| 157 | } elseif (substr($name, 0, 2) == 'TY') { |
|
| 158 | return 'TY'; |
|
| 159 | } elseif (substr($name, 0, 2) == 'ZS') { |
|
| 160 | return 'ZS'; |
|
| 161 | } |
|
| 162 | break; |
|
| 163 | case 'nl': |
|
| 164 | if (substr($name, 0, 2) == 'IJ') { |
|
| 165 | return 'IJ'; |
|
| 166 | } |
|
| 167 | break; |
|
| 168 | } |
|
| 169 | // No special rules - just take the first character |
|
| 170 | return mb_substr($name, 0, 1); |
|
| 171 | } |
|
| 172 | ||
| 173 | /** |
|
| 174 | * Generate SQL to match a given letter, taking care of cases that |
|