Files
letro-android/tools/localazy/checkForbiddenTerms.py
renovate[bot] 58e1503e61 Update dependency org.matrix.rustcomponents:sdk-android to v25.7.23 (#5073)
* Update dependency org.matrix.rustcomponents:sdk-android to v25.7.23

* Adapt to SDK changes:

- Add 'creator' role, adapt existing logic to it.
- Remove `ReplyParameters`, replace with `EventId` where possible.
- Fix changes in OIDC auth methods.
- Add more join rules.

* Make sure both creators and users with power level >= 150 are displayed as 'owners' in the room member list.

* Don't close the roles and permissions screen if the user is a creator

* Use `MediaPreviewValue.DEFAULT` for `MediaPreviewConfig.DEFAULT` too

* Improve APIs around checking roles and power levels:
    - Ensure `RoomInfo.RoomPowerLevels.users` can't be directly used to check power levels since it can't check the power levels for creators.
    - Add a few helper functions to handle actions that relied on the previous `users` property, and docs to explain their usages.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jorge Martín <jorgem@element.io>
2025-07-24 11:58:30 +02:00

76 lines
2.7 KiB
Python
Executable File

#!/usr/bin/env python3
# Copyright 2024 New Vector Ltd.
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
# Please see LICENSE files in the repository root for full details.
import sys
from xml.dom import minidom
file = sys.argv[1]
# Dict of forbidden terms, with exceptions for some String name
# Keys are the terms, values are the exceptions.
forbiddenTerms = {
"Element": [
# Those 2 strings are only used in debug version
"screen_advanced_settings_element_call_base_url",
"screen_advanced_settings_element_call_base_url_description",
# only used for element.io homeserver, so it's fine
"screen_server_confirmation_message_login_element_dot_io",
# "Be in your element", will probably be changed on the forks, so we can ignore.
"screen_onboarding_welcome_title",
# Contains "Element Call"
"screen_incoming_call_subtitle_android",
"call_invalid_audio_device_bluetooth_devices_disabled",
# Contains "Element X"
"screen_room_timeline_legacy_call",
# We explicitly want to mention Element Pro in these 2:
"screen_change_server_error_element_pro_required_title",
"screen_change_server_error_element_pro_required_message",
]
}
content = minidom.parse(file)
errors = []
### Strings
for elem in content.getElementsByTagName('string'):
name = elem.attributes['name'].value
# Continue if value is empty
child = elem.firstChild
if child is None:
# Should not happen
continue
value = child.nodeValue
# If value contains a forbidden term, add the error to errors
for (term, exceptions) in forbiddenTerms.items():
if term in value and name not in exceptions:
errors.append('Forbidden term "' + term + '" in string: "' + name + '": ' + value)
### Plurals
for elem in content.getElementsByTagName('plurals'):
name = elem.attributes['name'].value
for it in elem.childNodes:
if it.nodeType != it.ELEMENT_NODE:
continue
# Continue if value is empty
child = it.firstChild
if child is None:
# Should not happen
continue
value = child.nodeValue
# If value contains a forbidden term, add the error to errors
for (term, exceptions) in forbiddenTerms.items():
if term in value and name not in exceptions:
errors.append('Forbidden term "' + term + '" in plural: "' + name + '": ' + value)
# If errors is not empty print the report
if errors:
print('Error(s) in file ' + file + ":", file=sys.stderr)
for error in errors:
print(" - " + error, file=sys.stderr)
sys.exit(1)