Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: README.md

Issue 29317015: Issue 2625 - [cms] Crowdin synchronisation script (Closed)
Patch Set: Addressed Wladimir's feedback Created July 2, 2015, 12:29 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cms/bin/translate.py » ('j') | cms/bin/translate.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # CMS # 1 # CMS #
2 2
3 We use this CMS for [adblockplus.org](https://github.com/adblockplus/web.adblock plus.org/) 3 We use this CMS for [adblockplus.org](https://github.com/adblockplus/web.adblock plus.org/)
4 and related websites. It converts a directory with content data into static 4 and related websites. It converts a directory with content data into static
5 files. You are free to use it for other projects but please keep in mind that we 5 files. You are free to use it for other projects but please keep in mind that we
6 make no stability guarantees whatsoever and might change functionality any time. 6 make no stability guarantees whatsoever and might change functionality any time.
7 7
8 ## How to use ## 8 ## How to use ##
9 9
10 ### Running the test server ### 10 ### Running the test server ###
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 [downloaded as ZIP file](https://github.com/adblockplus/cms/archive/master.zip ) 66 [downloaded as ZIP file](https://github.com/adblockplus/cms/archive/master.zip )
67 or cloned via `git clone https://github.com/adblockplus/cms.git`) 67 or cloned via `git clone https://github.com/adblockplus/cms.git`)
68 68
69 Run the following command from the directory of the `cms` repository: 69 Run the following command from the directory of the `cms` repository:
70 70
71 python -m cms.bin.generate_static_pages www_directory target_directory 71 python -m cms.bin.generate_static_pages www_directory target_directory
72 72
73 Here `www_directory` should be replaced by the path to your content directory. 73 Here `www_directory` should be replaced by the path to your content directory.
74 `target_directory` is the path where static files will be placed.. 74 `target_directory` is the path where static files will be placed..
75 75
76 ### Syncing translations ###
77
78 Before syncing translations ensure the following:
79
80 - The `crowdin-project-name` setting has been set in the site's configuration.
81 - The [requests](http://docs.python-requests.org/en/latest/) Python module is
82 installed.
83
84 Now to sync with Crowdin type the following:
85
86 python -m cms.bin.translate www_directory crowdin_project_api_key [logging_l evel]
87
88 The script might take a while to run, it does the following things:
89
90 1. Requests information about your Crowdin project
91 2. Checks all local locales are supported by Crowdin and enabled for your projec t
92 3. Renders all pages in your default language and extracts all page strings
93 4. Creates any required directories in your Crowdin project
94 5. Uploads any new page strings and updates any existing page strings
95 6. Uploads any pre-existing translation files for any newly uploaded pages
96 7. Requests Crowdin generate a fresh translations export archive
97 8. Downloads the archive of translations and extracts it replacing all local
98 translation files
99
100 Notes:
101
102 - You have to use the Crowdin project's API key, not your account API key
103 - You should probably enable "Skip untranslated strings" under your
104 project settings.
105 - Translations are only _uploaded_ for new files. If you are syncing with
106 Crowdin for the first time, and you have existing translation files pay
107 attention to any warnings. If there are any problems it is recommended
108 you re-create another fresh Crowdin project and try again. (Otherwise
109 translations for the pages already uploaded could be lost!)
110 - If you are running the script from a cronjob or similar you will probably
111 want to set the logging level to `ERROR` or similar
112
76 ## Content structure ## 113 ## Content structure ##
77 114
78 Currently, the following directories of your content directory will be 115 Currently, the following directories of your content directory will be
79 considered: 116 considered:
80 117
81 * `filters`: Custom Jinja2 filters 118 * `filters`: Custom Jinja2 filters
82 * `globals`: Custom Jinja2 global functions and variables 119 * `globals`: Custom Jinja2 global functions and variables
83 * `includes`: Various include files 120 * `includes`: Various include files
84 * `locales`: Localization files 121 * `locales`: Localization files
85 * `pages`: User-visible pages 122 * `pages`: User-visible pages
86 * `static`: Static content 123 * `static`: Static content
87 * `templates`: Page layout templates 124 * `templates`: Page layout templates
88 125
89 There should also be a `settings.ini` file with configuration. 126 There should also be a `settings.ini` file with configuration.
90 127
91 All of these are explained in more detail below. 128 All of these are explained in more detail below.
92 129
93 ### Configuration (settings.ini) ### 130 ### Configuration (settings.ini) ###
94 131
95 The following sections can be defined in `settings.ini`: 132 The following sections can be defined in `settings.ini`:
96 133
97 * `[general]`: following settings should be listed here: 134 * `[general]`: following settings should be listed here:
98 * `defaultlocale`: The fallback locale, to be used whenever no localized 135 * `defaultlocale`: The fallback locale, to be used whenever no localized
99 page/strings can be found for a locale. 136 page/strings can be found for a locale.
100 * `defaultpage`: the default page which is displayed by the server if the URL 137 * `defaultpage`: the default page which is displayed by the server if the URL
101 doesn't contain a page name. Note that while the test server will consider 138 doesn't contain a page name. Note that while the test server will consider
102 that setting automatically, the real server might need to be configured 139 that setting automatically, the real server might need to be configured
103 accordingly. 140 accordingly.
141 * `crowdin-project-name`: The Crowdin project name, this must be set for if
142 you intend to use the cms.bin.translate script to update the Crowdin
143 translations.
104 * `[langnames]`: defines the language names correspoding to particular language 144 * `[langnames]`: defines the language names correspoding to particular language
105 codes. 145 codes.
106 * `[rtl]`: any language codes listed here are treated as right-to-left languages . 146 * `[rtl]`: any language codes listed here are treated as right-to-left languages .
107 The values of the settings are ignored. 147 The values of the settings are ignored.
108 * `[locale_overrides]`: every entry defines that a page should use a different 148 * `[locale_overrides]`: every entry defines that a page should use a different
109 locale file, not the one matching its name (to be used when multiple pages 149 locale file, not the one matching its name (to be used when multiple pages
110 share localization data). 150 share localization data).
111 151
112 ### Localization files ### 152 ### Localization files ###
113 153
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 filter is invoked. For more information on Jinja2 filters see 286 filter is invoked. For more information on Jinja2 filters see
247 [official documentation](http://jinja.pocoo.org/docs/dev/api/#writing-filters). 287 [official documentation](http://jinja.pocoo.org/docs/dev/api/#writing-filters).
248 288
249 ### Custom functions and variables ### 289 ### Custom functions and variables ###
250 290
251 The `globals` directory can define custom Jinja2 globals which will be available 291 The `globals` directory can define custom Jinja2 globals which will be available
252 in all Jinja2 templates. Typically, this is used for custom functions. The file 292 in all Jinja2 templates. Typically, this is used for custom functions. The file
253 name should match the name of the function or variable to be defined, and export 293 name should match the name of the function or variable to be defined, and export
254 a variable with that name. E.g. `globals/myfunction.py` can define a function 294 a variable with that name. E.g. `globals/myfunction.py` can define a function
255 called `myfunction` that will become available to all Jinja2 templates. 295 called `myfunction` that will become available to all Jinja2 templates.
OLDNEW
« no previous file with comments | « no previous file | cms/bin/translate.py » ('j') | cms/bin/translate.py » ('J')

Powered by Google App Engine
This is Rietveld