#!/usr/bin/env python # # Copyright (C) 2019 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ Helper script to generate tedious strings.xml permutations """ from string import Template verbs = ["write","trash","untrash","delete"] datas = [("audio","audio file"),("video","video"),("image","photo"),("generic","item")] print ''' ''' for verb in verbs: verblabel = verb if verb == "write": verblabel = "modify" verblabelcaps = verblabel[0].upper() + verblabel[1:] if verb == "trash": verblabelcaps = "Move to trash" if verb == "untrash": verblabelcaps = "Move out of trash" print ''' ''' % (verb.upper()) for data, datalabel in datas: if verb == "trash": print Template(''' Allow ^1 to move this $datalabel to trash? Allow ^1 to move ^2 ${datalabel}s to trash? ''').substitute(vars()).strip("\n") elif verb == "untrash": print Template(''' Allow ^1 to move this $datalabel out of trash? Allow ^1 to move ^2 ${datalabel}s out of trash? ''').substitute(vars()).strip("\n") else: print Template(''' Allow ^1 to $verblabel this $datalabel? Allow ^1 to $verblabel ^2 ${datalabel}s? ''').substitute(vars()).strip("\n") print ''' '''