Jump to content

Simple multilingual portfolio


desgnl
 Share

Recommended Posts

Hello processwire users 

i am new here. I used to do my sites with wordpress, but i read many good things about processwire and i would like to give it a try on a small project. I'd like to do a simple multilingual portfolio with a blog.

I read a few tutorials and watch a few videos already. From what i understand there are many ways of using processwire to achieve this project. I would like to explain the website details so you could indicate me the right way to do it and the good modules to use. 

I already did the html / css / js for the front end. 

it is in 3 languages : english (en), spanish (es), french (fr)

it uses 2 templates : project list, project page. 

1. the project page contains the following informations : 

  • title
  • description text
  • date 
  • category
  • tags
  • photos (not translated)
  • embeded content from the web (same for every language)

the blog posts behave like projects posts. One category would just be named "blog". 

the url are like this : www.urlofthesite.com/language_code/date/project

2. the project list is used for homepage, categories page, tags pages

the url are like this :

homepage : www.urlofthesite.com/language_code/

www.urlofthesite.com/language_code/category_name/

www.urlofthesite.com/language_code/tag_name/

translations

all the fields are translated except photos and medias. 

i would like to be able to translate tags and categories from one place and then assign them once to a project (and not re-type them in every translations) 

I would appreciate any advice or more about the best way to do a project like this.

especially concerning the modules to use and the way to handle the translations. 

thank you 

Link to comment
Share on other sites

Not sure if this will be the best idea ever (just getting started with PW too), but maybe you can simply add a "Page" field to the project template (single page selection will do just fine)? If a page is selected, just replace any empty field on the current page with the selected page's field. This way you can decide per page what you want to translate and what can be taken from the original page.

Link to comment
Share on other sites

I don't build a lot of multi-language sites, so some others here may have better suggestions than me. But in your case I would probably build separate trees for each language. Then have some code at the top of your shared template file that sets the language consistent with the branch:

if($page->rootParent->name == 'en') $user->language = $languages->get('en'); 
  else if($page->rootParent->name == 'es') $user->language = $languages->get('es');
  else if($page->rootParent->name == 'fr') $user->language = $languages->get('fr');

or better yet, if we can assume your language names and rootParent names will be the same, you could do this:

$language = $languages->get($page->rootParent->name); 
if($language->id) $user->language = $language; 

For your categories, you would want to use a Page reference field. Add a text field to the category template that uses the TextLanguage field type. (You'll have to install the LanguageSupportFields module for this). Then every time you add a category, you'll have inputs for each of your languages. When the front-end of your site outputs this field, it'll pull from the correct language automatically. 

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...