This method is absolutely feasible

Translation project: github.com/foyoux/Inst…

Results the preview

The installationdocts

pip install docts
Copy the code

or

pip install docts -i https://pypi.org/simple
Copy the code

Add the –upgrade parameter if necessary

Installing the Localization ToolSisulizer

For details, see the DocTS project: github.com/foyoux/doct…

It will not be repeated here.

Prepare achmHelp document file

Take the Sisulizer help document here as an example

Translation steps

1. NewSisulizerThe project,Sisulizer.chmAdd file

2. Save the project, then inSisulizerTo export the extracted words toxlffile

Use 3.doctsTranslate and export

Docts provides a default shortcut translation function todo

def todo(path: str) :

    doc = Doc(path)
    
    doc.add_filter(filter_eq_symbol)
    
    doc.add_filter(filter_not_str)

    return doc.save_words()
Copy the code

Give it a try

from docts import *

xlf_path = r"H:\docts-demo\Sisulizer.xlf"

todo(xlf_path)
Copy the code

In the actual translation process, it is impossible to have a general translation method, for different documents, we may have some do not want to translate, docTS provides some methods for filtering, mapping and replacement

  • add_filter
  • add_contain_filter
  • add_start_filter
  • add_end_filter
  • add_map
  • add_replace

For details, see the DocTS project: github.com/foyoux/doct…

In 4.SisulizerImport translation completedxlffile

In 5.SisulizerTo create a translation object file

6. Complete