set max width on places where the translations get too long
closes #1678
This commit is contained in:
parent
67af661640
commit
a71489a102
@ -42,6 +42,7 @@
|
|||||||
android:id="@+id/find_people_button"
|
android:id="@+id/find_people_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:maxEms="16"
|
||||||
android:text="@string/nearby_splash__find_people_button"
|
android:text="@string/nearby_splash__find_people_button"
|
||||||
style="@style/DetailsSecondaryButtonStyle"
|
style="@style/DetailsSecondaryButtonStyle"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/title"
|
app:layout_constraintTop_toBottomOf="@+id/title"
|
||||||
@ -85,6 +86,7 @@
|
|||||||
android:id="@+id/request_read_external_storage_button"
|
android:id="@+id/request_read_external_storage_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:maxEms="16"
|
||||||
android:text="@string/nearby_splash__request_permission"
|
android:text="@string/nearby_splash__request_permission"
|
||||||
style="@style/DetailsSecondaryButtonStyle"
|
style="@style/DetailsSecondaryButtonStyle"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
@ -37,6 +37,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:backgroundTint="@color/swap_light_blue"
|
android:backgroundTint="@color/swap_light_blue"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
|
android:maxEms="10"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
android:text="@string/menu_install"
|
android:text="@string/menu_install"
|
||||||
tools:ignore="UnusedAttribute" />
|
tools:ignore="UnusedAttribute" />
|
||||||
|
|
||||||
|
@ -143,6 +143,9 @@
|
|||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginRight="4dp"
|
android:layout_marginRight="4dp"
|
||||||
android:layout_marginEnd="4dp"
|
android:layout_marginEnd="4dp"
|
||||||
|
android:maxEms="10"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
tools:text="@string/menu_install"/>
|
tools:text="@string/menu_install"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginRight="16dp"
|
android:layout_marginRight="16dp"
|
||||||
|
android:maxEms="10"
|
||||||
android:text="@string/update_all"
|
android:text="@string/update_all"
|
||||||
style="@style/DetailsPrimaryButtonStyle"
|
style="@style/DetailsPrimaryButtonStyle"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@ -54,6 +55,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
|
android:ellipsize="middle"
|
||||||
|
android:singleLine="true"
|
||||||
tools:text="Show apps"
|
tools:text="Show apps"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
48
tools/check-string-maxlength.py
Executable file
48
tools/check-string-maxlength.py
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# Remove extra translations
|
||||||
|
|
||||||
|
import glob
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
from xml.etree import ElementTree
|
||||||
|
|
||||||
|
maxlengths = {
|
||||||
|
"menu_install": 20,
|
||||||
|
"menu_uninstall": 20,
|
||||||
|
"nearby_splash__find_people_button": 30,
|
||||||
|
"nearby_splash__request_permission": 30,
|
||||||
|
"update_all": 20,
|
||||||
|
"updates__hide_updateable_apps": 35,
|
||||||
|
"updates__show_updateable_apps": 35,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
resdir = os.path.join(os.path.dirname(__file__), '..', 'app', 'src', 'main', 'res')
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
for d in sorted(glob.glob(os.path.join(resdir, 'values-*'))):
|
||||||
|
locale = d.split('/')[-1][7:]
|
||||||
|
|
||||||
|
str_path = os.path.join(d, 'strings.xml')
|
||||||
|
if not os.path.exists(str_path):
|
||||||
|
continue
|
||||||
|
|
||||||
|
with open(str_path, encoding='utf-8') as fp:
|
||||||
|
fulltext = fp.read()
|
||||||
|
|
||||||
|
tree = ElementTree.parse(str_path)
|
||||||
|
root = tree.getroot()
|
||||||
|
|
||||||
|
for e in root.findall('.//string'):
|
||||||
|
|
||||||
|
if maxlengths.get(e.attrib['name']) is not None \
|
||||||
|
and len(e.text) > maxlengths.get(e.attrib['name']):
|
||||||
|
print(e.attrib['name'], locale, str(len(e.text)) + ':\t\t"' + e.text + '"')
|
||||||
|
|
||||||
|
if count > 0:
|
||||||
|
print("%d over-long strings found!" % count)
|
||||||
|
sys.exit(count)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user