Coverage for app/venv/lib/python3.14/site-packages/weblate/trans/actions.py: 100%

89 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 07:15 +0000

1# Copyright © Michal Čihař <michal@weblate.org> 

2# 

3# SPDX-License-Identifier: GPL-3.0-or-later 

4 

5 

6from django.db.models import IntegerChoices 

7from django.utils.translation import gettext_lazy, pgettext_lazy 

8 

9 

10class ActionEvents(IntegerChoices): 

11 # Translators: Name of event in the history 

12 UPDATE = 0, gettext_lazy("Resource updated") 

13 # Translators: Name of event in the history 

14 COMPLETE = 1, gettext_lazy("Translation completed") 

15 # Translators: Name of event in the history 

16 CHANGE = 2, gettext_lazy("Translation changed") 

17 # Translators: Name of event in the history 

18 COMMENT = 3, gettext_lazy("Comment added") 

19 # Translators: Name of event in the history 

20 SUGGESTION = 4, gettext_lazy("Suggestion added") 

21 # Translators: Name of event in the history 

22 NEW = 5, gettext_lazy("Translation added") 

23 # Translators: Name of event in the history 

24 AUTO = 6, gettext_lazy("Automatically translated") 

25 # Translators: Name of event in the history 

26 ACCEPT = 7, gettext_lazy("Suggestion accepted") 

27 # Translators: Name of event in the history 

28 REVERT = 8, gettext_lazy("Translation reverted") 

29 # Translators: Name of event in the history 

30 UPLOAD = 9, gettext_lazy("Translation uploaded") 

31 # Translators: Name of event in the history 

32 NEW_SOURCE = 13, gettext_lazy("Source string added") 

33 # Translators: Name of event in the history 

34 LOCK = 14, gettext_lazy("Component locked") 

35 # Translators: Name of event in the history 

36 UNLOCK = 15, gettext_lazy("Component unlocked") 

37 # Used to be ACTION_DUPLICATE_STRING = 16 

38 # Translators: Name of event in the history 

39 COMMIT = 17, gettext_lazy("Changes committed") 

40 # Translators: Name of event in the history 

41 PUSH = 18, gettext_lazy("Changes pushed") 

42 # Translators: Name of event in the history 

43 RESET = 19, gettext_lazy("Repository reset") 

44 # Translators: Name of event in the history 

45 MERGE = 20, gettext_lazy("Repository merged") 

46 # Translators: Name of event in the history 

47 REBASE = 21, gettext_lazy("Repository rebased") 

48 # Translators: Name of event in the history 

49 FAILED_MERGE = 22, gettext_lazy("Repository merge failed") 

50 # Translators: Name of event in the history 

51 FAILED_REBASE = 23, gettext_lazy("Repository rebase failed") 

52 # Translators: Name of event in the history 

53 PARSE_ERROR = 24, gettext_lazy("Parsing failed") 

54 # Translators: Name of event in the history 

55 REMOVE_TRANSLATION = 25, gettext_lazy("Translation removed") 

56 # Translators: Name of event in the history 

57 SUGGESTION_DELETE = 26, gettext_lazy("Suggestion removed") 

58 # Translators: Name of event in the history 

59 REPLACE = 27, gettext_lazy("Translation replaced") 

60 # Translators: Name of event in the history 

61 FAILED_PUSH = 28, gettext_lazy("Repository push failed") 

62 # Translators: Name of event in the history 

63 SUGGESTION_CLEANUP = 29, gettext_lazy("Suggestion removed during cleanup") 

64 # Translators: Name of event in the history 

65 SOURCE_CHANGE = 30, gettext_lazy("Source string changed") 

66 # Translators: Name of event in the history 

67 NEW_UNIT = 31, gettext_lazy("String added") 

68 # Translators: Name of event in the history 

69 BULK_EDIT = 32, gettext_lazy("Bulk status changed") 

70 # Translators: Name of event in the history 

71 ACCESS_EDIT = 33, gettext_lazy("Visibility changed") 

72 # Translators: Name of event in the history 

73 ADD_USER = 34, gettext_lazy("User added") 

74 # Translators: Name of event in the history 

75 REMOVE_USER = 35, gettext_lazy("User removed") 

76 # Translators: Name of event in the history 

77 APPROVE = 36, gettext_lazy("Translation approved") 

78 # Translators: Name of event in the history 

79 MARKED_EDIT = 37, gettext_lazy("Marked for edit") 

80 # Translators: Name of event in the history 

81 REMOVE_COMPONENT = 38, gettext_lazy("Component removed") 

82 # Translators: Name of event in the history 

83 REMOVE_PROJECT = 39, gettext_lazy("Project removed") 

84 # Used to be ACTION_DUPLICATE_LANGUAGE = 40 

85 # Translators: Name of event in the history 

86 RENAME_PROJECT = 41, gettext_lazy("Project renamed") 

87 # Translators: Name of event in the history 

88 RENAME_COMPONENT = 42, gettext_lazy("Component renamed") 

89 # Translators: Name of event in the history 

90 MOVE_COMPONENT = 43, gettext_lazy("Moved component") 

91 # Used to be ACTION_NEW_STRING = 44 

92 # Translators: Name of event in the history 

93 NEW_CONTRIBUTOR = 45, gettext_lazy("Contributor joined") 

94 # Translators: Name of event in the history 

95 ANNOUNCEMENT = 46, gettext_lazy("Announcement posted") 

96 # Translators: Name of event in the history 

97 ALERT = 47, gettext_lazy("Alert triggered") 

98 # Translators: Name of event in the history 

99 ADDED_LANGUAGE = 48, gettext_lazy("Language added") 

100 # Translators: Name of event in the history 

101 REQUESTED_LANGUAGE = 49, gettext_lazy("Language requested") 

102 # Translators: Name of event in the history 

103 CREATE_PROJECT = 50, gettext_lazy("Project created") 

104 # Translators: Name of event in the history 

105 CREATE_COMPONENT = 51, gettext_lazy("Component created") 

106 # Translators: Name of event in the history 

107 INVITE_USER = 52, gettext_lazy("User invited") 

108 # Translators: Name of event in the history 

109 HOOK = 53, gettext_lazy("Repository notification received") 

110 # Translators: Name of event in the history 

111 REPLACE_UPLOAD = 54, gettext_lazy("Translation replaced file by upload") 

112 # Translators: Name of event in the history 

113 LICENSE_CHANGE = 55, gettext_lazy("License changed") 

114 # Translators: Name of event in the history 

115 AGREEMENT_CHANGE = 56, gettext_lazy("Contributor license agreement changed") 

116 # Translators: Name of event in the history 

117 SCREENSHOT_ADDED = 57, gettext_lazy("Screenshot added") 

118 # Translators: Name of event in the history 

119 SCREENSHOT_UPLOADED = 58, gettext_lazy("Screenshot uploaded") 

120 # Translators: Name of event in the history 

121 STRING_REPO_UPDATE = 59, gettext_lazy("String updated in the repository") 

122 # Translators: Name of event in the history 

123 ADDON_CREATE = 60, gettext_lazy("Add-on installed") 

124 # Translators: Name of event in the history 

125 ADDON_CHANGE = 61, gettext_lazy("Add-on configuration changed") 

126 # Translators: Name of event in the history 

127 ADDON_REMOVE = 62, gettext_lazy("Add-on uninstalled") 

128 # Translators: Name of event in the history 

129 STRING_REMOVE = 63, gettext_lazy("String removed") 

130 # Translators: Name of event in the history 

131 COMMENT_DELETE = 64, gettext_lazy("Comment removed") 

132 # Translators: Name of event in the history 

133 COMMENT_RESOLVE = ( 

134 65, 

135 pgettext_lazy("Name of event in the history", "Comment resolved"), 

136 ) 

137 # Translators: Name of event in the history 

138 EXPLANATION = 66, gettext_lazy("Explanation updated") 

139 # Translators: Name of event in the history 

140 REMOVE_CATEGORY = 67, gettext_lazy("Category removed") 

141 # Translators: Name of event in the history 

142 RENAME_CATEGORY = 68, gettext_lazy("Category renamed") 

143 # Translators: Name of event in the history 

144 MOVE_CATEGORY = 69, gettext_lazy("Category moved") 

145 # Translators: Name of event in the history 

146 SAVE_FAILED = 70, gettext_lazy("Saving string failed") 

147 # Translators: Name of event in the history 

148 NEW_UNIT_REPO = 71, gettext_lazy("String added in the repository") 

149 # Translators: Name of event in the history 

150 STRING_UPLOAD_UPDATE = 72, gettext_lazy("String updated in the upload") 

151 # Translators: Name of event in the history 

152 NEW_UNIT_UPLOAD = 73, gettext_lazy("String added in the upload") 

153 # Translators: Name of event in the history 

154 SOURCE_UPLOAD = 74, gettext_lazy("Translation updated by source upload") 

155 # Translators: Name of event in the history 

156 COMPLETED_COMPONENT = 75, gettext_lazy("Component translation completed") 

157 # Translators: Name of event in the history 

158 ENFORCED_CHECK = 76, gettext_lazy("Applied enforced check") 

159 # Translators: Name of event in the history 

160 PROPAGATED_EDIT = 77, gettext_lazy("Propagated change") 

161 # Translators: Name of event in the history 

162 FILE_UPLOAD = 78, gettext_lazy("File uploaded") 

163 # Translators: Name of event in the history 

164 EXTRA_FLAGS = 79, gettext_lazy("Extra flags updated") 

165 # Translators: Name of event in the history 

166 FONT_CREATE = 80, gettext_lazy("Font uploaded") 

167 # Translators: Name of event in the history 

168 FONT_CHANGE = 81, gettext_lazy("Font changed") 

169 # Translators: Name of event in the history 

170 FONT_REMOVE = 82, gettext_lazy("Font removed") 

171 # Translators: Name of event in the history 

172 FORCE_SYNC = 83, gettext_lazy("Forced synchronization of translations") 

173 # Translators: Name of event in the history 

174 FORCE_SCAN = 84, gettext_lazy("Forced rescan of translations") 

175 

176 

177# Actions which are logged 

178ACTIONS_LOG = { 

179 ActionEvents.RESET, 

180 ActionEvents.REMOVE_TRANSLATION, 

181 ActionEvents.ACCESS_EDIT, 

182 ActionEvents.ADD_USER, 

183 ActionEvents.REMOVE_USER, 

184 ActionEvents.REMOVE_COMPONENT, 

185 ActionEvents.REMOVE_PROJECT, 

186 ActionEvents.RENAME_PROJECT, 

187 ActionEvents.RENAME_COMPONENT, 

188 ActionEvents.MOVE_COMPONENT, 

189 ActionEvents.ADDED_LANGUAGE, 

190 ActionEvents.CREATE_PROJECT, 

191 ActionEvents.CREATE_COMPONENT, 

192 ActionEvents.REMOVE_CATEGORY, 

193 ActionEvents.RENAME_CATEGORY, 

194 ActionEvents.MOVE_CATEGORY, 

195} 

196 

197 

198# Actions which can be reverted 

199ACTIONS_REVERTABLE = { 

200 ActionEvents.ACCEPT, 

201 ActionEvents.REVERT, 

202 ActionEvents.CHANGE, 

203 ActionEvents.UPLOAD, 

204 ActionEvents.NEW, 

205 ActionEvents.REPLACE, 

206 ActionEvents.AUTO, 

207 ActionEvents.APPROVE, 

208 ActionEvents.MARKED_EDIT, 

209 ActionEvents.PROPAGATED_EDIT, 

210 ActionEvents.STRING_REPO_UPDATE, 

211 ActionEvents.STRING_UPLOAD_UPDATE, 

212} 

213 

214# Content changes considered when looking for last author 

215ACTIONS_CONTENT = { 

216 ActionEvents.CHANGE, 

217 ActionEvents.NEW, 

218 ActionEvents.AUTO, 

219 ActionEvents.ACCEPT, 

220 ActionEvents.REVERT, 

221 ActionEvents.UPLOAD, 

222 ActionEvents.REPLACE, 

223 ActionEvents.BULK_EDIT, 

224 ActionEvents.APPROVE, 

225 ActionEvents.MARKED_EDIT, 

226 ActionEvents.PROPAGATED_EDIT, 

227 ActionEvents.SOURCE_CHANGE, 

228 ActionEvents.EXPLANATION, 

229 ActionEvents.EXTRA_FLAGS, 

230 ActionEvents.NEW_UNIT, 

231 ActionEvents.ENFORCED_CHECK, 

232} 

233 

234# Actions shown on the repository management page 

235ACTIONS_REPOSITORY = { 

236 ActionEvents.COMMIT, 

237 ActionEvents.PUSH, 

238 ActionEvents.RESET, 

239 ActionEvents.MERGE, 

240 ActionEvents.REBASE, 

241 ActionEvents.FAILED_MERGE, 

242 ActionEvents.FAILED_REBASE, 

243 ActionEvents.FAILED_PUSH, 

244 ActionEvents.LOCK, 

245 ActionEvents.UNLOCK, 

246 ActionEvents.HOOK, 

247 ActionEvents.FILE_UPLOAD, 

248 ActionEvents.FORCE_SYNC, 

249 ActionEvents.FORCE_SCAN, 

250} 

251 

252# Actions where target is rendered as translation string 

253ACTIONS_SHOW_CONTENT = { 

254 ActionEvents.SUGGESTION, 

255 ActionEvents.SUGGESTION_DELETE, 

256 ActionEvents.SUGGESTION_CLEANUP, 

257 ActionEvents.BULK_EDIT, 

258 ActionEvents.NEW_UNIT, 

259 ActionEvents.STRING_REPO_UPDATE, 

260 ActionEvents.NEW_UNIT_REPO, 

261 ActionEvents.STRING_UPLOAD_UPDATE, 

262 ActionEvents.NEW_UNIT_UPLOAD, 

263} 

264 

265# Actions indicating a repository merge failure 

266ACTIONS_MERGE_FAILURE = { 

267 ActionEvents.FAILED_MERGE, 

268 ActionEvents.FAILED_REBASE, 

269 ActionEvents.FAILED_PUSH, 

270} 

271 

272ACTIONS_ADDON = { 

273 ActionEvents.ADDON_CREATE, 

274 ActionEvents.ADDON_CHANGE, 

275 ActionEvents.ADDON_REMOVE, 

276}