Get translation file list from format, not from the system

Julien LepillerMon Nov 11 16:26:27+0100 2019

67b2f4f

Get translation file list from format, not from the system

offlate/formats/androidstrings.py

7777
7878
    def reload(self):
7979
        self.translation = androidstringslib.android(self.conf["template"], self.conf["file"])
80+
81+
    def translationFiles(self):
82+
        return [self.translationfilename]

offlate/formats/appstore.py

8080
                    trval = open(filename).read()
8181
                resources.append(AppstoreEntry(filename, enval, trval))
8282
        self.resources = resources
83+
84+
    def translationFiles(self):
85+
        return [x.filename for x in self.resources]

offlate/formats/gettext.py

6666
            self.po = polib.pofile(self.conf["file"])
6767
        else:
6868
            self.po = polib.pofile(self.conf["pot"])
69+
70+
    def translationFiles(self):
71+
        return [self.conf["file"]]

offlate/formats/ts.py

311311
    def reload(self):
312312
        self.tscontent = self.parse(self.tsfilename)
313313
        self.savedcontent = [TSEntry(x) for x in self.tscontent]
314+
315+
    def translationFiles(self):
316+
        return [self.tsfilename]

offlate/formats/yaml.py

104104
                lang1 = list(source.keys())[0]
105105
                lang2 = list(dest.keys())[0]
106106
                self.contents = yaml_rec_load([lang2], source[lang1], dest[lang2])
107+
108+
    def translationFiles(self):
109+
        return [self.dest]

offlate/systems/github.py

5555
            interface.githubBranchError('translation')
5656
            return
5757
58+
        translationfiles = []
5859
        for mfile in self.translationfiles:
59-
            mfile = mfile['filename']
60+
            translationfiles.extend(mfile['format'].translationFiles())
61+
62+
        for mfile in translationfiles:
63+
            mfile = mfile[len(self.basedir + '/current/'):]
6064
            try:
6165
                # workaround a bug, where we cannot get the content hash of a single file, by looking
6266
                # for every file in the parent directory.

offlate/systems/gitlab.py

5151
        try:
5252
            project = gl.projects.get(currentUser + "/" + projectname)
5353
        except:
54-
            project = project.forks.create({})
54+
            project = originproject.forks.create({})
5555
5656
        try:
5757
            branch = project.branches.create({'branch': 'translation', 'ref': self.branch})

5959
            interface.gitlabTokenBranchError('translation')
6060
            return
6161
        actions = []
62+
        translationfiles = []
6263
        for mfile in self.translationfiles:
63-
            mfile = mfile['filename']
64+
            translationfiles.extend(mfile['format'].translationFiles())
65+
66+
        for mfile in translationfiles:
67+
            mfile = mfile[len(self.basedir + '/current/'):]
6468
            try:
6569
                project.files.get(file_path=mfile, ref=self.branch)
6670
                actions.append({'action': 'update',