mirror of
https://github.com/Findus23/matomo-utils.git
synced 2024-09-18 14:03:44 +02:00
improve mass-edit.py
This commit is contained in:
parent
485d3426b5
commit
4b59dd2e1e
3 changed files with 90 additions and 17 deletions
|
@ -3,6 +3,7 @@ from typing import Dict, List, Tuple
|
|||
import requests
|
||||
|
||||
from config import *
|
||||
from priorities import priorities, Priority
|
||||
|
||||
s = requests.Session()
|
||||
s.headers.update({"Authorization": "Token " + token})
|
||||
|
@ -84,22 +85,33 @@ for slug, comp in phpcomponents.items():
|
|||
license = comp["license"]
|
||||
if license != "GPL-3.0-or-later":
|
||||
print(license)
|
||||
# update_setting(comp, {
|
||||
# "check_flags": "php-format,safe-html,ignore-optional-plural",
|
||||
# # "license": "proprietary",
|
||||
# "manage_units": False, # Manage strings
|
||||
# "edit_template": True,
|
||||
# "enforced_checks": [
|
||||
# "php_format"
|
||||
# ],
|
||||
# })
|
||||
# create_addon(comp, name="weblate.cleanup.blank", configuration={})
|
||||
# create_addon(comp, name="weblate.cleanup.generic", configuration={})
|
||||
# create_addon(comp, name="weblate.json.customize", configuration={
|
||||
# "sort_keys": True,
|
||||
# "indent": 4,
|
||||
# "style": "spaces"
|
||||
# })
|
||||
if slug in priorities:
|
||||
priority = priorities[slug]
|
||||
else:
|
||||
priority = Priority.medium
|
||||
update_setting(comp, {
|
||||
"check_flags": "php-format,safe-html,ignore-optional-plural",
|
||||
# "license": "proprietary",
|
||||
"manage_units": False, # Manage strings
|
||||
"edit_template": True,
|
||||
"enforced_checks": [
|
||||
"php_format"
|
||||
],
|
||||
"priority": priority.value,
|
||||
"language_code_style": "bcp",
|
||||
"new_lang": "contact",
|
||||
"push_on_commit": True,
|
||||
})
|
||||
if "weblate.cleanup.blank" not in addon_ids.keys():
|
||||
create_addon(comp, name="weblate.cleanup.blank", configuration={})
|
||||
if "weblate.cleanup.generic" not in addon_ids.keys():
|
||||
create_addon(comp, name="weblate.cleanup.generic", configuration={})
|
||||
if "weblate.json.customize" not in addon_ids.keys():
|
||||
create_addon(comp, name="weblate.json.customize", configuration={
|
||||
"sort_keys": True,
|
||||
"indent": 4,
|
||||
"style": "spaces"
|
||||
})
|
||||
if "weblate.git.squash" not in addon_ids.keys():
|
||||
print("add addon")
|
||||
create_addon(comp, name="weblate.git.squash", configuration={
|
||||
|
|
61
localisation/priorities.py
Normal file
61
localisation/priorities.py
Normal file
|
@ -0,0 +1,61 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
# from PRIORITY_CHOICES in weblate/weblate/trans/util.py
|
||||
class Priority(Enum):
|
||||
very_high = 60
|
||||
high = 80
|
||||
medium = 100
|
||||
low = 120
|
||||
very_low = 140
|
||||
|
||||
|
||||
priorities = {
|
||||
"matomo-base": Priority.very_high,
|
||||
"plugin-actions": Priority.high,
|
||||
"plugin-annotations": Priority.high,
|
||||
"plugin-api": Priority.high,
|
||||
"plugin-coreadminhome": Priority.very_high,
|
||||
"plugin-corehome": Priority.very_high,
|
||||
"plugin-corepluginsadmin": Priority.high,
|
||||
"plugin-coreupdater": Priority.high,
|
||||
"plugin-dashboard": Priority.very_high,
|
||||
"plugin-deviceplugins": Priority.high,
|
||||
"plugin-devicesdetection": Priority.high,
|
||||
"plugin-eccommerce": Priority.high,
|
||||
"plugin-events": Priority.high,
|
||||
"plugin-feedback": Priority.high,
|
||||
"plugin-goals": Priority.high,
|
||||
"plugin-imagegraph": Priority.high,
|
||||
"plugin-insights": Priority.high,
|
||||
"plugin-installation": Priority.very_high,
|
||||
"plugin-languagesmanager": Priority.high,
|
||||
"plugin-live": Priority.high,
|
||||
"plugin-login": Priority.high,
|
||||
"plugin-marketplace": Priority.high,
|
||||
"plugin-overlay": Priority.high,
|
||||
"plugin-privacymanager": Priority.high,
|
||||
"plugin-provider": Priority.high,
|
||||
"plugin-referrers": Priority.high,
|
||||
"plugin-resolution": Priority.high,
|
||||
"plugin-scheduledreports": Priority.high,
|
||||
"plugin-segmenteditor": Priority.high,
|
||||
"plugin-seo": Priority.high,
|
||||
"plugin-sitesmanager": Priority.high,
|
||||
"plugin-transitions": Priority.high,
|
||||
"plugin-twofactorauth": Priority.high,
|
||||
"plugin-usercountry": Priority.high,
|
||||
"plugin-usercountrymap": Priority.high,
|
||||
"plugin-userid": Priority.high,
|
||||
"plugin-userlanguage": Priority.high,
|
||||
"plugin-usersmanager": Priority.high,
|
||||
"plugin-visitfrequency": Priority.high,
|
||||
"plugin-visitorinterest": Priority.high,
|
||||
"plugin-visitssummary": Priority.high,
|
||||
"plugin-visittime": Priority.high,
|
||||
"plugin-websitemeasurable": Priority.high,
|
||||
"plugin-widgetize": Priority.high,
|
||||
"plugin-securityinfo": Priority.low,
|
||||
"ommunityplugin-diagnosticsextended": Priority.low,
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
from pathlib import Path
|
||||
|
||||
lang_dir = Path("../lang")
|
||||
lang_dir = Path("../../lang")
|
||||
|
||||
languages_in_matomo = set(str(dir.stem) for dir in lang_dir.glob("*.json"))
|
||||
|
||||
|
|
Loading…
Reference in a new issue