Jump to content

Recommended Posts

Posted

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

Posted

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)

Posted

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.

spanish.zip

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

  • Like 1
Posted

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.

Posted

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.

Posted

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.

Posted

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.

Posted

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.

Posted

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.

  • Like 1
Posted

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

  • 2 months later...
Posted

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.

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

Posted

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.

Posted

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?

  • Like 1
Posted

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.

  • Like 1
Posted

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?

Posted

I think either is a good idea. But maintaining the files ready-to-translate is good just so that people don't have to click to add each of them manually. So I will plan to prepare that. Currently I locate the files with a grep command in the shell to find them all:

cd wire
grep -Rl '[>_][_nx](' * | uniq

It's not a 100% as it may include 1 or 2 things it doesn't need to, but should catch everything translatable.

core/Fieldtype.php

core/Inputfield.php

core/InputfieldWrapper.php

core/LanguageFunctions.php

core/SessionCSRF.php

core/Wire.php

modules/Fieldtype/FieldtypeComments/CommentForm.php

modules/Fieldtype/FieldtypeComments/CommentList.php

modules/Fieldtype/FieldtypeDatetime.module

modules/Fieldtype/FieldtypeFloat.module

modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module

modules/Fieldtype/FieldtypeRepeater/InputfieldRepeater.module

modules/Inputfield/InputfieldAsmSelect/InputfieldAsmSelect.module

modules/Inputfield/InputfieldButton.module

modules/Inputfield/InputfieldCheckbox.module

modules/Inputfield/InputfieldCheckboxes/InputfieldCheckboxes.module

modules/Inputfield/InputfieldDatetime/InputfieldDatetime.module

modules/Inputfield/InputfieldEmail.module

modules/Inputfield/InputfieldFieldset.module

modules/Inputfield/InputfieldFile/InputfieldFile.module

modules/Inputfield/InputfieldFloat.module

modules/Inputfield/InputfieldForm.module

modules/Inputfield/InputfieldHidden.module

modules/Inputfield/InputfieldImage/InputfieldImage.module

modules/Inputfield/InputfieldInteger.module

modules/Inputfield/InputfieldMarkup.module

modules/Inputfield/InputfieldName.module

modules/Inputfield/InputfieldPage/InputfieldPage.module

modules/Inputfield/InputfieldPageAutocomplete/InputfieldPageAutocomplete.module

modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelect.module

modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelectMultiple.module

modules/Inputfield/InputfieldPageName/InputfieldPageName.module

modules/Inputfield/InputfieldPageTitle/InputfieldPageTitle.module

modules/Inputfield/InputfieldPassword.module

modules/Inputfield/InputfieldRadios.module

modules/Inputfield/InputfieldSelect.module

modules/Inputfield/InputfieldSelectMultiple.module

modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module

modules/Inputfield/InputfieldText.module

modules/Inputfield/InputfieldTextarea.module

modules/Inputfield/InputfieldTinyMCE/InputfieldTinyMCE.module

modules/Inputfield/InputfieldURL.module

modules/Jquery/JqueryWireTabs/JqueryWireTabs.module

modules/LanguageSupport/LanguageParser.php

modules/LanguageSupport/LanguageSupport.module

modules/LanguageSupport/ProcessLanguage.module

modules/LanguageSupport/ProcessLanguageTranslator.module

modules/Markup/MarkupPageFields.module

modules/PageRender.module

modules/Process/ProcessField/ProcessField.module

modules/Process/ProcessForgotPassword.module

modules/Process/ProcessHome.module

modules/Process/ProcessList.module

modules/Process/ProcessLogin/ProcessLogin.module

modules/Process/ProcessModule/ProcessModule.module

modules/Process/ProcessPageAdd/ProcessPageAdd.module

modules/Process/ProcessPageClone.module

modules/Process/ProcessPageEdit/ProcessPageEdit.module

modules/Process/ProcessPageEditImageSelect/ProcessPageEditImageSelect.module

modules/Process/ProcessPageEditLink/ProcessPageEditLink.module

modules/Process/ProcessPageList/ProcessPageList.module

modules/Process/ProcessPageSearch/ProcessPageSearch.module

modules/Process/ProcessPageSort.module

modules/Process/ProcessPageTrash.module

modules/Process/ProcessPageType/ProcessPageType.module

modules/Process/ProcessPageView.module

modules/Process/ProcessPermission/ProcessPermission.module

modules/Process/ProcessProfile/ProcessProfile.module

modules/Process/ProcessRole/ProcessRole.module

modules/Process/ProcessTemplate/ProcessTemplate.module

modules/Process/ProcessUser/ProcessUser.module

modules/System/SystemUpdater/SystemUpdater.module

modules/Textformatter/TextformatterEntities.module

templates-admin/default.php

templates-admin/topnav.inc

  • Like 1
  • 9 months later...
Posted

It's a bit hard to work on existing translation files as long as there aren't any reference English translations available. I'm used to having a single language file for all the modules that come with the app. This makes it easy to take a diff whenever a core translation is added and add yours.

(By the way, I'd be glad to provide a Turkish translation asap, if I ever find the reference English translations)

Posted

The reference English translation is actually in the code itself. :) When you translate a file, it should pick up all the English, ready to be translated. I was maintaining a fake Spanish pack for awhile as a starting point set of files, but probably need to update that as there have been a few additions, though nothing major.

Posted

Try to find czech translation as i think its the most complete regarding files. But youd have to create your own just for knwing which are there. You could also use grep or file search to search for patterns of the __() and $this->_() functions.

  • Like 1
  • 3 years later...
Posted

As regards to language files translating strings from within my custom templates, what's the random string (key) inside a language JSON file? and where abouts do language files live?

I have an issue where by PW won't pickup all my templates that have __('text') as templates that can have translation files attached to them.

It's only picking up header.php, footer.php and home.php

about.php gets ignored for some reason :/

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
×
×
  • Create New...