2 Commits

Author SHA1 Message Date
Hans-Christoph Steiner
aecf4fdc17
sync common works to the Android v9.0.0r50 sources 2019-11-21 16:06:34 +01:00
Hans-Christoph Steiner
3868b81587 sync up "Settings" translation with Android standard strings
fdroid/fdroidclient#1569

```python
import glob
import os
import re

locale_pat = re.compile(r'.*values-([a-z][a-z][a-zA-Z-]*)/strings.xml')
translation_pat = re.compile(r'.*name="settings_label"[^>]*>"?([^"<]*).*')
for f in glob.glob('/home/hans/code/android.googlesource.com/packages/apps/Settings/res/values-[a-z][a-z]*/strings.xml'):
    m = locale_pat.search(f)
    if m:
        locale = m.group(1)
        if locale.endswith('-nokeys'):
            continue
    #print(locale)
    with open(f) as fp:
        m = translation_pat.search(fp.read())
        if m:
            word = m.group(1)
            print(locale, '\t', word)
            fdroid = '/home/hans/code/fdroid/client/app/src/main/res/values-' + locale + '/strings.xml'
            if os.path.exists(fdroid):
                with open(fdroid) as fp:
                    data = fp.read()
                with open(fdroid, 'w') as fp:
                    fp.write(re.sub(r'menu_settings">[^<]+</string', 'menu_settings">' + word + '</string', data))
```
2018-12-21 17:07:41 +01:00