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 Sebastian's feedback Created July 14, 2015, 12:50 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 `urllib3` Python module is installed.
82
83 Now to sync with Crowdin type the following:
84
85 python -m cms.bin.translate www_directory crowdin_project_api_key [logging_l evel]
86
87 The script might take a while to run, it does the following things:
88
89 1. Requests information about your Crowdin project
90 2. Checks all local locales are supported by Crowdin and enabled for your projec t
91 3. Renders all pages in your default language and extracts all page strings
92 4. Creates any required directories in your Crowdin project
93 5. Uploads any new page strings and updates any existing page strings
94 6. Uploads any pre-existing translation files for any newly uploaded pages
95 7. Requests Crowdin generate a fresh translations export archive
96 8. Downloads the archive of translations and extracts it replacing all local
97 translation files
98
99 Notes:
100
101 - You have to use the Crowdin project's API key, not your account API key
102 - You should probably enable "Skip untranslated strings" under your
103 project settings.
104 - Translations are only _uploaded_ for new files. If you are syncing with
105 Crowdin for the first time, and you have existing translation files pay
106 attention to any warnings. If there are any problems it is recommended
107 you re-create another fresh Crowdin project and try again. (Otherwise
108 translations for the pages already uploaded could be lost!)
109 - If you are running the script from a cronjob or similar you will probably
110 want to set the logging level to `ERROR` or similar
111
76 ## Content structure ## 112 ## Content structure ##
77 113
78 Currently, the following directories of your content directory will be 114 Currently, the following directories of your content directory will be
79 considered: 115 considered:
80 116
81 * `filters`: Custom Jinja2 filters 117 * `filters`: Custom Jinja2 filters
82 * `globals`: Custom Jinja2 global functions and variables 118 * `globals`: Custom Jinja2 global functions and variables
83 * `includes`: Various include files 119 * `includes`: Various include files
84 * `locales`: Localization files 120 * `locales`: Localization files
85 * `pages`: User-visible pages 121 * `pages`: User-visible pages
86 * `static`: Static content 122 * `static`: Static content
87 * `templates`: Page layout templates 123 * `templates`: Page layout templates
88 124
89 There should also be a `settings.ini` file with configuration. 125 There should also be a `settings.ini` file with configuration.
90 126
91 All of these are explained in more detail below. 127 All of these are explained in more detail below.
92 128
93 ### Configuration (settings.ini) ### 129 ### Configuration (settings.ini) ###
94 130
95 The following sections can be defined in `settings.ini`: 131 The following sections can be defined in `settings.ini`:
96 132
97 * `[general]`: following settings should be listed here: 133 * `[general]`: following settings should be listed here:
98 * `defaultlocale`: The fallback locale, to be used whenever no localized 134 * `defaultlocale`: The fallback locale, to be used whenever no localized
99 page/strings can be found for a locale. 135 page/strings can be found for a locale.
100 * `defaultpage`: the default page which is displayed by the server if the URL 136 * `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 137 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 138 that setting automatically, the real server might need to be configured
103 accordingly. 139 accordingly.
140 * `crowdin-project-name`: The Crowdin project name, this must be set for if
141 you intend to use the cms.bin.translate script to update the Crowdin
142 translations.
104 * `[langnames]`: defines the language names correspoding to particular language 143 * `[langnames]`: defines the language names correspoding to particular language
105 codes. 144 codes.
106 * `[rtl]`: any language codes listed here are treated as right-to-left languages . 145 * `[rtl]`: any language codes listed here are treated as right-to-left languages .
107 The values of the settings are ignored. 146 The values of the settings are ignored.
108 * `[locale_overrides]`: every entry defines that a page should use a different 147 * `[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 148 locale file, not the one matching its name (to be used when multiple pages
110 share localization data). 149 share localization data).
111 150
112 ### Localization files ### 151 ### Localization files ###
113 152
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 filter is invoked. For more information on Jinja2 filters see 285 filter is invoked. For more information on Jinja2 filters see
247 [official documentation](http://jinja.pocoo.org/docs/dev/api/#writing-filters). 286 [official documentation](http://jinja.pocoo.org/docs/dev/api/#writing-filters).
248 287
249 ### Custom functions and variables ### 288 ### Custom functions and variables ###
250 289
251 The `globals` directory can define custom Jinja2 globals which will be available 290 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 291 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 292 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 293 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. 294 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