Jump to content

Problem with language-alternate fields in repeater


Fokke
 Share

Recommended Posts

Hi everyone!

My first post here. Long time reader though  :)

I'm using the latest dev build, and I have set up a small site with two languages: english (default) and finnish. Everything is running nice and  having multi-language page names and fields is a real time saver.

But... I have set up a repeater field called timeline, with one field (for now) attached to it. Field is called "title" and it's type is textlanguage. I created couple of rows into repeater and filled title for both languages. If I try to loop all rows using foreach, the english titles appear with no problem, but finnish titles are missing.

echo 'rows: ' . count($page->timeline);

The following line returns 4 in the english version of the site, but 0 in finnish.

Am I missing something here? :undecided:

Link to comment
Share on other sites

Welcome to the Forum Fokke.

The default language for the user (english) is being called, to echo the finnish version of those fields you will have to, either change the user language before $user->language = $languages->get("french"), or call the finnish fields directly echo $page->fieldname_finnish

Did you see this page? http://processwire.com/api/multi-language-support/multi-language-fields/

Sorry, if I'm assuming that you are doing everything wrong with my answer, but we have to start asking for the basic problems :)

  • Like 1
Link to comment
Share on other sites

Hello Diogo!

Yes I have done this, all multilingual fields are now working properly, except the repeater. Since I've got a little rush with this site, I'm going to use pages for those timeline blocks and try to figure out this repeater problem later. Sorry for bothering you. I'll be back when I get this fixed  : )

Link to comment
Share on other sites

... Field is called "title" ...

maybe it is a stupid question and it can be done with PW without worries, but I want to ask: can we call a field title, because every page/field in PW has already a title?

(I've thought title is the only mandatory field for all pages in PW)

EDIT:

have just tried it and when save the new field I got:

Field may not be named 'title' because it is already used by another field :)

As I have tried this with a singular language page and a simple Textfield, this may be other when trying to create a multilanguage text field. Maybe one DB-Table could be created and the other one not, - but the Errormessage wasn't shown to the user.

Just a thought, I'm PW-Newbie :)

EDIT2:

No, also with a multi language site I cannot save a field named title

Edited by horst
Link to comment
Share on other sites

Only mandatory field is name. Title can be removed. Hint globall settings.

This confuses me. I too always thought that Title is a mandatory field and that Name, although mandatory IS NOT a field? Looking at the PW db, i don't see Name as a field but as a column in the pages table.

Edit: OK, now I get the global settings bit...but, is Name considered a field?

Edited by kongondo
Link to comment
Share on other sites

OK, thanks for the clarification. So it is correct to say that Title is a custom field type and Name is a system field type?

That is how I would say it. Title is kind of "special" custom field, since it enabled by default for all templates. I have never removed it, even if it has been unnecessary few times. I love the fact that I always have $page->title which would give me something readable in every case.

  • 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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...