Code Monkey home page Code Monkey logo

Comments (6)

alonbl avatar alonbl commented on June 3, 2024

I would like to be able multiple languages, so please support lists.

I will use whatever mechanism you apply, but please support multiple option for each atom.

from jslogo.

alonbl avatar alonbl commented on June 3, 2024

See [1] for temporary usage.

[1] https://github.com/alonbl/jslogo/blob/36a988523b273a1e5ef86cd522e182e731bce861/translation.he.js

from jslogo.

inexorabletash avatar inexorabletash commented on June 3, 2024

The translation function in your example makes complete sense and is what I was expecting.

Can you give me an example of "multiple option for each atom" ? I think I'm misunderstanding.

from jslogo.

alonbl avatar alonbl commented on June 3, 2024

let's first begin with command aliases.

what I had in mind are the following changes:

  1. modify the "Procedures and Flow Control" section, each def() will have only one name, which probably be the long most complete one.
  2. add defAliases(name, aliases) method, or even better if you like metadata programming have it as defAlias(aliases) which is dictionary of lists.
  3. call defAliases at constructor to register language aliases.
  4. at localization it is possible to call defAliases to register even more, without modifying the core.
logo.defAliases({
    "command1": ["alias11", "alias12"],
    "command2": ["alias21", "alias22"]
});

from jslogo.

inexorabletash avatar inexorabletash commented on June 3, 2024

So we're talking about several different things here:

  • Localizations on output; this is what the __() function hook would do.
  • Procedure aliases. There's no need for the API to support lists, you can just have multiple mappings. Under the hood this can just do the same thing as copydef. In your example:
copydef "alias11 "command1
copydef "alias12 "command1
copydef "alias21 "command2
copydef "alias22 "command2

I'm not opposed to exposing e.g. copydef() on the interpreter object that does this.

Color names (which are HTML constants, not anything associated with Logo) can be handled at the turtle level, e.g. a translation function called whenever canvas_ctx.fillStyle or canvas_ctx.strokeStyle is being set.

Are there other inputs or outputs that need handling?

from jslogo.

inexorabletash avatar inexorabletash commented on June 3, 2024

The plumbing should be in place for these now. Let me know if these make sense.

from jslogo.

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.