Skip to content
Snippets Groups Projects
Select Git revision
  • durt-stuff
  • master default protected
  • polkadart-stuff
  • dev
  • provider-to-riverpod
  • implementLightnode
  • subscribesSplit
  • hugo_RML16
  • refactorOnboardingSlideshow
  • duniterV1Latest
  • scanNetwork
  • dubp_rs
  • v0.1.28+109
  • v0.1.27+108
  • v0.1.26+107
  • v0.1.25+106
  • v0.1.25+105
  • v0.1.24+102
  • v0.1.23+101
  • v0.1.22+100
  • v0.1.22+99
  • v0.1.21+98
  • v0.1.21+97
  • v0.1.21+96
  • v0.1.21+95
  • v0.1.21+94
  • v0.1.21+93
  • v0.1.20+92
  • v0.1.19+91
  • v0.1.18+90
  • v0.1.17+89
  • v0.1.16+88
32 results

myWallets.dart

Blame
  • gen_translations.py NaN GiB
    import sys, os, multiprocessing, subprocess, time, shutil
    
    gen_resources = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))
    ts = os.path.abspath(os.path.join(os.path.dirname(__file__), 'res', 'i18n', 'ts'))
    qm = os.path.abspath(os.path.join(os.path.dirname(__file__), 'res', 'i18n', 'qm'))
    if not os.path.exists(qm):
        os.mkdir(qm)
    
    translations = []
    qm_files = []
    qm_shortnames = []
    
    
    def prepare_qm():
        for root, dirs, files in os.walk(ts):
            for f in files:
                if f.endswith('.ts'):
                    tsfilename = os.path.join(root, f)
                    qmshort = "{0}qm".format(f[:-2])
                    qmfilename = os.path.join(qm, qmshort)
                    srcdest = (tsfilename, qmfilename)
                    translations.append(srcdest)
                    qm_shortnames.append(qmshort)
                else:
                    continue
                print(os.path.join(root, f))
    
        for (ts_file, qm_file) in translations:
            # avoid conflict with qt4 lrelease by running qtchooser directly
            if sys.platform.startswith('win') or shutil.which("qtchooser") == None:
                subprocess.call(["lrelease", ts_file, "-qm", qm_file])
            else:
                subprocess.call(["qtchooser", "-run-tool=lrelease", "-qt=5", ts_file, "-qm", qm_file])
            print(ts_file + " >> " + qm_file)
    
    
    def build_resources():
        files = ""
        for file in qm_shortnames:
            files += """
    <file alias="{0}">qm/{0}.qm</file>""".format(file[:-3])
        rccfile = """<RCC>
          <qresource prefix="i18n">{0}
          </qresource>
        </RCC>
        """.format(files)
        print(rccfile)
    
        qrc_filename = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                                    'res',
                                                    'i18n',
                                                    'langs-{0}.qrc'.format(int(time.time()))
                                                    ))
    
        pyc_filename = os.path.abspath(os.path.join(gen_resources, 'i18n_rc.py'))
        with open(qrc_filename, 'w') as outfile:
            outfile.write(rccfile)
    
        try:
            subprocess.call(["pyrcc5", "-o", pyc_filename, qrc_filename])
            print(qrc_filename + " >> " + pyc_filename)
        finally:
            os.remove(qrc_filename)
    
    
    prepare_qm()
    build_resources()