Code Monkey home page Code Monkey logo

Comments (13)

harikt avatar harikt commented on June 18, 2024

@cordoval @pmjones any thoughts on this?

What I was thinking was getParams or getTokens . Paul was having an idea of using the rule itself back in the filter.

Thoughts ?

from aura.filter.

harikt avatar harikt commented on June 18, 2024

Closing for a different approach is being used.

from aura.filter.

harikt avatar harikt commented on June 18, 2024

Hi Paul,

I don't know whether I am throwing something before the complete implementation. But I would like to ask a question .

I feel when we are using something like FILTER_SOMETHING it is easy for people to make use of translate $this->translate('FILTER_SOMETHING') . In some cases we may need more stuffs like the minimum length, maximum, between etc. In that case it would be good to also get these token values so it can be passed as $this->translate('FILTER_SOMETHING', $params) .

If it is just string like field should have validated as strlenMin(6) things may be hard to translate I assume. Your thoughts ?

Apart from that the reorg branch seems nice.

Thank you

from aura.filter.

pmjones avatar pmjones commented on June 18, 2024

Fair question!

First, the "strlen(6)" thing is a default message only, and is intended to be overridden with a custom message. You provide a custom message by specifying the rule mode, e.g. ->asSoftRule("Please enter a valid email address.").

For translation, you could enter "FILTER_SOMETHING" as the message, and then pass it through a translator at output time, but it still doesn't get you the filter arguments, like 6 as in strlenMin(6).

To support translations with interpolated argument values, I can see where we would have to change the getMessages() return format so that it returns both the string message and the filter arguments. Let me think about that one a little bit.

from aura.filter.

harikt avatar harikt commented on June 18, 2024

@pmjones this was what I did earlier https://github.com/auraphp/Aura.Filter/pull/53/files . But as things are changed it need a bit different ways though .

from aura.filter.

pmjones avatar pmjones commented on June 18, 2024

I think we're getting closer to a final implementation here. Do you think this issue is still important, or is it something we can let go?

from aura.filter.

harikt avatar harikt commented on June 18, 2024

Hi @pmjones ,

I think this issue is a bit important when you want to deal with translation.

What I thought was keeping something like having a constant values and use some getTokens or something to get the tokens. The user can later use a translator like Aura.Intl or other ones which does the conversion.

from aura.filter.

pmjones avatar pmjones commented on June 18, 2024

@harikt I blame you: #84

from aura.filter.

harikt avatar harikt commented on June 18, 2024

Thank you @pmjones . Looks good 👍 .

from aura.filter.

harikt avatar harikt commented on June 18, 2024

By the way @pmjones in case if you have not forgotten https://groups.google.com/d/msg/auraphp/dVpSOV6RnM4/BZLPpYzMoDQJ before a beta release good to have common interface, so it can communicate with Aura.Input also ?

from aura.filter.

pmjones avatar pmjones commented on June 18, 2024

Closed by #84 .

from aura.filter.

pmjones avatar pmjones commented on June 18, 2024

@harikt The rules for Aura 1.x packages are such that they cannot depend on external packages, which means even if there was an interface package, Aura.Input 1.x could not depend on it. At the worst, though, there could be a "bridge" interface between the two in yet another package.

from aura.filter.

harikt avatar harikt commented on June 18, 2024

@pmjones As Aura.Filter is v2, we can bring an interface to 2.0 . And later the 1.0 package can be bumped to 2.0 to use the same interface package. No other changes for Aura.Input .

from aura.filter.

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.