Giter Site home page Giter Site logo

Localisation of panel names about wcdocker HOT 2 CLOSED

webcabin avatar webcabin commented on August 16, 2024
Localisation of panel names

from wcdocker.

Comments (2)

Lochemage avatar Lochemage commented on August 16, 2024

Dave,

First off, I appreciate that you chose to give wcDocker a try!

The panel titles and ID's are actually separate. It's just that when I
initialize a panel by default, I take the ID you gave it and graft it to
the title as well. Inside the create function of a panel, though, you can
change the title with myPanel.title("some new title"), which will not
effect the ID.

So, ideally, you would not localize the registered name of each panel
(their ID), you would only localize the title that appears once a panel is
created.

Unfortunately, that does not fix the fact that you still see the ID text in
the popup menu when right clicking to create new panels. To fix that, I
have just updated the code to allow you to specify the displayed title text
for the panel when registering it. This title text is independent of the
panel id, so you should be able to localize it. Your code should look like
this:

myDocker.registerPanelType('panelId', {
title: 'LocalizedTitle',
onCreate: function(...
});

Any time you change the language, you would need to change the title option
for each panel type and then save and restore the layout to refresh all
existing panels with their new titles.

myDocker.panelTypeInfo('panelId').title = 'newLocalizedTitle';

I hope this helps you out, let me know if you have any other suggestions.

  • Lochemage

On Fri, Feb 27, 2015 at 7:33 AM, Dave Page [email protected] wrote:

My app uses the Python Flask framework on the backend, with Flask-Babel to
provide localisation for the Python code and HTML/JS. I cannot seem to
figure out a reliable way of localising panel titles however, largely due
to the fact that they're stored in the panel layout and thus get restored
along with the layout when a user re-runs the app. That's fine if they're
using the same language as before, but not if they've switched (perhaps
because they're using a different browser).

It seems to me that an ID should be used when registering panels and when
saving/restoring the layout, so that I can re-assign the panel titles in
the correct language to the appropriate panels based on the ID. The ID
would then be stored in the layout data and be the primary identifier for
the panels, thus allowing the titles to be arbitrarily changed.

Is there a way to achieve this that I'm missing?


Reply to this email directly or view it on GitHub
#26.

from wcdocker.

dpage avatar dpage commented on August 16, 2024

That seems to work nicely - many thanks!

from wcdocker.

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.