Jump to content

Progress on ProcessWire 2.2 and overview of multi-language support


ryan
 Share

Recommended Posts

Me too :-D Confusingly it seems that JA is used by NATO for "Japan" but also by ISO for "Japanese." Furthermore, I can't find any other countries with JA as a country code. And Ainu is usually AIN. Sigh, major derail here, sorry.

Link to comment
Share on other sites

  • 2 weeks later...

I was wondering if anyone would be interested in helping me test an early version of the multi language features in the admin? (Antti? :))

While the system is not done, most of the fundamentals are there and I believe it's ready for some testing. However, it's not ready to use in any kind of production environment, and you won't want to start building a new site with it. Instead, if you test it, you'll want to use a completely blank copy of ProcessWire and not use it for anything other than testing.

Currently the translation functions are in place. You can translate many (though not yet all) of ProcessWire's core modules. You can also enter labels/descriptions for Fields or Templates in multiple languages. Multi language support with your own field values (as discussed earlier in the thread) is not yet in place. I have it working locally, but feel I need more work on that part first. I also think that part is not nearly as useful as this part, so figured I'd focus on making this first part as good as possible first, and then go back to the multi language field values.

How to install


The alpha version of ProcessWire 2.2 is available as the 'dev' branch on GitHub. To be safe, don't switch any existing site to the dev branch, instead start with a brand new installation of ProcessWire. To install from GitHub, type this:

git clone git://github.com/ryancramerdesign/P21.git
git checkout dev

The only difference between this and how you'd install any other time is just the 'git checkout dev'. That makes it switch to the development (PW22) branch. (Note that it will still say it's PW 2.1, don't worry about that). Now go ahead and install ProcessWire as usual by pointing your browser to it.

Once installed, go to Modules > Language Support > Install. Make sure that 'English' is checked as the default language and click Submit.

Note: Stick to using the default admin theme. There are components of the theme that need to be multi-language ready, and PW's default admin theme is the only one ready for this at present.

How to use


1. Your Setup menu will now have a Languages option. Click to that and note that English is the only installed language at present.

2. To start, we're going to add Spanish as a langauge. Click Add New. Enter "es-es" as the name (or something else if you prefer), and click Save.

3. Enter "Español" (or if you prefer: "Spanish") for the title.

4. Attached to this post is a ZIP file of language translation files for Spanish. If your installation supports ZIP uploads, just drag the ZIP file into the Language Translation Files field. If not, unzip that file and drag them all into the field. Then hit Save.

5. Click the Profile link at the bottom and change your Language to Español. Your admin should now be in Spanish.

Note: Not all modules are translated. I've focused the effort on making the Page-related modules translatable (i.e. the ones your clients might use). Nothing under Setup, Modules or Access is translatable at present.

When you go to edit a page, you may notice that all the field labels are still in English. Read below to see how to change those:

How to translate field labels and descriptions


All fields in ProcessWire are custom fields, so a pre-defined translation isn't going to know what fields you have in your system or what translation they should have. So that's something that is left up to the individual installation. Lets say that you wanted to provide a Spanish translation for the "Title" field, here's how you'd do it:

1. Go to Setup > Fields > and edit the title field.

2. Note that you now have English and Spanish labels available. You also have English and Spanish descriptions available. Enter "Título" for the Spanish label and hit Save.

3. Repeat for any other fields that you want. When you edit a page using that field, you should see the label and description in the language you've chosen in your user profile.

How to change your default system language


Lets say that you want the system to assume Spanish by default. That would mean that Spanish would be assumed before a user was even logged in (and the login form would display in Spanish). Here's how you'd do that:

1. Go to Modules > Language > Language Support.

2. Click the Spanish radio button, and click Save.

3. Spanish is now assumed bo the default system language. When a user sees the login form, it will be in Spanish.

How to add another language


1. Click to Setup > Languages > Add New

2. Enter a name for your language. I recommend using a language code those discussed earlier in the thread (like no-NO or fi-FI). Click Save.

3. On the next screen, enter a title for your language, preferably in the language-native (non-English) spelling.

4. For the Language Translation Files, you can choose to translate them individually or upload a bunch of other translation files and edit them (this is easier). Both options are described below:

  • To perform an individual module translation, click new in the files field. Then enter the path to the file you want to translate. For example, to translate ProcessPageEdit, you'd enter: /wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module and click Submit. On the next screen it would show you all the translatable phrases it found.
  • To build a translation from existing files, just upload the files for another language's translation to the files field. You might want to use the attached ZIP (for Spanish) as your starting point. Then click edit for each file, delete the Spanish translations and change them to your language's translations.

5. If you need to support more than one language on your site's admin, then you'll want to translate field and template labels as well. These are site-specific, and located under Setup > Fields > any-field, and Setup > Templates > any-template.

How to share your language translation


Download all of the JSON files for your translation and ZIP them up. To download, just click on the translation filename in ProcessWire. If your browser renders the JSON file, then you may have to right-click then 'Save File'. Place them all in a ZIP and upload here. Once PW22 is final, we'll be providing language translation downloads on the main site.

You can change ProcessWire's English output too


You can change the default/English output in ProcessWire just by adding translations to the English language already in the system. If you only need to change one thing, that's okay. Just change what you want, and leave everything else blank. You can have as many, or as few translation files as necessary. But if you only need to translate a phrase from 1 module, then only keep a JSON file for that one module in your Language Translation Files.

What's not here, but still coming


  • Multilanguage text-fields as described earlier in the thread.
  • Date field localization
  • Still making more modules multi-language ready
  • setlocale() support.
  • Other tweaks…

Disclaimer 1: Just to repeat from above, don't use this for production work. Stuff may still change, and I don't want anyone's site to get messed up due to this being a work in progress.

Disclaimer 2: I don't know Spanish – I just used Google Translate for the Spanish translations. If you speak Spanish, I'm guessing some (or most?) of these won't read quite right. :)

Disclaimer 3: I'm one of the only people here that isn't multi-lingual. If I've missed something obvious please tell me (just go easy on me). :) I appreciate all of your feedback.

ProcessWire-Language-Spanish.zip

Link to comment
Share on other sites

I was wondering if anyone would be interested in helping me test an early version of the multi language features in the admin? (Antti? :))

Yes I will. I have been super busy at work (and will be for the end of the year). Part of my plan is to have Finnish translation in place also this year. Just to be 100% sure: although this is alpha, translations that are done now will work in master release also?

I will test this this week or latest next. Thanks for working on this Ryan!

Link to comment
Share on other sites

Just to be 100% sure: although this is alpha, translations that are done now will work in master release also?

That's correct. What will be changing is that more modules will be added (more things to translate). But we have 20 translation files already, so enough to keep busy. :)

I recommend saving a copy of your JSON files as a backup after you've completed each file translation. Just as a safety measure until this thing has had some use. Either that, or do your translations in a separate text editor and paste them into PW's translation entry fields. I'd hate to think of someone spending half an hour translating some stuff and then hitting Save at the end and being told they need to login.

Now we have two "Languages" setup ... Olivers multilanguage module.

The two are very different and probably compliment each other well. However, they may conflict with one another in the short term (for instance, I noticed Oliver's module installs a Languages section in Setup as well). So don't run them together just yet. But I imagine some cool possibilities down the road having the PW 2.2 language support and Oliver's module running together at the same time.

Link to comment
Share on other sites

Looks like I missed that headline on the Search page. Just added it to the latest commit. Once you've pulled in that commit, go to Setup > Languages > German and click the 'edit' link for the file for the ProcessPageSearch module, and you should see it there. Thanks for finding that and please let me know if you come across any more.

Link to comment
Share on other sites

This is great Nico! That was fast. Thanks for posting this. I just created German in my dev copy, dragged in your ZIP file and now I'm running PW in German! If only I could read it. :) It looks like it works great.

Congrats–You are the first person to do a real translation for ProcessWire! How did you like using it? Any highlights or concerns?

Thanks,

Ryan

Link to comment
Share on other sites

Well it's quite easy to create translations in ProcessWire. That's great! But one thing I would like to have is the possibility to add something like "if loops". What I mean is that I can translate something like "5 Pages were found" but what's with "1 Page was found"?

And what I need is a compatibility between this and Oliver's Language module...

But it's great for a beta release ;)

Link to comment
Share on other sites

But one thing I would like to have is the possibility to add something like "if loops". What I mean is that I can translate something like "5 Pages were found" but what's with "1 Page was found"?

Thanks for the feedback and testing! I'm not sure I understand "if loops", but your example makes me think you are talking about plural alternates? (like this: http://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals)

I had planned on adding those as soon as the need came up, but it hasn't yet. I don't know if it's just the way I've written it or if it's coincidence, but I've not come across any translation situations in PW where plurals would be applicable. Though I could certainly be missing something: let me know if you've found an example of one. I'm sure it'll come up eventually whether in PW itself or a module, so it's definitely coming. But I just wanted to find a place where it would be used before adding it. :)

Link to comment
Share on other sites

Thanks ggtr1138--that's great!! I look forward to trying this in the morning. Even though I don't speak the language I still love using PW with these language packs. :) it makes me very happy to see it running in other languages. Also, I'm glad to hear you guys like the built-in translation functions so far.

Link to comment
Share on other sites

Hi, guys. I need your help. I installed the module, added a new language and imported Spanish translation (drug'n'dropped multiple json files), but after I switched to Spanish in Profile nothing happened, everything is still in English.

Link to comment
Share on other sites

Did you installed the last PW dev branch from Github as Ryan suggested ? Yesterday I had the same symptom, but I wasn't using the good branch. I think Ryan missed a command in his procedure, this is what worked for me :

git clone git://github.com/ryancramerdesign/P21.git
cd P21
git checkout dev

Note the "cd P21", you have to be in the P21 folder for the "git checkout dev" command to function properly.

Link to comment
Share on other sites

Why is:

.PageList .PageListNumChildren, .PageListItemOpen span.PageListNote, .PageListSorting .PageListSortItem span.PageListMoveNote {

font-size: 0.9166em;

padding-left: 0.25em;

text-transform: lowercase;

}

?

I need uppercased letters in this string (in the string next to the trash)...

Link to comment
Share on other sites

@GGTR1138 Yes, I switched branch to dev. I'm a n00b as a Git user though, so maybe still doing something wrong. Can the possible cause be that I'm using XAMPP on Windows. Are there any Windows/XAMPP guys out there? Does everything work well for you?

Link to comment
Share on other sites

I've added support for plurals and it works exactly as described here:

http://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals

I've also added support for disambiguation by context, as described here:

http://codex.wordpress.org/I18n_for_WordPress_Developers#Disambiguation_by_context

At this point, our translation API is identical to that of WordPress both in function calls and arguments, so the WordPress i18n documentation is largely applicable to ProcessWire too. But WordPress relies on GetText and doesn't have built-in translation tools in the admin like we have, so I think we've got a much better system than they do for multi language support.

To get the latest version, just 'git pull' it in.

The only place where we needed plurals and contexts in the existing translated modules was in that ProcessPageSearch module. So if you access the translation screen for that module/file, you'll see a few of your translations listed as 'abandoned translations' and new inputs for the parts where we added plurals and contexts. Sorry to leave a few translations for you guys to redo in that module. I don't think we'll have to do this anywhere else.

I'm thrilled that we've already got 3 new languages going in ProcessWire! Thank you all for your great work here!

Nikola–thanks for the Croatian translation! It works great in my testing.

Nico–the latest commit removes that text-transform: lowercase. I'm not sure why I had that there, but it's gone now.

Slkwrm–It sounds like you have the LanguageSupport module installed and running, so I don't think it's a Git problem, and it sounds like you are on the right branch. I'm thinking it's more likely a file problem. Can you post a screenshot of your Spanish language screen with the list of translation files? That will help me to determine if it's a file issue.

Thanks,

Ryan

Link to comment
Share on other sites

Thanks for posting sklwrm, but unfortunately it doesn't look like that's it. Everything looks fine there.

If you click on 'edit' for one of the language files, do you see the translations there, or are they all blank?

If you click the 'profile' button at the bottom, does it show Spanish as the currently selected language?

Link to comment
Share on other sites

@Ryan.

Yes, translations are in the place and I have Spanish chosen in Profile. How can I check that I use correct branch? Because although I switched, I used Git for Windows, but I heard it's buggy. Is there any other way to download the dev version?

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