Jump to content

Recommended Posts

I've posted a question in another forum thread, because I initially didn't want to create a new forum thread for this. Since there were no replies, I'm trying it here.

I'd like to set input field labels for each language via API. I have approx. 50 input fields and four languages. Doing it "manually", i.e. via GUI, would take ages, as you can imagine.

Is there an API method I can use? a) get/define field, b) set language-specific field label

To clarify: This is not meant to run inside a template, but just once, i.e.

// Bootstrap ProcessWire
include('./index.php');

// Assign API variables to make things a little easier
$fields = wire("fields");
$templates = wire("templates");

etc.

Link to comment
Share on other sites

Sorry you didn't get any responses there, but time is limited ;)

One way is set user language to the one you want to set the label. Or using the language id to append to "label{LID}"

$f = wire("fields")->get("mytextfield");
$lang = wire("languages")->get("de")->id;
$f->set("label{$lang}","Mein Textfeld");
$f->save();
 
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...