├── .gitignore ├── LICENSE.txt ├── NOTICE.txt ├── README.md ├── RELEASE-NOTES.txt ├── pom.xml └── src ├── changes └── changes.xml ├── conf └── MANIFEST.MF ├── main ├── assembly │ └── dist.xml ├── gen │ └── org │ │ └── joda │ │ └── time │ │ └── contrib │ │ └── i18n │ │ ├── CLDRTerritoryGenerator.java │ │ └── supplementalData.xml └── java │ └── org │ └── joda │ └── time │ └── contrib │ └── i18n │ ├── CLDRTerritory.java │ ├── CLDRTerritoryData.dat │ └── Territory.java ├── site ├── resources │ ├── css │ │ └── site.css │ └── download.html ├── site.xml └── xdoc │ ├── index.xml │ └── licensecover.xml └── test └── java └── org └── joda └── time └── contrib └── i18n └── TestTerritory.java /.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /target/ 3 | *.log 4 | /tests/ 5 | .checkstyle 6 | .classpath 7 | .project 8 | /.settings/ 9 | /nbproject/ 10 | .idea 11 | *.iml 12 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | ============================================================================= 2 | = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = 3 | ============================================================================= 4 | This product includes software developed by 5 | Joda.org (http://www.joda.org/). 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Joda-Time-I18N 2 | -------------- 3 | 4 | [Joda-Time](http://www.joda.org/joda-time/) provides a complete quality alternative to the JDK date and time classes. 5 | Many aspects of date and time require internationalized data. 6 | This project provides access to additional I18N data not supplied as part of the standard Joda-Time release. 7 | 8 | - Time zones by territory 9 | - First day of week by territory 10 | - Business week by territory 11 | - Weekend by territory 12 | 13 | As a flavour of the functionality, here's how to find out what days are the weekend in Egypt: 14 | 15 | ```java 16 | Territory t = Territory.forID("EG"); 17 | int weekendStartDay = t.getWeekendStart(); 18 | int weekendEndDay = t.getWeekendEnd(); 19 | ``` 20 | 21 | Joda-Time-I18N is licensed under the business-friendly [Apache 2.0 licence](http://www.joda.org/joda-time-18n/license.html). 22 | 23 | 24 | ### Documentation 25 | Various documentation is available: 26 | 27 | * The [home page](http://www.joda.org/joda-time-i18n/) 28 | * The [Javadoc](http://www.joda.org/joda-time-i18n/apidocs/index.html) 29 | * The change notes for the [releases](http://www.joda.org/joda-time-i18n/changes-report.html) 30 | 31 | 32 | ### Support 33 | Please use GitHub issues and Pull Requests for support. 34 | -------------------------------------------------------------------------------- /RELEASE-NOTES.txt: -------------------------------------------------------------------------------- 1 | 2 | Joda-Time Contributions area - Internationalization v0.1 3 | ======================================================== 4 | Joda-Time is a date and time library that vastly improves on the JDK. 5 | This release provides additional support for internationalization. 6 | 7 | This library is a user contribution by Stephen Colebourne. 8 | 9 | The Joda-Time contributions area hosts additional code that may be of 10 | use when working with the main Joda-Time library. 11 | Each of these contributions is licensed using the Apache License v2.0. 12 | 13 | Please note that this code is not supported in the same way as the main 14 | Joda-Time code. As such it is possible that methods and classes may come 15 | and go over time without warning - you have been warned! 16 | 17 | 18 | Home page: http://www.joda.org/joda-time-i18n/ 19 | GitHub: https://github.com/JodaOrg/joda-time-i18n 20 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 4.0.0 8 | joda-time 9 | joda-time-i18n 10 | jar 11 | Joda-Time-I18N 12 | 0.2-SNAPSHOT 13 | Contribution to Joda-Time that adds further internationalization support 14 | http://www.joda.org/joda-time-i18n/ 15 | 16 | 17 | 18 | GitHub 19 | https://github.com/JodaOrg/joda-time-i18n/issues 20 | 21 | 2005 22 | 23 | 24 | 25 | 26 | jodastephen 27 | Stephen Colebourne 28 | 29 | Project Lead 30 | 31 | 0 32 | https://github.com/jodastephen 33 | 34 | 35 | 36 | 37 | 38 | 39 | Apache License, Version 2.0 40 | http://www.apache.org/licenses/LICENSE-2.0.txt 41 | repo 42 | 43 | 44 | 45 | scm:git:https://github.com/JodaOrg/joda-time-i18n.git 46 | scm:git:git@github.com:JodaOrg/joda-time-i18n.git 47 | https://github.com/JodaOrg/joda-time-i18n 48 | 49 | 50 | Joda.org 51 | http://www.joda.org 52 | 53 | 54 | 55 | 56 | 57 | 58 | META-INF 59 | ${project.basedir} 60 | 61 | LICENSE.txt 62 | NOTICE.txt 63 | 64 | 65 | 66 | . 67 | src/main/java 68 | 69 | org/joda/time/contrib/i18n/*.dat 70 | 71 | 72 | 73 | 74 | 75 | 76 | org.apache.maven.plugins 77 | maven-jar-plugin 78 | 79 | 80 | src/conf/MANIFEST.MF 81 | 82 | true 83 | true 84 | 85 | 86 | 87 | 88 | 89 | org.apache.maven.plugins 90 | maven-surefire-plugin 91 | 92 | 93 | **/Test* 94 | 95 | 96 | 97 | 98 | org.apache.maven.plugins 99 | maven-javadoc-plugin 100 | 101 | 102 | http://www.joda.org/joda-time/apidocs/ 103 | 104 | 105 | 106 | 107 | attach-javadocs 108 | package 109 | 110 | jar 111 | 112 | 113 | 114 | 115 | 116 | org.apache.maven.plugins 117 | maven-source-plugin 118 | 119 | 120 | attach-sources 121 | package 122 | 123 | jar-no-fork 124 | 125 | 126 | 127 | 128 | 129 | org.apache.maven.plugins 130 | maven-assembly-plugin 131 | 132 | false 133 | 134 | src/main/assembly/dist.xml 135 | 136 | gnu 137 | 138 | 139 | 140 | make-assembly 141 | deploy 142 | 143 | single 144 | 145 | 146 | 147 | 148 | 149 | org.apache.maven.plugins 150 | maven-site-plugin 151 | 152 | true 153 | 154 | 155 | 156 | com.github.github 157 | site-maven-plugin 158 | 0.9 159 | 160 | 161 | github-site 162 | 163 | site 164 | 165 | site-deploy 166 | 167 | 168 | 169 | Create website for ${project.artifactId} v${project.version} 170 | ${project.artifactId} 171 | true 172 | github 173 | JodaOrg 174 | jodaorg.github.io 175 | refs/heads/master 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | org.apache.maven.plugins 185 | maven-assembly-plugin 186 | ${maven-assembly-plugin.version} 187 | 188 | 189 | org.apache.maven.plugins 190 | maven-checkstyle-plugin 191 | ${maven-checkstyle-plugin.version} 192 | 193 | 194 | org.apache.maven.plugins 195 | maven-changes-plugin 196 | ${maven-changes-plugin.version} 197 | 198 | 199 | org.apache.maven.plugins 200 | maven-clean-plugin 201 | ${maven-clean-plugin.version} 202 | 203 | 204 | org.apache.maven.plugins 205 | maven-compiler-plugin 206 | ${maven-compiler-plugin.version} 207 | 208 | 209 | org.apache.maven.plugins 210 | maven-deploy-plugin 211 | ${maven-deploy-plugin.version} 212 | 213 | 214 | org.apache.maven.plugins 215 | maven-dependency-plugin 216 | ${maven-dependency-plugin.version} 217 | 218 | 219 | org.apache.maven.plugins 220 | maven-gpg-plugin 221 | ${maven-gpg-plugin.version} 222 | 223 | 224 | org.apache.maven.plugins 225 | maven-install-plugin 226 | ${maven-install-plugin.version} 227 | 228 | 229 | org.apache.maven.plugins 230 | maven-jar-plugin 231 | ${maven-jar-plugin.version} 232 | 233 | 234 | org.apache.maven.plugins 235 | maven-javadoc-plugin 236 | ${maven-javadoc-plugin.version} 237 | 238 | 239 | org.apache.maven.plugins 240 | maven-jxr-plugin 241 | ${maven-jxr-plugin.version} 242 | 243 | 244 | org.apache.maven.plugins 245 | maven-plugin-plugin 246 | ${maven-plugin-plugin.version} 247 | 248 | 249 | org.apache.maven.plugins 250 | maven-pmd-plugin 251 | ${maven-pmd-plugin.version} 252 | 253 | 254 | org.apache.maven.plugins 255 | maven-project-info-reports-plugin 256 | ${maven-project-info-reports-plugin.version} 257 | 258 | 259 | org.apache.maven.plugins 260 | maven-repository-plugin 261 | ${maven-repository-plugin.version} 262 | 263 | 264 | org.apache.maven.plugins 265 | maven-resources-plugin 266 | ${maven-resources-plugin.version} 267 | 268 | 269 | org.apache.maven.plugins 270 | maven-site-plugin 271 | ${maven-site-plugin.version} 272 | 273 | 274 | org.apache.maven.plugins 275 | maven-source-plugin 276 | ${maven-source-plugin.version} 277 | 278 | 279 | org.apache.maven.plugins 280 | maven-surefire-plugin 281 | ${maven-surefire-plugin.version} 282 | 283 | 284 | org.apache.maven.plugins 285 | maven-surefire-report-plugin 286 | ${maven-surefire-report-plugin.version} 287 | 288 | 289 | org.apache.maven.plugins 290 | maven-toolchains-plugin 291 | ${maven-toolchains-plugin.version} 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 3.0.4 300 | 301 | 302 | 303 | joda-time 304 | joda-time 305 | 1.6.2 306 | provided 307 | 308 | 309 | junit 310 | junit 311 | 4.13.1 312 | provided 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | org.apache.maven.plugins 321 | maven-project-info-reports-plugin 322 | ${maven-project-info-plugin.version} 323 | 324 | 325 | 326 | dependencies 327 | dependency-info 328 | issue-tracking 329 | license 330 | project-team 331 | scm 332 | summary 333 | 334 | 335 | 336 | 337 | 338 | org.apache.maven.plugins 339 | maven-javadoc-plugin 340 | ${maven-javadoc-plugin.version} 341 | 342 | 343 | 344 | javadoc 345 | 346 | 347 | 348 | 349 | 350 | http://www.joda.org/joda-time/apidocs/ 351 | 352 | 353 | 354 | 355 | org.apache.maven.plugins 356 | maven-surefire-report-plugin 357 | ${maven-surefire-report-plugin.version} 358 | 359 | true 360 | 361 | 362 | 363 | org.apache.maven.plugins 364 | maven-changes-plugin 365 | ${maven-changes-plugin.version} 366 | 367 | 368 | 369 | changes-report 370 | 371 | 372 | 373 | 374 | 375 | org.apache.maven.plugins 376 | maven-jxr-plugin 377 | ${maven-jxr-plugin.version} 378 | 379 | 380 | 381 | jxr 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | sonatype-joda-staging 393 | Sonatype OSS staging repository 394 | https://oss.sonatype.org/service/local/staging/deploy/maven2/ 395 | default 396 | 397 | 398 | false 399 | sonatype-joda-snapshot 400 | Sonatype OSS snapshot repository 401 | https://oss.sonatype.org/content/repositories/joda-snapshots 402 | default 403 | 404 | http://oss.sonatype.org/content/repositories/joda-releases 405 | 406 | 407 | 408 | 409 | 410 | repo-sign-artifacts 411 | 412 | 413 | oss.repo 414 | true 415 | 416 | 417 | 418 | 419 | 420 | org.apache.maven.plugins 421 | maven-toolchains-plugin 422 | 423 | 424 | validate 425 | 426 | toolchain 427 | 428 | 429 | 430 | 431 | 432 | 433 | 1.5 434 | sun 435 | 436 | 437 | 438 | 439 | 440 | org.apache.maven.plugins 441 | maven-gpg-plugin 442 | 443 | 444 | sign-artifacts 445 | verify 446 | 447 | sign 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 2.4 461 | 2.9 462 | 2.11 463 | 2.5 464 | 3.1 465 | 2.8.1 466 | 2.8 467 | 1.4 468 | 2.5.1 469 | 2.4 470 | 2.9.1 471 | 2.3 472 | 3.2 473 | 3.0.1 474 | 2.7 475 | 2.3.1 476 | 2.6 477 | 3.3 478 | 2.2.1 479 | 2.16 480 | 2.16 481 | 1.0 482 | 483 | 1.5 484 | 1.5 485 | 1.5 486 | true 487 | true 488 | true 489 | true 490 | lines,source 491 | 492 | false 493 | true 494 | 495 | ${project.basedir}/src/main/checkstyle/checkstyle.xml 496 | 497 | UTF-8 498 | UTF-8 499 | 500 | 501 | -------------------------------------------------------------------------------- /src/changes/changes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Java date and time API - I18N - Changes 6 | 7 | 8 | 9 | 10 | 11 | 12 | Home page at GitHub. 13 | 14 | 15 | Change to use m2e Maven Eclipse 16 | 17 | 18 | 19 | 20 | Release. 21 | 22 | 23 | Create initial version. 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/conf/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Package: org.joda.time 2 | Extension-Name: joda-time-i18n 3 | Specification-Title: Joda-Time I18N support 4 | Specification-Vendor: Joda.org 5 | Specification-Version: 0.1 6 | Implementation-Vendor: Joda.org 7 | Implementation-Title: org.joda.time.contrib.i18n 8 | Implementation-Version: 0.1 9 | Implementation-Vendor-Id: org.joda 10 | Bundle-ManifestVersion: 2 11 | Bundle-Vendor: Joda.org 12 | Bundle-Name: Joda-Time-I18N 13 | Bundle-SymbolicName: joda-time-i18n 14 | Bundle-Version: 0.1 15 | Import-Package: org.joda.time;version="1.5.0" 16 | Export-Package: org.joda.time.contrib.i18n;version=0.1 17 | Bundle-License: Apache 2.0 18 | Bundle-DocURL: http://www.joda.org/joda-time-i18n/ 19 | -------------------------------------------------------------------------------- /src/main/assembly/dist.xml: -------------------------------------------------------------------------------- 1 | 2 | dist 3 | 4 | tar.gz 5 | zip 6 | 7 | ${artifactId}-${version} 8 | 9 | 10 | 11 | checkstyle.xml 12 | LICENSE.txt 13 | NOTICE.txt 14 | pom.xml 15 | README.txt 16 | RELEASE-NOTES.txt 17 | 18 | 19 | 20 | src 21 | 22 | 23 | target 24 | 25 | 26 | *.jar 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/gen/org/joda/time/contrib/i18n/CLDRTerritoryGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2013 Stephen Colebourne 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.joda.time.contrib.i18n; 17 | 18 | import java.io.BufferedOutputStream; 19 | import java.io.File; 20 | import java.io.FileOutputStream; 21 | import java.io.IOException; 22 | import java.io.ObjectOutputStream; 23 | import java.util.ArrayList; 24 | import java.util.HashMap; 25 | import java.util.Iterator; 26 | import java.util.List; 27 | import java.util.Map; 28 | import java.util.Set; 29 | import java.util.StringTokenizer; 30 | 31 | import javax.xml.parsers.DocumentBuilder; 32 | import javax.xml.parsers.DocumentBuilderFactory; 33 | import javax.xml.parsers.ParserConfigurationException; 34 | 35 | import org.w3c.dom.Document; 36 | import org.w3c.dom.Element; 37 | import org.w3c.dom.NodeList; 38 | import org.xml.sax.SAXException; 39 | import org.xml.sax.SAXParseException; 40 | 41 | /** 42 | * Generates a file that stores the territory data. 43 | */ 44 | @SuppressWarnings({"rawtypes", "unchecked"}) 45 | public class CLDRTerritoryGenerator { 46 | 47 | Map firstDOWMap = new HashMap(); 48 | Map weekendStartMap = new HashMap(); 49 | Map weekendEndMap = new HashMap(); 50 | Map zoneMap = new HashMap(); 51 | 52 | //----------------------------------------------------------------------- 53 | /** 54 | * Output the CLDR data to a file. 55 | * 56 | * @param args 57 | */ 58 | public static void main(String[] args) { 59 | try { 60 | CLDRTerritoryGenerator gen = new CLDRTerritoryGenerator(); 61 | gen.readXML(); 62 | gen.writeFile(); 63 | 64 | } catch (RuntimeException ex) { 65 | System.err.println(); 66 | ex.printStackTrace(); 67 | } 68 | } 69 | 70 | //----------------------------------------------------------------------- 71 | /** 72 | * Writes the data to a file. 73 | */ 74 | private void writeFile() { 75 | File file = new File("src/java/org/joda/time/contrib/i18n/CLDRTerritoryData.dat"); 76 | ObjectOutputStream oos = null; 77 | try { 78 | oos = new ObjectOutputStream( 79 | new BufferedOutputStream(new FileOutputStream(file))); 80 | oos.writeByte(1); // version 81 | writeData(oos); 82 | oos.writeUTF(""); // end of file id 83 | oos.close(); 84 | 85 | } catch (IOException ex) { 86 | ex.printStackTrace(); 87 | if (oos != null) { 88 | try { 89 | oos.close(); 90 | } catch (IOException ex2) { 91 | // ignore 92 | } 93 | } 94 | } 95 | } 96 | 97 | //----------------------------------------------------------------------- 98 | /** 99 | * Writes the data to the stream. 100 | */ 101 | private void writeData(ObjectOutputStream oos) throws IOException { 102 | Set territories = zoneMap.keySet(); 103 | for (Iterator it = territories.iterator(); it.hasNext(); ) { 104 | String territory = (String) it.next(); 105 | if ("001".equals(territory)) { 106 | continue; 107 | } 108 | List zones = (List) zoneMap.get(territory); 109 | if (zones.size() > 1) { 110 | pickPrimaryZone(territory, zones); 111 | } 112 | Integer firstDay = (Integer) firstDOWMap.get(territory); 113 | if (firstDay == null) { 114 | firstDay = (Integer) firstDOWMap.get("001"); 115 | } 116 | Integer weekendStart = (Integer) weekendStartMap.get(territory); 117 | if (weekendStart == null) { 118 | weekendStart = (Integer) weekendStartMap.get("001"); 119 | } 120 | Integer weekendEnd = (Integer) weekendEndMap.get(territory); 121 | if (weekendEnd == null) { 122 | weekendEnd = (Integer) weekendEndMap.get("001"); 123 | } 124 | 125 | int weStart = weekendStart.intValue(); 126 | int weEnd = weekendEnd.intValue(); 127 | int busStart = (weEnd == 7 ? 1 : weEnd + 1); 128 | int busEnd = (weStart == 1 ? 7 : weStart - 1); 129 | 130 | oos.writeUTF(territory); 131 | oos.writeByte(zones.size()); 132 | for (int i = 0; i < zones.size(); i++) { 133 | oos.writeUTF((String) zones.get(i)); 134 | } 135 | oos.writeByte(firstDay.intValue()); 136 | oos.writeByte(busStart); 137 | oos.writeByte(busEnd); 138 | oos.writeByte(weStart); 139 | oos.writeByte(weEnd); 140 | System.out.print(territory + " "); 141 | } 142 | } 143 | 144 | //----------------------------------------------------------------------- 145 | /** 146 | * Reads the CLDR XML data. 147 | */ 148 | private void readXML() { 149 | File file = new File("src/gen/org/joda/time/contrib/i18n/supplementalData.xml"); 150 | try { 151 | DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 152 | DocumentBuilder builder = factory.newDocumentBuilder(); 153 | Document document = builder.parse(file); 154 | Element rootEl = (Element) document.getElementsByTagName("supplementalData").item(0); 155 | 156 | parseFirstDay(rootEl); 157 | parseWeekendStart(rootEl); 158 | parseWeekendEnd(rootEl); 159 | parseZoneFormatting(rootEl); 160 | 161 | } catch (SAXParseException ex) { 162 | ex.printStackTrace(); 163 | } catch (SAXException ex) { 164 | ex.printStackTrace(); 165 | } catch (IOException ex) { 166 | ex.printStackTrace(); 167 | } catch (ParserConfigurationException ex) { 168 | ex.printStackTrace(); 169 | } 170 | } 171 | 172 | //----------------------------------------------------------------------- 173 | /** 174 | * Parses the firstDay elements. 175 | * 176 | * @param rootEl the root element 177 | */ 178 | private void parseFirstDay(Element rootEl) { 179 | Element weekDataEl = (Element) rootEl.getElementsByTagName("weekData").item(0); 180 | NodeList els = weekDataEl.getElementsByTagName("firstDay"); 181 | for (int i = 0; i < els.getLength(); i++) { 182 | Element el = (Element) els.item(i); 183 | if ("true".equals(el.getAttribute("draft"))) { 184 | continue; 185 | } 186 | String dayStr = el.getAttribute("day"); 187 | Integer dow = convertDOW(dayStr); 188 | String territoriesStr = el.getAttribute("territories"); 189 | StringTokenizer tkn = new StringTokenizer(territoriesStr); 190 | while (tkn.hasMoreTokens()) { 191 | String territory = tkn.nextToken(); 192 | firstDOWMap.put(territory, dow); 193 | } 194 | } 195 | } 196 | 197 | //----------------------------------------------------------------------- 198 | /** 199 | * Parses the weekendStart elements. 200 | * 201 | * @param rootEl the root element 202 | */ 203 | private void parseWeekendStart(Element rootEl) { 204 | Element weekDataEl = (Element) rootEl.getElementsByTagName("weekData").item(0); 205 | NodeList els = weekDataEl.getElementsByTagName("weekendStart"); 206 | for (int i = 0; i < els.getLength(); i++) { 207 | Element el = (Element) els.item(i); 208 | if ("true".equals(el.getAttribute("draft"))) { 209 | continue; 210 | } 211 | String dayStr = el.getAttribute("day"); 212 | Integer dow = convertDOW(dayStr); 213 | String territoriesStr = el.getAttribute("territories"); 214 | StringTokenizer tkn = new StringTokenizer(territoriesStr); 215 | while (tkn.hasMoreTokens()) { 216 | String territory = tkn.nextToken(); 217 | weekendStartMap.put(territory, dow); 218 | } 219 | } 220 | // fix CLDR 221 | weekendStartMap.put("AF", new Integer(4)); 222 | weekendStartMap.put("IR", new Integer(4)); 223 | } 224 | 225 | //----------------------------------------------------------------------- 226 | /** 227 | * Parses the weekendEnd elements. 228 | * 229 | * @param rootEl the root element 230 | */ 231 | private void parseWeekendEnd(Element rootEl) { 232 | Element weekDataEl = (Element) rootEl.getElementsByTagName("weekData").item(0); 233 | NodeList els = weekDataEl.getElementsByTagName("weekendEnd"); 234 | for (int i = 0; i < els.getLength(); i++) { 235 | Element el = (Element) els.item(i); 236 | if ("true".equals(el.getAttribute("draft"))) { 237 | continue; 238 | } 239 | String dayStr = el.getAttribute("day"); 240 | Integer dow = convertDOW(dayStr); 241 | String territoriesStr = el.getAttribute("territories"); 242 | StringTokenizer tkn = new StringTokenizer(territoriesStr); 243 | while (tkn.hasMoreTokens()) { 244 | String territory = tkn.nextToken(); 245 | weekendEndMap.put(territory, dow); 246 | } 247 | } 248 | } 249 | 250 | //----------------------------------------------------------------------- 251 | /** 252 | * Parses the zoneFormatting element. 253 | * 254 | * @param rootEl the root element 255 | */ 256 | private void parseZoneFormatting(Element rootEl) { 257 | Element weekDataEl = (Element) rootEl.getElementsByTagName("zoneFormatting").item(0); 258 | NodeList els = weekDataEl.getElementsByTagName("zoneItem"); 259 | for (int i = 0; i < els.getLength(); i++) { 260 | Element el = (Element) els.item(i); 261 | if ("true".equals(el.getAttribute("draft"))) { 262 | continue; 263 | } 264 | String zoneStr = el.getAttribute("type"); 265 | String territory = el.getAttribute("territory"); 266 | List list = (List) zoneMap.get(territory); 267 | if (list == null) { 268 | list = new ArrayList(); 269 | zoneMap.put(territory, list); 270 | } 271 | list.add(zoneStr); 272 | } 273 | } 274 | 275 | //----------------------------------------------------------------------- 276 | /** 277 | * Converts a day string to a day of week value. 278 | * 279 | * @param dayStr the day string, such as 'sat' 280 | * @return the dow 281 | */ 282 | private Integer convertDOW(String dayStr) { 283 | Integer dowValue = (Integer) CLDR_DAYS.get(dayStr); 284 | if (dowValue == null) { 285 | throw new IllegalStateException("Unknown day of week: " + dayStr); 286 | } 287 | return dowValue; 288 | } 289 | 290 | /** The CLDR day of week values. */ 291 | private static final Map CLDR_DAYS = new HashMap(); 292 | static { 293 | CLDR_DAYS.put("mon", new Integer(1)); 294 | CLDR_DAYS.put("tue", new Integer(2)); 295 | CLDR_DAYS.put("wed", new Integer(3)); 296 | CLDR_DAYS.put("thu", new Integer(4)); 297 | CLDR_DAYS.put("fri", new Integer(5)); 298 | CLDR_DAYS.put("sat", new Integer(6)); 299 | CLDR_DAYS.put("sun", new Integer(7)); 300 | } 301 | 302 | //----------------------------------------------------------------------- 303 | /** 304 | * Picks the primary zone 305 | * @param zones the list of zones 306 | */ 307 | private void pickPrimaryZone(String territory, List zones) { 308 | String primary = (String) PRIMARY_ZONES.get(territory); 309 | if (primary == null) { 310 | throw new IllegalStateException("Unknown primary zone for territory: " + territory + ": " + zones); 311 | } 312 | if (zones.contains(primary) == false) { 313 | throw new IllegalStateException("Invalid primary zone for territory: " + territory + ": " + primary); 314 | } 315 | zones.remove(primary); 316 | zones.add(0, primary); 317 | } 318 | 319 | /** The primary zone selections. */ 320 | private static final Map PRIMARY_ZONES = new HashMap(); 321 | static { 322 | PRIMARY_ZONES.put("US", "America/New_York"); 323 | PRIMARY_ZONES.put("MN", "Asia/Ulaanbaatar"); 324 | PRIMARY_ZONES.put("CD", "Africa/Kinshasa"); 325 | PRIMARY_ZONES.put("EC", "America/Guayaquil"); 326 | PRIMARY_ZONES.put("KZ", "Asia/Almaty"); 327 | PRIMARY_ZONES.put("GL", "America/Godthab"); 328 | PRIMARY_ZONES.put("CN", "Asia/Shanghai"); 329 | PRIMARY_ZONES.put("UA", "Europe/Kiev"); 330 | PRIMARY_ZONES.put("CL", "America/Santiago"); 331 | PRIMARY_ZONES.put("ID", "Asia/Jakarta"); 332 | PRIMARY_ZONES.put("PT", "Europe/Lisbon"); 333 | PRIMARY_ZONES.put("PF", "Pacific/Tahiti"); 334 | PRIMARY_ZONES.put("SJ", "Arctic/Longyearbyen"); 335 | PRIMARY_ZONES.put("KI", "Pacific/Tarawa"); 336 | PRIMARY_ZONES.put("AQ", "Antarctica/McMurdo"); 337 | PRIMARY_ZONES.put("AU", "Australia/Sydney"); 338 | PRIMARY_ZONES.put("MH", "Pacific/Majuro"); 339 | PRIMARY_ZONES.put("UZ", "Asia/Tashkent"); 340 | PRIMARY_ZONES.put("RU", "Europe/Moscow"); 341 | PRIMARY_ZONES.put("MY", "Asia/Kuala_Lumpur"); 342 | PRIMARY_ZONES.put("MX", "America/Mexico_City"); 343 | PRIMARY_ZONES.put("BR", "America/Sao_Paulo"); 344 | PRIMARY_ZONES.put("ES", "Europe/Madrid"); 345 | PRIMARY_ZONES.put("UM", "Pacific/Midway"); 346 | PRIMARY_ZONES.put("CA", "America/Toronto"); 347 | PRIMARY_ZONES.put("FM", "Pacific/Ponape"); 348 | PRIMARY_ZONES.put("AR", "America/Buenos_Aires"); 349 | PRIMARY_ZONES.put("NZ", "Pacific/Auckland"); 350 | } 351 | 352 | } 353 | -------------------------------------------------------------------------------- /src/main/gen/org/joda/time/contrib/i18n/supplementalData.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1020 | 1029 | 1030 | 1036 | 1037 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1242 | 1243 | 1244 | 1245 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | 1273 | 1274 | 1275 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 1282 | 1283 | 1284 | 1285 | 1286 | 1287 | 1288 | 1289 | 1290 | 1291 | 1292 | 1293 | 1294 | 1295 | 1296 | 1297 | 1298 | 1299 | 1300 | 1301 | 1302 | 1303 | 1304 | 1305 | 1306 | 1307 | 1308 | 1309 | 1310 | 1311 | 1312 | 1313 | 1314 | 1315 | 1316 | 1317 | 1318 | 1319 | 1320 | 1321 | 1322 | 1323 | 1324 | 1325 | 1326 | 1327 | 1328 | 1329 | 1330 | 1331 | 1332 | 1333 | 1334 | 1335 | 1336 | 1337 | 1338 | 1339 | 1340 | 1341 | 1342 | 1343 | 1344 | 1345 | 1346 | 1347 | 1348 | 1349 | 1350 | 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | 1358 | 1359 | 1360 | 1361 | 1362 | 1363 | 1364 | 1365 | 1366 | 1367 | 1368 | 1369 | 1370 | 1371 | 1372 | 1373 | 1374 | 1375 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | 1385 | 1386 | 1387 | 1388 | 1389 | 1390 | 1391 | 1392 | 1393 | 1394 | 1395 | 1396 | 1397 | 1398 | 1399 | 1400 | 1401 | 1402 | 1403 | 1404 | 1405 | 1406 | 1407 | 1408 | 1409 | 1410 | 1411 | 1412 | 1413 | 1414 | 1415 | 1416 | 1417 | 1418 | 1419 | 1420 | 1421 | 1422 | 1423 | 1424 | 1425 | 1426 | 1427 | 1428 | 1429 | 1430 | 1431 | 1432 | 1433 | 1434 | 1435 | 1436 | 1437 | 1438 | 1439 | 1440 | 1441 | 1442 | 1443 | 1444 | 1445 | 1446 | 1447 | 1448 | 1449 | 1450 | 1451 | 1452 | 1453 | 1454 | 1455 | 1456 | 1457 | 1458 | 1459 | 1460 | 1461 | 1462 | 1463 | 1464 | 1465 | 1466 | 1467 | 1468 | 1469 | 1470 | 1471 | 1472 | 1473 | 1474 | 1475 | 1476 | 1477 | 1478 | 1479 | 1480 | 1481 | 1482 | 1483 | 1484 | 1485 | 1486 | 1487 | 1488 | 1489 | 1490 | 1491 | 1492 | 1493 | 1494 | 1495 | 1496 | 1497 | 1498 | 1499 | 1500 | 1501 | 1502 | 1503 | 1504 | 1505 | 1506 | 1507 | 1508 | 1509 | 1510 | 1511 | 1512 | 1513 | 1514 | 1515 | 1516 | 1517 | 1518 | 1519 | 1520 | 1521 | 1522 | 1523 | 1524 | 1525 | 1526 | 1527 | 1528 | 1529 | 1530 | 1531 | 1532 | 1533 | 1534 | 1535 | 1536 | 1537 | 1538 | 1539 | 1540 | 1541 | 1542 | 1543 | 1544 | 1545 | 1546 | 1547 | 1548 | 1549 | 1550 | 1551 | 1552 | 1553 | 1554 | 1555 | 1556 | 1557 | 1558 | 1559 | 1560 | 1561 | 1562 | 1563 | 1564 | 1565 | 1566 | 1567 | 1568 | 1569 | 1570 | 1571 | 1572 | 1573 | 1574 | 1575 | 1576 | 1577 | 1578 | 1579 | 1580 | 1581 | 1582 | 1583 | 1584 | 1585 | 1586 | 1587 | 1588 | 1589 | 1590 | 1591 | 1592 | 1593 | 1594 | 1595 | 1596 | 1597 | 1598 | 1599 | 1600 | 1601 | 1602 | 1603 | 1604 | 1605 | 1606 | 1607 | 1608 | 1609 | 1610 | 1611 | 1612 | 1613 | 1614 | 1615 | 1616 | 1617 | 1618 | 1619 | 1620 | 1621 | 1622 | 1623 | 1624 | 1625 | 1626 | 1627 | 1628 | 1629 | 1630 | 1631 | 1632 | 1633 | 1634 | 1635 | 1636 | 1637 | 1638 | 1639 | 1640 | 1641 | 1642 | 1643 | 1644 | 1645 | 1646 | 1647 | 1648 | 1649 | 1650 | 1651 | 1652 | 1653 | 1654 | 1655 | 1656 | 1657 | 1658 | 1659 | 1660 | 1661 | 1662 | 1663 | 1664 | 1665 | 1666 | 1667 | 1668 | 1669 | 1670 | 1671 | 1672 | 1673 | 1674 | 1675 | 1676 | 1677 | 1678 | 1679 | 1680 | 1681 | 1682 | 1683 | 1684 | 1685 | 1686 | 1687 | 1688 | 1689 | 1690 | 1691 | 1692 | 1693 | 1694 | 1695 | 1696 | 1697 | 1698 | 1699 | 1700 | 1701 | 1702 | 1703 | 1704 | 1705 | 1706 | 1707 | 1708 | 1709 | 1710 | 1711 | 1712 | 1713 | 1714 | 1715 | 1716 | 1717 | 1718 | 1719 | 1720 | 1721 | 1722 | 1723 | 1724 | 1725 | 1726 | 1727 | 1728 | 1729 | 1730 | 1731 | 1732 | 1733 | 1734 | 1735 | 1736 | 1737 | 1738 | 1739 | 1740 | 1741 | 1742 | 1743 | 1744 | 1745 | 1746 | 1747 | 1748 | 1749 | 1750 | 1751 | 1752 | 1753 | 1754 | 1755 | 1756 | 1757 | 1758 | 1759 | 1760 | 1761 | 1762 | 1763 | 1764 | 1765 | 1766 | 1767 | 1768 | 1769 | 1770 | 1771 | 1772 | 1773 | 1774 | 1775 | 1776 | 1777 | 1778 | 1779 | 1780 | 1781 | 1782 | 1783 | 1784 | 1785 | 1786 | 1787 | 1788 | 1789 | 1790 | 1791 | 1792 | 1793 | 1794 | 1795 | 1796 | 1797 | 1798 | 1799 | 1800 | 1801 | 1802 | 1803 | 1804 | 1805 | 1806 | 1807 | 1808 | 1809 | 1810 | 1811 | 1812 | 1813 | 1814 | 1815 | 1816 | 1817 | 1818 | 1819 | 1820 | 1821 | 1822 | 1823 | 1824 | 1825 | 1826 | 1827 | 1828 | 1829 | 1830 | 1831 | 1832 | 1833 | 1834 | 1835 | 1836 | 1837 | 1838 | 1839 | 1840 | 1841 | 1842 | 1843 | 1844 | 1845 | 1846 | 1847 | 1848 | -------------------------------------------------------------------------------- /src/main/java/org/joda/time/contrib/i18n/CLDRTerritory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Stephen Colebourne 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.joda.time.contrib.i18n; 17 | 18 | import java.io.BufferedInputStream; 19 | import java.io.ByteArrayInputStream; 20 | import java.io.ByteArrayOutputStream; 21 | import java.io.IOException; 22 | import java.io.InputStream; 23 | import java.io.ObjectInputStream; 24 | 25 | import org.joda.time.DateTimeZone; 26 | 27 | /** 28 | * Provides time data for a specific territory, typically a country. 29 | *

30 | * Many pieces of data used in dates and times varies by territory. 31 | * This class provides access to that data. 32 | */ 33 | public class CLDRTerritory extends Territory { 34 | 35 | /** The raw CLDR data. */ 36 | private static final byte[] cRawData = loadRawData(); 37 | 38 | /** The territory id, as per CLDR. */ 39 | private String iID; 40 | /** The zones. */ 41 | private DateTimeZone[] iZones; 42 | /** The first day of week. */ 43 | private int iFirstDOW; 44 | /** The first day of the business week. */ 45 | private int iFirstBusinessDOW; 46 | /** The last day of the business week. */ 47 | private int iLastBusinessDOW; 48 | /** The first day of the weekend. */ 49 | private int iFirstWeekendDOW; 50 | /** The last day of the weekend. */ 51 | private int iLastWeekendDOW; 52 | 53 | //----------------------------------------------------------------------- 54 | /** 55 | * Loads the data from file. 56 | * 57 | * @return the array of bytes 58 | */ 59 | private static byte[] loadRawData() { 60 | String path = "org/joda/time/contrib/i18n/CLDRTerritoryData.dat"; 61 | InputStream baseStream = null; 62 | ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); 63 | try { 64 | // open the file 65 | baseStream = CLDRTerritory.class.getClassLoader().getResourceAsStream(path); 66 | if (baseStream == null) { 67 | throw new IOException("Resource not found " + path); 68 | } 69 | byte[] bytes = new byte[1024]; 70 | int result = 0; 71 | while (result != -1) { 72 | baos.write(bytes, 0, result); 73 | result = baseStream.read(bytes, 0, 1024); 74 | } 75 | return baos.toByteArray(); 76 | 77 | } catch (IOException ex) { 78 | throw new IllegalArgumentException("Territory data could not be loaded: " + ex.getMessage()); 79 | } finally { 80 | if (baseStream != null) { 81 | try { 82 | baseStream.close(); 83 | } catch (IOException ex) { 84 | // ignore 85 | } 86 | } 87 | } 88 | } 89 | 90 | //----------------------------------------------------------------------- 91 | /** 92 | * Constructor. 93 | * 94 | * @param id the territory id, not null 95 | */ 96 | CLDRTerritory(String id) { 97 | super(); 98 | init(id); 99 | } 100 | 101 | //----------------------------------------------------------------------- 102 | /** 103 | * Initialises the data for this id. 104 | * 105 | * @param id the territory id, not null 106 | * @throws IOException if an error occurs 107 | */ 108 | private void init(String id) { 109 | try { 110 | // open the file 111 | ByteArrayInputStream bais = new ByteArrayInputStream(cRawData); 112 | ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bais)); 113 | byte version = in.readByte(); 114 | if (version != 1) { 115 | throw new IllegalArgumentException("Unknown file version: " + version); 116 | } 117 | 118 | // loop through file to find the id 119 | String inputId = in.readUTF(); 120 | while (inputId.equals(id) == false) { 121 | byte zoneCount = in.readByte(); 122 | for (int i = 0; i < zoneCount; i++) { 123 | in.readUTF(); 124 | } 125 | in.skip(5); 126 | inputId = in.readUTF(); 127 | if (inputId.length() == 0) { 128 | throw new IllegalArgumentException("Territory " + id + " could not be loaded"); 129 | } 130 | } 131 | 132 | // found matching id 133 | iID = id; 134 | byte zoneCount = in.readByte(); 135 | iZones = new DateTimeZone[zoneCount]; 136 | for (int i = 0; i < zoneCount; i++) { 137 | String zoneID = in.readUTF(); 138 | try { 139 | iZones[i] = DateTimeZone.forID(zoneID); 140 | } catch (IllegalArgumentException ex) { 141 | // ignore unless primary, allowing different timezone data files to work 142 | if (i == 0) { 143 | throw ex; 144 | } 145 | } 146 | } 147 | iFirstDOW = in.readByte(); 148 | iFirstBusinessDOW = in.readByte(); 149 | iLastBusinessDOW = in.readByte(); 150 | iFirstWeekendDOW = in.readByte(); 151 | iLastWeekendDOW = in.readByte(); 152 | 153 | } catch (IOException ex) { 154 | throw new IllegalArgumentException("Territory " + id + " could not be loaded: " + ex.getMessage()); 155 | } 156 | } 157 | 158 | //----------------------------------------------------------------------- 159 | public String getID() { 160 | return iID; 161 | } 162 | 163 | //----------------------------------------------------------------------- 164 | public DateTimeZone[] getZones() { 165 | return (DateTimeZone[]) iZones.clone(); 166 | } 167 | 168 | public int getFirstDayOfWeek() { 169 | return iFirstDOW; 170 | } 171 | 172 | public int getBusinessWeekStart() { 173 | return iFirstBusinessDOW; 174 | } 175 | 176 | public int getBusinessWeekEnd() { 177 | return iLastBusinessDOW; 178 | } 179 | 180 | public int getWeekendStart() { 181 | return iFirstWeekendDOW; 182 | } 183 | 184 | public int getWeekendEnd() { 185 | return iLastWeekendDOW; 186 | } 187 | 188 | } 189 | -------------------------------------------------------------------------------- /src/main/java/org/joda/time/contrib/i18n/CLDRTerritoryData.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JodaOrg/joda-time-i18n/f28884a2174ddde6060369e04441c504eb791e91/src/main/java/org/joda/time/contrib/i18n/CLDRTerritoryData.dat -------------------------------------------------------------------------------- /src/main/java/org/joda/time/contrib/i18n/Territory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2013 Stephen Colebourne 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.joda.time.contrib.i18n; 17 | 18 | import java.util.Collections; 19 | import java.util.HashMap; 20 | import java.util.Map; 21 | 22 | import org.joda.time.DateTimeZone; 23 | 24 | /** 25 | * Provides time data for a specific territory, typically a country. 26 | *

27 | * Many pieces of data used in dates and times varies by territory. 28 | * This class provides access to that data. 29 | */ 30 | @SuppressWarnings({"unchecked", "rawtypes"}) 31 | public abstract class Territory { 32 | 33 | // /** An empty chronology array. */ 34 | // private static final Chronology[] EMPTY_CHRONOLOGY_ARRAY = new Chronology[0]; 35 | /** A cache of territories. */ 36 | private static final Map cTerritoryMap = Collections.synchronizedMap(new HashMap()); 37 | 38 | //----------------------------------------------------------------------- 39 | /** 40 | * Gets a territory instance for the specified id. 41 | *

42 | * The territory id must be one of those returned by getAvailableIDs. 43 | * 44 | * @param id the ID of the territory, not null 45 | * @return the territory object for the ID 46 | * @throws IllegalArgumentException if the ID is not recognised 47 | */ 48 | public static Territory forID(String id) { 49 | if (id != null && id.length() == 2) { 50 | Territory t = (Territory) cTerritoryMap.get(id); 51 | if (t == null) { 52 | t = new CLDRTerritory(id); 53 | cTerritoryMap.put(id, t); 54 | } 55 | return t; 56 | } 57 | throw new IllegalArgumentException("The territory id is not recognised: " + id); 58 | } 59 | 60 | //----------------------------------------------------------------------- 61 | /** 62 | * Constructor. 63 | * 64 | * @param id the territory id, not null 65 | */ 66 | protected Territory() { 67 | super(); 68 | } 69 | 70 | //----------------------------------------------------------------------- 71 | /** 72 | * Gets the territory id. 73 | * 74 | * @return the territory id, never null 75 | */ 76 | public abstract String getID(); 77 | 78 | //----------------------------------------------------------------------- 79 | /** 80 | * Gets the time zones applicable for the territory. 81 | * 82 | * @return the array of zones, never null 83 | */ 84 | public abstract DateTimeZone[] getZones(); 85 | 86 | /** 87 | * Gets the time zone for the territory, selecting the zone of the most 88 | * important city (the capital) if there are multiple zones. 89 | * 90 | * @return the zone that best represents the territory, null if unknown 91 | */ 92 | public DateTimeZone getZone() { 93 | DateTimeZone[] zones = getZones(); 94 | if (zones.length == 0) { 95 | return null; 96 | } 97 | return zones[0]; 98 | } 99 | 100 | // //----------------------------------------------------------------------- 101 | // /** 102 | // * Gets the altenate non-ISO chronologies used in the territory. 103 | // * For example, countries in the middle east would include 104 | // * IslamicChronology in the result. 105 | // * 106 | // * @return the non-ISO chronologies, empty array if none 107 | // */ 108 | // public Chronology[] getChronologies() { 109 | // return EMPTY_CHRONOLOGY_ARRAY; 110 | // } 111 | 112 | //----------------------------------------------------------------------- 113 | /** 114 | * Gets the first day of the week. 115 | * The value is expressed using ISO values (1=Mon,7=Sun). 116 | * 117 | * @return the first day of the week 118 | */ 119 | public abstract int getFirstDayOfWeek(); 120 | 121 | /** 122 | * Gets the day of week that the business week starts. 123 | * The value is expressed using ISO values (1=Mon,7=Sun). 124 | * 125 | * @return the day of week that the business week starts 126 | */ 127 | public abstract int getBusinessWeekStart(); 128 | 129 | /** 130 | * Gets the day of week that the business week ends. 131 | * The value is expressed using ISO values (1=Mon,7=Sun). 132 | * 133 | * @return the day of week that the business week ends 134 | */ 135 | public abstract int getBusinessWeekEnd(); 136 | 137 | /** 138 | * Gets the day of week that the weekend starts. 139 | * The value is expressed using ISO values (1=Mon,7=Sun). 140 | * 141 | * @return the day of week that the weekend starts 142 | */ 143 | public abstract int getWeekendStart(); 144 | 145 | /** 146 | * Gets the day of week that the weekend ends. 147 | * The value is expressed using ISO values (1=Mon,7=Sun). 148 | * 149 | * @return the day of week that the weekend ends 150 | */ 151 | public abstract int getWeekendEnd(); 152 | 153 | //----------------------------------------------------------------------- 154 | /** 155 | * Is this territory equal (by id and class) to another. 156 | * 157 | * @param other the other object to compare to 158 | * @return trur if equal 159 | */ 160 | public boolean equals(Object other) { 161 | if (other == this) { 162 | return true; 163 | } 164 | if (other.getClass() != getClass()) { 165 | return false; 166 | } 167 | return ((Territory) other).getID().equals(getID()); 168 | } 169 | 170 | /** 171 | * Gets a suitable hashcode for this territory. 172 | * 173 | * @return a hashcode 174 | */ 175 | public int hashCode() { 176 | return 19 * getClass().hashCode() + getID().hashCode(); 177 | } 178 | 179 | /** 180 | * Outputs a string vesion of the territory. 181 | * 182 | * @return string 183 | */ 184 | public String toString() { 185 | return "Territory[" + getID() + "]"; 186 | } 187 | 188 | } 189 | -------------------------------------------------------------------------------- /src/site/resources/css/site.css: -------------------------------------------------------------------------------- 1 | body, td, select, input, li{ 2 | font-family: Helvetica, Arial, sans-serif; 3 | font-size: 13px; 4 | background-color: #fff; 5 | } 6 | a { 7 | text-decoration: none; 8 | } 9 | a:link { 10 | color:#009; 11 | } 12 | a:visited { 13 | color:#009; 14 | } 15 | a:active, a:hover { 16 | text-decoration: underline; 17 | } 18 | a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover { 19 | background: url(../images/external.png) right center no-repeat; 20 | padding-right: 15px; 21 | } 22 | a.newWindow, a.newWindow:link, a.newWindow:visited, a.newWindow:active, a.newWindow:hover { 23 | background: url(../images/newwindow.png) right center no-repeat; 24 | padding-right: 18px; 25 | } 26 | h2 { 27 | font-family: Verdana, Helvetica, Arial, sans-serif; 28 | padding: 4px 4px 4px 6px; 29 | border: 1px solid #999; 30 | color: #006; 31 | background-color: #eef; 32 | font-weight:bold; 33 | font-size: 16px; 34 | margin-top: 4px; 35 | margin-bottom: 6px; 36 | } 37 | h3 { 38 | padding: 4px 4px 4px 6px; 39 | border: 1px solid #aaa; 40 | color: #006; 41 | background-color: #eee; 42 | font-weight: normal; 43 | font-size: 14px; 44 | margin-top: 4px; 45 | margin-bottom: 6px; 46 | } 47 | p, ul { 48 | font-size: 13px; 49 | margin-top: 4px; 50 | margin-bottom: 6px; 51 | } 52 | #banner { 53 | background-color: #eef; 54 | border-bottom: 1px solid #aaa; 55 | padding: 8px; 56 | } 57 | #bannerLeft, #bannerRight { 58 | font-size: 30px; 59 | color:black; 60 | padding: 0px 5px; 61 | } 62 | #banner a:hover { 63 | text-decoration:none; 64 | } 65 | #breadcrumbs { 66 | padding-top: 1px; 67 | padding-bottom: 2px; 68 | border-bottom: 1px solid #aaa; 69 | background-color: #ddf; 70 | } 71 | #leftColumn { 72 | margin: 8px 0 8px 4px; 73 | border: 1px solid #999; 74 | background-color: #eef; 75 | } 76 | #navcolumn { 77 | padding: 6px 4px 0 6px; 78 | } 79 | #navcolumn h5 { 80 | font-size: 12px; 81 | border-bottom: 1px solid #aaaaaa; 82 | padding-top: 2px; 83 | font-weight: normal; 84 | } 85 | #navcolumn li { 86 | font-size: 12px; 87 | padding-left: 12px; 88 | background-color: #eef; 89 | } 90 | #navcolumn a:active, #navcolumn a:hover { 91 | text-decoration: none; 92 | } 93 | #lastPublished { 94 | font-size: 10px; 95 | } 96 | table.bodyTable th { 97 | color: white; 98 | background-color: #bbb; 99 | text-align: left; 100 | font-weight: bold; 101 | font-size: 13px; 102 | } 103 | 104 | table.bodyTable th, table.bodyTable td { 105 | font-size: 13px; 106 | } 107 | 108 | table.bodyTable tr.a { 109 | background-color: #ddd; 110 | } 111 | 112 | table.bodyTable tr.b { 113 | background-color: #eee; 114 | } 115 | 116 | .source { 117 | border: 1px solid #999; 118 | padding: 8px; 119 | margin: 6px; 120 | } 121 | #footer { 122 | background-color: #eef; 123 | border-top: 1px solid #999; 124 | } 125 | body { 126 | padding-bottom: 0px; 127 | } 128 | -------------------------------------------------------------------------------- /src/site/resources/download.html: -------------------------------------------------------------------------------- 1 | 2 | OpenGamma 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Joda.org 6 | http://www.joda.org/ 7 | 8 | 9 | Joda-Time-I18N 10 | http://www.joda.org/joda-time-i18n/ 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |

22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 51 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/site/xdoc/index.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Java date and time API - I18N support - Home 7 | Stephen Colebourne 8 | 9 | 10 | 11 | 12 |
13 |

14 | Joda-Time provides a complete quality alternative 15 | to the JDK date and time classes. 16 | Many aspects of date and time require internationalized data. 17 | This project provides access to additional I18N data not supplied as part of the 18 | standard Joda-Time release. 19 |

20 |
    21 |
  • Time zones by territory
  • 22 |
  • First day of week by territory
  • 23 |
  • Business week by territory
  • 24 |
  • Weekend by territory
  • 25 |
26 |

27 | As a flavour of the functionality, here's how to find out what days are the weekend in Egypt: 28 | 29 | Territory t = Territory.forID("EG"); 30 | int weekendStartDay = t.getWeekendStart(); 31 | int weekendEndDay = t.getWeekendEnd(); 32 | 33 | Version 0.1 was released on 2006-08-21 - 34 | Download now 35 |

36 |

37 | Joda-Time-I18N is licensed under the business-friendly Apache 2.0 licence. 38 |

39 |
40 | 41 | 42 |
43 |

44 | Various documentation is available: 45 |

50 |

51 |
52 | 53 | 54 |
55 |

56 | Release 0.1 57 | is the current latest release. 58 | This release is a beta release and may have bugs. 59 | The API is liable to change without deprecation until version 1.0 is released. 60 | Please bear in mind that this project is separate from Joda-Time itself. 61 |

62 |

63 | The dependencies are Joda-Time 1.0 or later. 64 | We recommend JDK 1.4 or later, and have performed no testing on earlier JDKs. 65 |

66 |
67 | 68 | 69 |
70 |

71 | Support on bugs, library usage or enhancement requests is available on a best efforts basis. 72 |

73 |

74 | To suggest enhancements or contribute, please fork the source code on GitHub. 75 | Alternatively, use GitHub issues. 76 |

77 |

78 |
79 |

80 |

81 |
82 |

83 |

84 |
85 |

86 |
87 | 88 |
89 | -------------------------------------------------------------------------------- /src/site/xdoc/licensecover.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Java date and time API - I18N support - License 6 | Stephen Colebourne 7 | 8 | 9 | 10 | 11 |
12 |

13 | Joda-Time source code is released under the business-friendly 14 | Apache 2.0 license. 15 | This is the same license as Ant, 16 | Spring, 17 | Tomcat and 18 | Jakarta. 19 |

20 |

21 | As is normal with the Apache 2.0 license, a 22 | NOTICE file is used to express Joda-Time specifics: 23 | 24 | ============================================================================= 25 | = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = 26 | ============================================================================= 27 | This product includes software developed by 28 | Joda.org (http://www.joda.org/). 29 | 30 |

31 |
32 | 33 | 34 |
35 | -------------------------------------------------------------------------------- /src/test/java/org/joda/time/contrib/i18n/TestTerritory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Stephen Colebourne 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.joda.time.contrib.i18n; 17 | 18 | import junit.framework.TestCase; 19 | 20 | /** 21 | * Test Territory. 22 | */ 23 | public class TestTerritory extends TestCase { 24 | 25 | //----------------------------------------------------------------------- 26 | public void testGB() { 27 | Territory t = Territory.forID("GB"); 28 | assertEquals("GB", t.getID()); 29 | assertEquals(1, t.getZones().length); 30 | assertEquals("Europe/London", t.getZones()[0].getID()); 31 | assertEquals("Europe/London", t.getZone().getID()); 32 | assertEquals(1, t.getFirstDayOfWeek()); 33 | assertEquals(1, t.getBusinessWeekStart()); 34 | assertEquals(5, t.getBusinessWeekEnd()); 35 | assertEquals(6, t.getWeekendStart()); 36 | assertEquals(7, t.getWeekendEnd()); 37 | } 38 | 39 | } 40 | --------------------------------------------------------------------------------