Giter VIP home page Giter VIP logo

Comments (9)

hamiltoncj avatar hamiltoncj commented on May 30, 2024

I've known that at some point I would need to do this so thank you for your suggestion. I will look into how to do this and will provide it for the next release. If you have any further guidance please let me know.

from qgis-shapetools-plugin.

hamiltoncj avatar hamiltoncj commented on May 30, 2024

@wsk170
I'm not 100% sure I have everything correct, but there is an i18n directory with the en.ts file. I don't know how this all works especially when changes are made to the code, but you are welcome to give suggestions and prepare a translation.

from qgis-shapetools-plugin.

wsk170 avatar wsk170 commented on May 30, 2024

@hamiltoncj Thank you!And I did some research for PyQt translation and refer other QGIS plugin.
First, modify tr function's "Processing" to "@default", because context name in ts file is "@default".
Second, add the following code to class ShapeTools init method to load translation file.

# initialize plugin directory
self.plugin_dir = os.path.dirname(__file__)
# initialize locale
locale = QSettings().value('locale/userLocale')[0:2]
locale_path = os.path.join(
    self.plugin_dir,
    'i18n',
    'shapeTools_{}.qm'.format(locale))

if os.path.exists(locale_path):
    self.translator = QTranslator()
    self.translator.load(locale_path)
    if qVersion() > '4.3.3':
        QCoreApplication.installTranslator(self.translator)

I try this method, and get the translation. yes, it's chinese. and when I finish translation, i will push to github.
image

from qgis-shapetools-plugin.

wsk170 avatar wsk170 commented on May 30, 2024

@hamiltoncj I have finished the chinese translation, and make a pull request. waiting for you merge it.

from qgis-shapetools-plugin.

hamiltoncj avatar hamiltoncj commented on May 30, 2024

@wsk170
I have made a number of updates. Can you check to make sure it works properly for you and if it does I will push out a new release.

Thanks!

from qgis-shapetools-plugin.

wsk170 avatar wsk170 commented on May 30, 2024

@hamiltoncj I try it, and create a pull to load the right translation. you could merge it.

from qgis-shapetools-plugin.

hamiltoncj avatar hamiltoncj commented on May 30, 2024

I did the merge. Does it work correctly now?

from qgis-shapetools-plugin.

wsk170 avatar wsk170 commented on May 30, 2024

Yes, it worked correctly. Thank your for your great work.

from qgis-shapetools-plugin.

hamiltoncj avatar hamiltoncj commented on May 30, 2024

Thank you with helping to set up translation in Shape Tools.

from qgis-shapetools-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.