ryanzidago

ryanzidago

How to change the `live_file_input`'s default text based on local?

How can I change the default’s live_file_input text based on a local provided as a URL param?

Right now the text is always in English, irrespective of the URL parameters (or even the browser’s language).

I guess I would have to rely on some JavaScript?

<div id="upload-audio-from-user-file-system" class="flex flex-col gap-2">
  <.label><%= gettext("Upload an audio file from your device") %></.label>
  <.live_file_input
    upload={@uploads.audio_from_user_file_system}
    phx-click="change_upload_type"
    phx-value-upload_type="from_user_file_system"
  />
</div>

First Post!

slouchpie

slouchpie

Have you tried specifying the lang html attribute?

e.g. for Spanish

<.live_file_input
  # your current attributes
  lang="es"
/>

Last Post!

ryanzidago

ryanzidago

Hey thanks for the reply, I didn’t know this attribute existed!

I’m not sure how to use it in this context. I have set the lang="es" and lang="it" but I still see the default English text.

Perplexity is telling me that I can use this attribute to change the default text.

Where Next?

Popular in Questions Top

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" =&gt; #BSON.ObjectId&lt;58eb1a7a9ad169198c3dXXXX&gt;, "email" =&gt; ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New

We're in Beta

About us Mission Statement