]>
Commit | Line | Data |
---|---|---|
4f5b44bd NL |
1 | Contributing to the Intl component |
2 | ================================== | |
3 | ||
4 | A very good way of contributing to the Intl component is by updating the | |
5 | included data for the ICU version you have installed on your system. | |
6 | ||
7 | Preparation | |
8 | ----------- | |
9 | ||
10 | To prepare, you need to install the development dependencies of the component. | |
11 | ||
12 | $ cd /path/to/Symfony/Component/Intl | |
13 | $ composer.phar install --dev | |
14 | ||
15 | Determining your ICU version | |
16 | --------------------------- | |
17 | ||
18 | The ICU version installed in your PHP environment can be found by running | |
19 | icu-version.php: | |
20 | ||
21 | $ php Resources/bin/icu-version.php | |
22 | ||
23 | Updating the ICU data | |
24 | --------------------- | |
25 | ||
26 | To update the data files, run the update-icu-component.php script: | |
27 | ||
28 | $ php Resources/bin/update-icu-component.php | |
29 | ||
30 | The script needs the binaries "svn" and "make" to be available on your system. | |
31 | It will download the latest version of the ICU sources for the ICU version | |
32 | installed in your PHP environment. The script will then compile the "genrb" | |
33 | binary and use it to compile the ICU data files to binaries. The binaries are | |
34 | copied to the Resources/ directory of the Icu component found in the | |
35 | vendor/symfony/icu/ directory. | |
36 | ||
37 | Updating the stub data | |
38 | ---------------------- | |
39 | ||
40 | In the previous step you updated the Icu component for the ICU version | |
41 | installed on your system. If you are using the latest ICU version, you should | |
42 | also create the stub data files which will be used by people who don't have | |
43 | the intl extension installed. | |
44 | ||
45 | To update the stub files, run the update-stubs.php script: | |
46 | ||
47 | $ php Resources/bin/update-stubs.php | |
48 | ||
49 | The script will fail if you don't have the latest ICU version. If you want to | |
50 | upgrade the ICU version, adjust the return value of the | |
51 | `Intl::getIcuStubVersion()` before you run the script. | |
52 | ||
53 | The script creates copies of the binary resource bundles in the Icu component | |
54 | and stores them in the Resources/ directory of the Intl component. The copies | |
55 | are made for the locale "en" only and are stored in .php files, so that they | |
56 | can be read even if the intl extension is not available. | |
57 | ||
58 | Creating a pull request | |
59 | ----------------------- | |
60 | ||
61 | You need to create up to two pull requests: | |
62 | ||
63 | * If you updated the Icu component, you need to push that change and create a | |
64 | pull request in the `symfony/Icu` repository. Make sure to submit the pull | |
65 | request to the correct master branch. If you updated the ICU data for version | |
66 | 4.8, your pull request goes to branch `48-master`, for version 49 to | |
67 | `49-master` and so on. | |
68 | ||
69 | * If you updated the stub files of the Intl component, you need to push that | |
70 | change and create a pull request in the `symfony/symfony` repository. The | |
71 | pull request should be based on the `master` branch. | |
72 | ||
73 | Combining .res files to a .dat-package | |
74 | -------------------------------------- | |
75 | ||
76 | The individual *.res files can be combined into a single .dat-file. | |
77 | Unfortunately, PHP's `ResourceBundle` class is currently not able to handle | |
78 | .dat-files. | |
79 | ||
80 | Once it is, the following steps have to be followed to build the .dat-file: | |
81 | ||
82 | 1. Package the resource bundles into a single file | |
83 | ||
84 | $ find . -name *.res | sed -e "s/\.\///g" > packagelist.txt | |
85 | $ pkgdata -p region -T build -d . packagelist.txt | |
86 | ||
87 | 2. Clean up | |
88 | ||
89 | $ rm -rf build packagelist.txt | |
90 | ||
91 | 3. You can now move region.dat to replace the version bundled with Symfony2. |