Jump to content


Photo

Translatable file list

translation multi-language

  • Please log in to reply
23 replies to this topic

#1 formmailer

formmailer

    Sr. Member

  • Members
  • PipPipPipPip
  • 245 posts
  • 29

  • LocationHudiksvall, Sweden (but originally from The Netherlands)

Posted 13 February 2012 - 08:09 AM

Ryan,

Is this list of translatable files still up-to-date?

Inputfield Modules
/wire/modules/Inputfield/InputfieldEmail.module
/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module
/wire/modules/Inputfield/InputfieldImage/InputfieldImage.module
/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelect.module
/wire/modules/Inputfield/InputfieldPageName/InputfieldPageName.module
/wire/modules/Inputfield/InputfieldPassword.module
/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module
/wire/modules/Inputfield/InputfieldTinyMCE/InputfieldTinyMCE.module
/wire/modules/Inputfield/InputfieldURL.module

Language Support Modules
/wire/modules/LanguageSupport/LanguageSupport.module
/wire/modules/LanguageSupport/ProcessLanguageTranslator.module

Process Modules
/wire/modules/Process/ProcessForgotPassword.module
/wire/modules/Process/ProcessLogin/ProcessLogin.module
/wire/modules/Process/ProcessPageAdd/ProcessPageAdd.module
/wire/modules/Process/ProcessPageClone.module
/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module
/wire/modules/Process/ProcessPageEditImageSelect/ProcessPageEditImageSelect.module
/wire/modules/Process/ProcessPageEditLink/ProcessPageEditLink.module
/wire/modules/Process/ProcessPageList/ProcessPageList.module
/wire/modules/Process/ProcessPageSearch/ProcessPageSearch.module
/wire/modules/Process/ProcessPageSort.module
/wire/modules/Process/ProcessPageType/ProcessPageType.module
/wire/modules/Process/ProcessProfile/ProcessProfile.module

Admin Theme
/wire/templates-admin/default.php


By the way, /wire/modules/LanguageSupport/ProcessLanguageTranslator.module doesn't seem to have translatable phrases.

//Jasper

#2 ryan

ryan

    Hero Member

  • Administrators
  • 5,980 posts
  • 3378

  • LocationAtlanta, GA

Posted 13 February 2012 - 03:32 PM

That's a good question, thank for asking. I've been meaning to post some updates to this. I've added the new files to the original list, below:

Core
/wire/core/Fieldtype.php

Inputfield Modules
/wire/modules/Inputfield/InputfieldEmail.module
/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module
/wire/modules/Inputfield/InputfieldImage/InputfieldImage.module
/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelect.module
/wire/modules/Inputfield/InputfieldPageName/InputfieldPageName.module
/wire/modules/Inputfield/InputfieldPassword.module
/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module
/wire/modules/Inputfield/InputfieldTinyMCE/InputfieldTinyMCE.module
/wire/modules/Inputfield/InputfieldURL.module
/wire/modules/Inputfield/InputfieldPageAutocomplete/InputfieldPageAutocomplete.module

Markup Modules
/wire/modules/Markup/MarkupPageFields.module

Language Support Modules
/wire/modules/LanguageSupport/LanguageSupport.module

Process Modules
/wire/modules/Process/ProcessForgotPassword.module
/wire/modules/Process/ProcessLogin/ProcessLogin.module
/wire/modules/Process/ProcessPageAdd/ProcessPageAdd.module
/wire/modules/Process/ProcessPageClone.module
/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module
/wire/modules/Process/ProcessPageEditImageSelect/ProcessPageEditImageSelect.module
/wire/modules/Process/ProcessPageEditLink/ProcessPageEditLink.module
/wire/modules/Process/ProcessPageList/ProcessPageList.module
/wire/modules/Process/ProcessPageSearch/ProcessPageSearch.module
/wire/modules/Process/ProcessPageSort.module
/wire/modules/Process/ProcessPageType/ProcessPageType.module
/wire/modules/Process/ProcessProfile/ProcessProfile.module
/wire/modules/Process/ProcessField/ProcessField.module
/wire/modules/Process/ProcessHome.module
/wire/modules/Process/ProcessList.module
/wire/modules/Process/ProcessModule/ProcessModule.module
/wire/modules/Process/ProcessPageTrash.module
/wire/modules/Process/ProcessPageView.module
/wire/modules/Process/ProcessPermission/ProcessPermission.module
/wire/modules/Process/ProcessRole/ProcessRole.module
/wire/modules/Process/ProcessTemplate/ProcessTemplate.module
/wire/modules/Process/ProcessUser/ProcessUser.module

Admin Theme
/wire/templates-admin/default.php


Note: I've removed ProcessLanguageTranslator, as I was incorrect about it having translatable phrases before. With a name like LanguageTranslator you'd think it would though? B)

#3 ryan

ryan

    Hero Member

  • Administrators
  • 5,980 posts
  • 3378

  • LocationAtlanta, GA

Posted 14 February 2012 - 10:31 AM

Attached is a ZIP containing the all those files if you'd rather drag in the zip or json files rather than paste in each of the names. These originated with my fake-Spanish translation, so several of the files have the Spanish translation, which you'll want to overwrite with your own translations.

Attached File  spanish.zip   20.71K   121 downloads

I will plan to keep the list above and this file up to date as new translated files are added.

#4 slkwrm

slkwrm

    Sr. Member

  • Members
  • PipPipPipPip
  • 279 posts
  • 101

Posted 15 February 2012 - 02:29 PM

Ryan, it would be great to be able to save all translation files by just a single click. Sometimes I forget what fields in what files I've changed and after a bunch of new edits I have to save each file manually, which is not too much fun :) I think everybody agree it would be handy.

Edit: also would be great to have an autodiscover function for translatable modules. So PW prompts you every time some module becomes translateable. Something like "Check for translatable modules" button would be great.

#5 ryan

ryan

    Hero Member

  • Administrators
  • 5,980 posts
  • 3378

  • LocationAtlanta, GA

Posted 15 February 2012 - 04:48 PM

I may be able to add a 'check for translatable modules' option that basically goes through your entire PW structure and performs text searches on any files ending with '.php' or '.module' and looks for the translation function calls. It would be kind of a heavy operation, so would have to be initiated rather than done automatically.

The way I currently locate translatable files is by typing this in at the unix command prompt:

grep "_(" /wire/*

As for downloading all the translation files in one shot, I agree about the convenience of it but think the only way we'll be able to do it is by zipping them up at the server side. Perhaps something we can do, but would require either exec()'ing to the shell and running 'zip' or using a PHP library that doesn't seem to be as widespread as I'd like. So for the short term, here's the best way to grab everything into one file:

1. Edit the language and note the ID in the address bar. We'll assume it's "1234" for this example.

2. Go into the directory (from shell or FTP) /site/assets/files/1234/

3. Copy all the .json files to a place where you can zip them up. If you are in the unix shell, you can do this:

cd /site/assets/files/1234/
zip language.zip *.json

If you aren't in the unix shell, then you'll have to SCP/FTP them to your computer and zip them up there.

#6 slkwrm

slkwrm

    Sr. Member

  • Members
  • PipPipPipPip
  • 279 posts
  • 101

Posted 15 February 2012 - 10:59 PM

Thanx, Ryan. I didn't realize all translations are stored in one foder. Wouldn't ask for this feature then :)
I also use file content search extensively (don't know why I didnt use it in this case :-[ ), but this "Check for translatable modules" would be really neat, especially for newcomers.

#7 slkwrm

slkwrm

    Sr. Member

  • Members
  • PipPipPipPip
  • 279 posts
  • 101

Posted 16 February 2012 - 03:26 AM

I have a problem with the end trimming of the translation string after I save a translation. It happend just ones for now. Here's the snapshot - the string shold be longer, it's not complete. And after I edited this field trying to re-save it, it just cleared totally and now I'm staring at a blank field and scratching my head ???

Update: after I made the translation string shorter it was saved just fine.

#8 ryan

ryan

    Hero Member

  • Administrators
  • 5,980 posts
  • 3378

  • LocationAtlanta, GA

Posted 16 February 2012 - 09:27 PM

Slkwrm, it looks like the default 'maxlen' setting for InputfieldText is 255 (bytes), and clearly that's not long enough. I'm updating it to a default of 1024 characters or 3072 bytes to better accommode the UTF-8 possibilities. Btw, this only applies to English phrases less than 128 characters, as all other phrases use InputfieldTextarea with no length limits. But of course, a Russian translation of a 100 character string could easily go beyond 255 bytes in UTF-8, so that's poor planning on my part. I'll have the increased lengths committed to the source shortly. Sorry for the inconvenience, but I'm glad we tracked this one down.

#9 slkwrm

slkwrm

    Sr. Member

  • Members
  • PipPipPipPip
  • 279 posts
  • 101

Posted 17 February 2012 - 07:29 AM

Thank you, Ryan!
Yes, russian symbols take more bytes, so it's good to have some spare ones. Just a thought. How cool it would be to see PW in Japanese or even Arabic. The last is RTL, so I guess it would take an extra effort to adapt user inerface to suit the text flow. And no, I don't know these languages :)
Btw, I have to say I find the process of translation pretty enjoyable in PW. Before I always associated it more with digging in a dozen of php files, where all that little bits of output were hardcoded.

#10 ryan

ryan

    Hero Member

  • Administrators
  • 5,980 posts
  • 3378

  • LocationAtlanta, GA

Posted 17 February 2012 - 11:53 PM

Thanks Slkwrm. I submitted an update earlier today that should fix any issues with the standard text field max length.

#11 Robert Zelník

Robert Zelník

    Full Member

  • Members
  • PipPipPip
  • 69 posts
  • 5

Posted 26 April 2012 - 03:12 AM

What about creating a wiki-section on ProcessWire.com to allow collective maintenance of this file list? Several time I thought it would be good to have a wiki also for users' contributions to the documentation and many other reasons.

#12 apeisa

apeisa

    Hero Member

  • Moderators
  • 2,586 posts
  • 905

  • LocationVihti, Finland

Posted 26 April 2012 - 08:55 AM

There is wiki talk going here http://processwire.c...1167-pw-manual/, although with different angle: for end users. I think it would be nice to have developer wiki at some point too. I think currently we can manage things like this pretty nicely using this forum.

#13 charliez

charliez

    Jr. Member

  • Members
  • PipPip
  • 45 posts
  • 7

  • LocationCuernavaca, Mexico

Posted 02 May 2012 - 01:14 PM

Where do we put up the translations?

Just open a thread and do it individually?
Carlos

#14 Soma

Soma

    Hero Member

  • Moderators
  • 3,396 posts
  • 1919

  • LocationSH, Switzerland

Posted 02 May 2012 - 01:18 PM

charliez, do you mean the board?

Here? http://processwire.c...language-packs/

@somartist | modules created | support me, flattr my work flattr.com


#15 ryan

ryan

    Hero Member

  • Administrators
  • 5,980 posts
  • 3378

  • LocationAtlanta, GA

Posted 03 May 2012 - 10:33 AM

Just open a thread and do it individually?


Always happy to hear about a new language pack! You are correct -- start a new thread with the subject like this example: "English (en-US)" in the forum Soma linked to. Let me know if I can be of any help.

#16 charliez

charliez

    Jr. Member

  • Members
  • PipPip
  • 45 posts
  • 7

  • LocationCuernavaca, Mexico

Posted 03 May 2012 - 05:22 PM

Thanks for the link soma, I will but it there...
is just a variation es-MX but could be use for some
Latin American countries too.
Carlos

#17 MadeMyDay

MadeMyDay

    Sr. Member

  • Members
  • PipPipPipPip
  • 140 posts
  • 126

Posted 04 May 2012 - 11:45 AM

Perhaps I misunderstood the whole concept, but: Is it correct that there is no (default) english source of the language files? So the package Ryan provided above is a starting point for translations that might change over time? Say I have a german translation for my site, I would take Nico's translations (thanks for that btw!) and add the missing phrases, but would not recognize if a whole language file is missing if I don't compare the package above by hand, correct?

If so, wouldn't it be better to keep a default language package (english) in the core distribution and not only check the missing phrases of (exisiting) individual files but also keep track of added (new) translation files?

#18 ryan

ryan

    Hero Member

  • Administrators
  • 5,980 posts
  • 3378

  • LocationAtlanta, GA

Posted 04 May 2012 - 01:43 PM

The source files themselves are in English, so the only time translation files are needed is if you want to change them (whether changing the language, or changing the English). I could maintain an English translation pack (with unpopulated fields), though it would be something that would only be useful as a starting point for other language packs. Still, if that would be helpful to other people, I'll be glad to do it.

#19 Soma

Soma

    Hero Member

  • Moderators
  • 3,396 posts
  • 1919

  • LocationSH, Switzerland

Posted 04 May 2012 - 01:47 PM

The source files themselves are in English, so the only time translation files are needed is if you want to change them (whether changing the language, or changing the English). I could maintain an English translation pack (with unpopulated fields), though it would be something that would only be useful as a starting point for other language packs. Still, if that would be helpful to other people, I'll be glad to do it.


That would be cool to have a "core" package as a default package containing all the files. When dealing with it, I thought it would be great to have an overview (list) of all the files that can be translated. What about a git repository?

@somartist | modules created | support me, flattr my work flattr.com


#20 Robert Zelník

Robert Zelník

    Full Member

  • Members
  • PipPipPip
  • 69 posts
  • 5

Posted 04 May 2012 - 02:56 PM

Maybe it would be easier to add some script to generate that file list on demand. In that case it would not be necessary to maintain the package manually.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users