OLD | NEW |
(Empty) | |
| 1 # This file is part of the Adblock Plus web scripts, |
| 2 # Copyright (C) 2006-present eyeo GmbH |
| 3 # |
| 4 # Adblock Plus is free software: you can redistribute it and/or modify |
| 5 # it under the terms of the GNU General Public License version 3 as |
| 6 # published by the Free Software Foundation. |
| 7 # |
| 8 # Adblock Plus is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. |
| 12 # |
| 13 # You should have received a copy of the GNU General Public License |
| 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
| 16 """Messages and other constants used by the translation script.""" |
| 17 |
| 18 |
| 19 class InfoMessages: |
| 20 PROJECT_NAME_CREATING = "Creating new project: '{0}'." |
| 21 PROJECT_CREATED = "Project created! The project ID is: '{0}'." |
| 22 GENERATING_TOKEN = "Generating token for '{0}' (userID: {1})." |
| 23 TOKEN_GENERATED = 'Token generated!: {}' |
| 24 TOKEN_SAVE_TO_ENV_VAR = ('To utilize the token, please copy-paste and ' |
| 25 'run the following command in your shell: ' |
| 26 '\n\n\t{}\n\n') |
| 27 NO_FILES_FOUND = 'No target files were found for project {}!' |
| 28 FILES_DOWNLOADED = 'Files downloaded! Now saving them to disc.' |
| 29 FILES_SAVED = 'Files successfully saved in {}!' |
| 30 EXTRACTING_STRINGS = 'Extracting page strings. This might take a while...' |
| 31 RESOLVING_LOCALES = 'Resolving locales...' |
| 32 ADDING_LANGUAGES = 'Adding the following languages to project {0}: {1}' |
| 33 UPLOADING_FILES = 'Uploading {0} files to the project! Please be patient.' |
| 34 CREATED_JOB = 'Created job {0} for {1}, with target language: {2}.' |
| 35 SAVED_PROJECT_ID = 'The project id was saved to settings.ini!' |
| 36 NO_JOBS_CREATED = 'No jobs were created for the current project!' |
| 37 FILES_UPLOADED = 'The files were successfully uploaded to XTM Cloud!' |
| 38 WAITING_FOR_PROJECT = ('Waiting for the project processing to finish. ' |
| 39 'This might take a while...') |
| 40 FILE_SAVED = 'Saved file {0} ({1}B).' |
| 41 GREETINGS = 'Bye! :D' |
| 42 |
| 43 |
| 44 class ErrorMessages: |
| 45 NO_TARGET_LANG = 'Error: No target language was provided!' |
| 46 NO_TOKEN_PROVIDED = ('Error: No token found! Copy-paste and run the ' |
| 47 'following command in your shell to login and ' |
| 48 'generate the token: \n\n\t{}\n\n. Watch out: In ' |
| 49 'order for the token to be valid, re-run the script ' |
| 50 'in the same shell after generating it!') |
| 51 LOCALES_NOT_PRESENT = ('Error: The following languages are enabled in the ' |
| 52 'API, but not listed in locales: {0}! Please ' |
| 53 'remove them manually from project number {1} and ' |
| 54 'then re-run the script!') |
| 55 FILENAME_TOO_LONG = ('The filename is too long: {0}! XTM only supports ' |
| 56 'up to {1} characters!') |
| 57 CANT_RESOLVE_REMOTE_LANG = 'Cannot resolve remote locale: {0}' |
| 58 PROJECT_EXISTS = ('Error! There already exists an XTM project associated' |
| 59 ' with this website (number {0})! If you want to ' |
| 60 'overwrite this, please delete the project id from ' |
| 61 'settings.ini and run this again.') |
| 62 NO_PROJECT = 'Error! No project configured for {}!' |
| 63 NO_TARGET_FILES_FOUND = ('Error: No target files were found in XTM! ' |
| 64 'Please generate them and then try again!') |
| 65 COULD_NOT_SAVE_FILES = ('Error: Could not save the downloaded files to ' |
| 66 'disk!') |
| 67 |
| 68 |
| 69 class WarningMessages: |
| 70 LOCALE_NOT_SUPPORTED = ('The following locale is not supported: "{0}". ' |
| 71 'Ignoring...') |
| 72 |
| 73 |
| 74 class ProjectName: |
| 75 MAX_LENGTH = 150 |
| 76 INVALID_CHARS = list('\\/:*?"<>|{}') |
| 77 NAME_WILDCARD = '_' |
| 78 |
| 79 |
| 80 class Token: |
| 81 ENV_VAR = 'XTM_TOKEN' |
| 82 SAVE_COMMAND = "export {0}='{1}'" |
| 83 CREATION_CMD = 'python -m cms.bin.xtm_translations login' |
| 84 |
| 85 |
| 86 class ArgumentsHelp: |
| 87 VERBOSE = 'Whether the script will log its work to stderr or not.' |
| 88 PROJECT_ID = ('The ID of the project we are working with. Will be ' |
| 89 'ignored if in "create" mode.') |
| 90 LOGIN = 'Mode used to generate and save an API token from username+pass.' |
| 91 PROJECT = ('Mode for handling projects: creation, files upload/ update/ ' |
| 92 'download.') |
| 93 PROJECT_SOURCE_DIR = 'The source directory of the website.' |
| 94 PROJECT_DOWNLOAD = ('Download the translation files from a project and ' |
| 95 'save them to disk.') |
| 96 |
| 97 class ProjectCreate: |
| 98 MAIN = 'Sub-mode used to create a new project with XTM Cloud.' |
| 99 NAME = 'The name of the project will have once created.' |
| 100 DESC = 'TBD' |
| 101 CLIENT_ID = 'TBD' |
| 102 REF_ID = 'TBD' |
| 103 WORKFLOW_ID = 'TBD' |
| 104 SOURCE = 'The source language for this project. Default "en_US".' |
| 105 SAVE_ID = ('Whether to save the id of the project to settings.ini or ' |
| 106 'not. Default False.') |
| 107 |
| 108 class ProjectUpload: |
| 109 MAIN = 'Sub-mode used to upload files to an XTM Cloud project.' |
| 110 NO_OVERWRITE = ('If set, the script will not overwrite the files ' |
| 111 'already present in the XTM environment.') |
| 112 |
| 113 |
| 114 class Config: |
| 115 XTM_SECTION = 'XTM' |
| 116 PROJECT_OPTION = 'project_id' |
| 117 MAIN_SECTION = 'general' |
| 118 DEFAULT_LOCALE_OPTION = 'defaultlocale' |
| 119 |
| 120 |
| 121 SUPPORTED_LOCALES = ( |
| 122 'ab, aa_ET, ak, af_ZA, sq_AL, am_ET, am_ER, ar_AA, ar_AE,ar_BH, ar_DZ, ' |
| 123 'ar_EG, ar_EH, ar_IQ, ar_JO, ar_KW, ar_LB, ar_LY, ar_MA, ar_MR, ar_OM, ' |
| 124 'ar_PS, ar_QA, ar_SA, ar_SD, ar_SY, ar_TD, ar_TN, ar_YE, hy_AM, ' |
| 125 'hy_AM_arevela, hy_AM_arevmda, as_IN, ast_ES, ay_BO, az_AZ_Cyrl, ' |
| 126 'az_AZ_Latn, ba_RU, bal_IR, bh_IN, bi_VU, bs_BA_Cyrl, bs_BA_Latn, br_FR, ' |
| 127 'bsk, my_MM, be_BY, cal, ca_ES, ceb, cha, ny_MW, zh_CN, zh_TW, zh_HK, ' |
| 128 'zh_SG, chk, co_FR, hr_HR, hr_BA, cs_CZ, eu_ES, bn_IN, bn_BD, bg_BG, ' |
| 129 'ca_AD, dnj, da_DK, prs_AF, dv_IN, mis, nl_NL, en_US, en_GB, en_142, ' |
| 130 'en_CA, en_AU, en_NZ, en_ZA, en_CH, en_HK, en_IN, en_IE, en_SG, en_AE, ' |
| 131 'en_DE, en_NL, en_AT, en_NT, en_CY, en_KE, en_BS, en_MY, en_PK, en_PH, eo,' |
| 132 ' et_EE, ee_GH, fo_FO, fj_FJ, fil_PH, fi_FI, nl_BE, fr_FR, fr_CA, fr_CH, ' |
| 133 'fr_BE, fr_LU, fr_MA, fr_SN, fr_CM, fy, fu, fat, gl_ES, ka_GE, kar, de_DE,' |
| 134 ' de_AT, de_BE, de_CH, de_LU, de_NL, lb_LU, kl_GL, el_GR, el_CY, grc_GR, ' |
| 135 'grn, gu_IN, ht_HT, cnh, ha_NG, he_IL, hi_IN, hil, hmn, hmn_US, hu_HU, ' |
| 136 'haw, is_IS, ig, ilo, id_ID, ia, ie, iu, ium, ik, ga_IE, it_IT, it_CH, ' |
| 137 'ja_JP, jv_ID, ks, kk_KZ, kg_CG, rw_RW, ky, rn, sw_KE, km_KH, kn_IN, ' |
| 138 'kok_IN, tlh, ko_KR, kos, ku_TR, kmr, ckb, ku_IQ, lo_LA, la, lv_LV, ln_CG,' |
| 139 ' lt_LT, mfe_MU, mk_MK, mg_MG, ms_MY, ms_SG, ml_IN, mt_MT, mi_NZ, mr_IN, ' |
| 140 'mah, mn_MN, sla_ME, mo_MD, na_NR, nv, nd_ZW, ne_NP, no_NO, nb_NO, nn_NO, ' |
| 141 'nso_ZA, nus, oc_FR, or_IN, om_ET, ota, pau, ps, ps_PK, fa_IR, pon, pl_PL,' |
| 142 ' pt_PT, pt_BR, pt_MZ, pt_AO, pa_PA, pa_IN, pa_PK, qu_PE, qya, xr_MM, ' |
| 143 'rm_CH, ro_RO, ro_MD, ru_RU, ru_AM, ru_AZ, ru_GE, ru_MD, ru_UA, sm_WS, sg,' |
| 144 ' sa_IN, sc_IT, gd_GB, st, tn_ZA, sr_YU, sr_RS_Cyrl, sr_ME_Cyrl, ' |
| 145 'sr_ME_Latn, sr_RS_Latn, sn, sjn, sd_PK, si_LK, ss, sk_SK, sl_SI, so_SO, ' |
| 146 'dsb_DE, hsb_DE, es_ES, es_AR, es_BO, es_CL, es_CO, es_CR, es_CU, es_DO, ' |
| 147 'es_EC, es_SV, es_GT, es_HN, es_419, es_MX, es_NI, es_PA, es_PY, es_PE, ' |
| 148 'es_PR, es_UY, es_US, es_VE, es_001, es_NT, swa, sw_SO, sw_TZ, sw_UG, ' |
| 149 'sv_SE, sv_FI, apd_SD, apd_SD_Latn, sun, syr_TR, tl_PH, tg_TJ, ta_IN, ' |
| 150 'ta_SG, ta_LK, tt_RU, te_IN, tet_ID, tet_TL, th_TH, bo, ti, to_TO, ts_ZA, ' |
| 151 'tn_BW, tr_TR, tk_TM, tw, uk_UA, ur_IN, ur_PK, ug_CN, uz_UZ_Cyrl, ' |
| 152 'uz_UZ_Latn, uz_AF, cy_GB, vi_VN, vo, wo, xh_ZA, xz_AF, yap, yi, yi_IL, ' |
| 153 'yi_US, yo_NG, czt, zu_ZA, kun, lua, sco_GB, sco_IE, fr_CG, zh_YUE, lug, ' |
| 154 'ogo, bbc, ksw, cfm, cmn, goyu, aii, cld, pdc' |
| 155 ).split(', ') |
| 156 |
| 157 |
| 158 class FileNames: |
| 159 MAX_LENGTH = 256 |
| 160 PATH_SEP_REP = '___' |
| 161 |
| 162 |
| 163 UNDER_ANALYSIS_MESSAGE = ('403: {"reason":"Project is under analysis. ' |
| 164 'Please wait for analysis end."}') |
| 165 |
| 166 MAX_WAIT_TIME = 10 |
OLD | NEW |