Bug #15674

Change all Weblate components to use correct committer name and email

Added by Anonymous 2018-06-19 13:08:37 . Updated 2019-06-27 17:16:42 .

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Internationalization
Target version:
Start date:
2018-06-19
Due date:
% Done:

100%

Feature Branch:
Type of work:
Sysadmin
Blueprint:

Starter:
Affected tool:
Deliverable for:
309

Description

Currently, the components use Tails developers <amnesia@boum.org> as default committer name and email.

We have to change this to comply with our new rules and use Tails translators <tails-l10n@boum.org> As the master of this interface it would be nice if you could take care of this. I’ve not found a way to script this rapidly, so I did not.

DEFAULT_COMMITTER_NAME and DEFAULT_COMMITTER_EMAIL should also be changed or even added in settings.py, see https://docs.weblate.org/en/latest/admin/config.html


Subtasks


Related issues

Related to Tails - Bug #15185: Automatically update Weblate components on mdwn file add/rename/delete in tails.bo git Resolved 2019-02-27
Related to Tails - Feature #16225: merge hefee/dev/translation-server Resolved 2018-12-14

History

#1 Updated by Anonymous 2018-06-19 13:11:43

I’m not allowed to edit /var/lib/weblate/config/settings.py → This part should be done by groente I suppose.

#2 Updated by Anonymous 2018-06-19 13:13:10

  • Description updated

#3 Updated by intrigeri 2018-06-26 16:27:42

  • Target version changed from Tails_3.8 to Tails_3.9

#4 Updated by emmapeel 2018-06-27 14:20:08

  • Status changed from Confirmed to In Progress
  • QA Check set to Ready for QA

I have changed the settings of all components by:

- logging on weblate’s shell in the server:

cd /usr/local/share/weblate/
sudo -u weblate ./manage.py shell


- once inside the shell, i ran this:

from weblate.trans.models import *         
todos = SubProject.objects.all() 

for i in todos:                            
    i.committer_email = u'tails-l10n@boum.org'
    i.committer_name = u'Tails translators'
    i.save()

Is a bit punk maybe, but I think it works.

I leave here the script for future reference.

#5 Updated by emmapeel 2018-06-27 14:20:24

  • Assignee deleted (emmapeel)

#6 Updated by Anonymous 2018-08-19 17:44:05

thanks @emmapeel!

#7 Updated by Anonymous 2018-09-03 17:54:12

  • Target version changed from Tails_3.9 to Tails_3.10.1

Won’t be able to review this in the next 48 hours (release of 3.9)

#8 Updated by intrigeri 2018-10-24 17:03:31

  • Target version changed from Tails_3.10.1 to Tails_3.11

#9 Updated by Anonymous 2018-11-02 16:40:28

  • Assignee set to hefee

#10 Updated by hefee 2018-11-05 17:04:13

If a new components are added what parameters those get.

#11 Updated by hefee 2018-11-05 17:22:06

  • related to Bug #15185: Automatically update Weblate components on mdwn file add/rename/delete in tails.bo git added

#12 Updated by hefee 2018-12-14 03:10:48

#13 Updated by hefee 2018-12-14 03:15:26

When Feature #16225 got merged. We only need to run @emmapeels snipset once again (Bug #15674#note-4) and we can close this issue.

#14 Updated by emmapeel 2018-12-14 09:29:24

hefee wrote:
> When Feature #16225 got merged. We only need to run @emmapeels snipset once again (Bug #15674#note-4) and we can close this issue.

I have ran the script again. But what about all the other default values mentioned at https://redmine.tails.boum.org/code/issues/15185#note-25 ?

file_format = u'po'
license = u'GPL v3'
committer_email = u'tails-l10n@boum.org'
committer_name = u'Tails translators'
i.name = i.filemask
suggestion_voting = True  # this is what makes our review
suggestion_autoaccept = 2 # process work by now
enable_suggestions = True #
allow_translation_propagation = True

do they also need to be updated?

#15 Updated by hefee 2018-12-14 12:55:01

emmapeel wrote:
> hefee wrote:
> > When Feature #16225 got merged. We only need to run @emmapeels snipset once again (Bug #15674#note-4) and we can close this issue.
>
> I have ran the script again. But what about all the other default values mentioned at https://redmine.tails.boum.org/code/issues/15185#note-25 ?
>
> […]
>
> do they also need to be updated?

Feature #16225 is not merged, so new components have still not the correct settings by default. AFTER Feature #16225 has merged we need to run this script again. Also fix the other values as well. But we should use python3 to run manage.py, as we configured weblate to use python3:

<code class="bash">
cd /usr/local/share/weblate/
sudo -u weblate python3 manage.py shell
</code>

(only enable the save = True line after running it once without)

<code class="python">
from weblate.trans.models import *         
todos = SubProject.objects.all() 

for i in todos:
    save = False
    default = {
        "committer_email": 'tails-l10n@boum.org', # no need to use unicode anymore in python3
        "committer_name": 'Tails translators',
        "file_format": 'po',
        "license": 'GPL v3',
        "name": i.filemask,
        "suggestion_voting": True,
        "suggestion_autoaccept": 2,
        "enable_suggestions": True,
        "allow_translation_propagation": True,
    }
    for key,value in default.items():
        if getattr(i, key) != value:
            print("{}[{}]: {} != {}".format(i.name,key,getattr(i,key), value))
            setattr(i, key, value)
            #save = True    # enable this only after checking once the changes
    if save:
        i.save()
</code>

With current run (those issues got fixed):

<code class="text">
wiki/src/news/2018-fundraiser.*.po[file_format]: auto != po            
wiki/src/news/2018-fundraiser.*.po[license]:  != GPL v3      
wiki/src/news/achievements_in_2018.*.po[suggestion_voting]: False != True
wiki/src/news/achievements_in_2018.*.po[suggestion_autoaccept]: 0 != 2
wiki/src/news/achievements_in_2018.*.po[file_format]: auto != po
wiki/src/news/achievements_in_2018.*.po[license]:  != GPL v3
wiki/src/news/version_3.10.1.*.po[file_format]: auto != po
wiki/src/security/Numerous_security_holes_in_3.8.*.po[suggestion_voting]: False != True
wiki/src/security/Numerous_security_holes_in_3.8.*.po[suggestion_autoaccept]: 0 != 2
wiki/src/security/Numerous_security_holes_in_3.8.*.po[file_format]: auto != po    
wiki/src/security/Numerous_security_holes_in_3.8.*.po[license]:  != GPL v3
wiki/src/security/Numerous_security_holes_in_3.9.*.po[suggestion_voting]: False != True
wiki/src/security/Numerous_security_holes_in_3.9.*.po[suggestion_autoaccept]: 0 != 2
wiki/src/security/Numerous_security_holes_in_3.9.*.po[file_format]: auto != po
wiki/src/security/Numerous_security_holes_in_3.9.*.po[license]:  != GPL v3
wiki/src/security/Numerous_security_holes_in_3.9.1.*.po[suggestion_voting]: False != True
wiki/src/security/Numerous_security_holes_in_3.9.1.*.po[suggestion_autoaccept]: 0 != 2
wiki/src/security/Numerous_security_holes_in_3.9.1.*.po[file_format]: auto != po
wiki/src/security/Numerous_security_holes_in_3.9.1.*.po[license]:  != GPL v3
</code>

#16 Updated by emmapeel 2018-12-14 16:20:00

I have run now:

from weblate.trans.models import *
todos = SubProject.objects.all()

for i in todos:
i.report_source_bugs = u’tails-l10n@boum.org’
i.repoweb = ’https://git-tails.immerda.ch/weblate/tails/tree/%(file)s?h=%(branch)s#n%(line)s'
i.suggestion_voting = True
i.suggestion_autoaccept = 2
i.enable_suggestions = True

i.committer_name = u’Tails translators’
i.committer_email = u’tails-l10n@boum.org’
i.allow_translation_propagation = True
i.edit_template = False

if (i.file_format u'auto'): i.file_format = u'po' if (i.license u’‘):
i.license = u’GPL v3’
i.save()

#17 Updated by hefee 2018-12-15 00:04:30

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100
  • QA Check changed from Ready for QA to Pass

Okay now Feature #16225 is merged.

I rerun the script again with more values (that from emmapeel):

<code class="python">
from weblate.trans.models import *
todos = SubProject.objects.all()

for i in todos:
    save = False
    default = {
        "committer_email": 'tails-l10n@boum.org',
        "committer_name": 'Tails translators',
        "file_format": 'po',
        "license": 'GPL v3',
        "name": i.filemask,
        "suggestion_voting": True,  # this is what makes our review
        "suggestion_autoaccept": 2, # process work by now
        "enable_suggestions": True, #
        "allow_translation_propagation": True,
        "edit_template":False,
        "report_source_bugs": 'tails-l10n@boum.org',
        "repoweb": 'https://git-tails.immerda.ch/weblate/tails/tree/%(file)s?h=%(branch)s#n%(line)s',
    }
    for key,value in default.items():
        if getattr(i,key) != value:
            print("{}[{}]: {} != {}".format(i.name,key,getattr(i,key), value))
            setattr(i,key,value)
            # save = True    # enable this only after checking once the changes
    if save:
        i.save()
</code>

#18 Updated by intrigeri 2019-06-27 17:16:42

  • Assignee deleted (hefee)