Support forums : The Future

translations

The future of this project but not in a "I want a pony" sort of way. This is all about everything meta about Quam Plures. The general direction, the support tools, stuff like that.

Moderator: Dracones

translations

Postby EdB » Thu Feb 21, 2013 2:27 pm

viewtopic.php?p=9184#p9184
Kimberly wrote:For eight months now I have been immersed in creating a social network. In the app I use, language translations are handled by key-text pairs stored in a language file; English; en.php, Russian, ru.php; and so on. New key pairs can be added by modules (widgets or plugins) or by the end user in the admin section. One can simply set the base language in the backend and front-end users can switch languages either manually or you can detect by IP address (this is done using a module and not the core). Languages get compiled into the system from the language file.

Translations are always complicated by the order thing: installation, blog, item. BUT we can do something here I think. I'm leaning on letting core do it the way we do - with the T_('text') function. Currently our core doesn't include plugins and templates, so perhaps both of those should go to the "no english in the code" model described above?

In both cases, the logic gets confusing in my head. Do we have one file at root level and maybe another inside the plugin or template? For templates they share a lot of text, but generally plugins do not. So do we do an array_merge to make a higher level array of strings, or do we have to say "check the core level else check the local level"?

I think it'll make more localization of the public side stuff easier to come by because translators won't have to use poedit to make it happen, so to me it's probably a good idea.
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: translations

Postby leeturner » Fri Feb 22, 2013 12:06 am

I don't have a problem with it.....

..... other than having to update my plugins :P
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: translations

Postby EdB » Fri Feb 22, 2013 7:44 am

Looking at it the other way, or something like that, here's what I was kinda working on.

Create a file called something like _common_template_strings.php and put it in the /qp_templates/ folder. In it we have common template strings. By being in the main folder it becomes part of core, which means it becomes part of core's translatable bits, which means translations of those bits become available to any template author. Plus it lets template designers know what strings might already be translated, which might encourage them to use those strings. Very common stuff, which is easy to find using the .bat file I use to create .po files for plugins and templates. BTW the same does not hold true for plugins. Plugins generally have their own strings that are not shared across other plugins.

Anyway I dunno which is best. Keep it the way it is and find a way to make it easier for future authors, or try a new way and hope that it encourages translations. OR, keep it the way it is because we kinda know we're not really getting a ton of translation support so why put the effort into something unused ....
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: translations

Postby leeturner » Fri Feb 22, 2013 10:35 am

EdB wrote:Anyway I dunno which is best. Keep it the way it is and find a way to make it easier for future authors, or try a new way and hope that it encourages translations. OR, keep it the way it is because we kinda know we're not really getting a ton of translation support so why put the effort into something unused ....


Part of me thinks that we are currently the only plugin authors and there are probably plenty of other things to be looking at that would benefit end users (permissions etc) rather than working on things that only benefit a couple of plugin authors.

There is something to be said for consistency between the core and the plugins but to be honest I am not too fussed either way.

L
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: translations

Postby Kimberly » Sun Feb 24, 2013 7:52 pm

I need to look at Dolphin language a bit closer. The way Boonex (http://boonex.com/) does their their language seems to work really well. It appears to be easy for one to switch languages from the front end and you can set a default language for the site from the admin side of things. They use key-value pairs. One person showed how to make a quick language translation using google's translator. The language files get compiled; I assumed into the database. Module writers, or in our case plugins, include a language file that is compiled as well at the time one installs the module. Module writers can include other languages files as well which will get compiled in. If one decides to add a translation to a module, they simply add it to the module's language directory and then go into the backend/admin and recompile the language for that module. Now if I want to change the text for a particular language key, the backend has a way to do that. I simply bring up the key for that key-value pair and make the changes. Let's say that a language key-pair is: '_group_title' => 'Group Leader'. I would bring up the key _group_title and in the text box enter "Group Master", hit save and site wide the text will be changed. Languages are stored in php files in an array.

Code: Select all
$aLangContent = array(

    '_group_title' => 'Group Leader',


Of course I am not saying we should try to implement such a system; you know how I am with stuff. :D
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: translations

Postby EdB » Sun Feb 24, 2013 10:08 pm

Thinking about this some more, the only reason there are .pot and .po files are so poedit can be used. Picking the write characters for displaying is actually done from the global.nn.php file or left alone for English (the stock language). Fundamentally that is really the only difference between what most programs use (a variable that gets replaced for any language) and what we use (an english word that gets replaced for any other language.

I can see how our method is obviously faster for english, but I can't see how it is faster for any other language. Also I can see how having the poedit step makes it actually easier for translators because it does let the translator know where exactly in the code the string is used.

I'm all in favor of more translations as a probability, but do want to not focus on something just because it might be beneficial down the road. If that makes sense...
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: translations

Postby EdB » Sat Mar 02, 2013 2:51 am

I had a thought that might be related to this topic: image resizing and the amount of memory we need to handle larger images.

A long time ago I found I had to up my memory limit to I-forget-what in order to handle a specific image I was wanting to post. Wordpress could do it straight out of the box without issue. So I've always wondered why are we such memory hogs? Anyway I just now got to thinking MAYBE the speedier aspect of our translation model comes at the cost of server memory. MAYBE!

Seems like it might be worth a test somehow. Maybe figure out how to measure memory usage on my localhost, then basically kill the T_() function by just doing a return and seeing if it changes memory usage? Or maybe there is a switch we can set to 0 to totally disable the idea of translating and basically get the same test result?

No idea how to tell how much memory is in use during any given page creation. I can see time if I want on the footer, but memory usage? No idea ... but IF translating the way we do is crippling memory then that might be the best reason ever to get rid of it.

(notice the heavy usage of if, might, and maybe? clearly I have no idea what I'm talking about ...)
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: translations

Postby Kimberly » Sat Mar 02, 2013 4:21 am

EdB wrote:I had a thought that might be related to this topic: image resizing and the amount of memory we need to handle larger images.


Speaking of images and resizing, remember that open source graphic library I am using on the boobs site I built for a client? We should look at implementing it into the file manager. A person could set an image size for all uploaded images; say 600 pixels wide (it will keep the aspect ratio intact) and then can upload images all day long; including those from their digital camera that are huge, and all images will be saved to the correct size for posting. It can also do resizing on the fly (if I recall correctly) so one could upload that 2 meg image size and still have it resized to fit the template they are using. In my opinion, it makes better sense to resize and save on the server since you are not using up hard drive space for file. Or, upload say a large display image for a lightbox, and resize for display in the post; that would save me from making two sizes of every image for posts where I want a larger image for the lightbox. (I don't like the idea of resizing with CSS or width in image tag)
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: translations

Postby EdB » Sat Mar 02, 2013 6:25 pm

I sort of remember the site but don't know anything about the "save only resized on server" feature involved. Not sure if I like it as core though. Just thinking it might not always be what people want is the thing. Heck even as core it could/should be a feature the owner can enable/disable?

Anyway sounds like a path worth exploring. Got files? A link to the graphics library, maybe a file set of the installation?
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: translations

Postby Kimberly » Sun Mar 03, 2013 12:42 am

Let me find the forum topic.....
OK, this is it: viewtopic.php?f=11&t=1183

I used that when I created an emailer for photos that could be sent by regular email or someone emailing photos from a smartphone or tablet. The client of the Boobs site wanted an easy way for site visitors to send her photos for the site. On the website, which is built with the first QP release, there are a couple of scripts to handle this. One is the script to go check the mail server for new emails and if there are any with attachments, it pulls the attachment and then calls the class.upload.php script to make sure the image is sized to the proper size for the website. It then looks to see if a current folder of the current month and year exists; if it does it uses that folder, if not, it creates the folder and then stores the image in that folder. Before quitting, it removes the temp files it creates for the resizing.

Would be nice if it could be added as a plugin to the file manager; assuming the file manager can use plugins.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Next

Return to The Future

Who is online

Users browsing this forum: No registered users and 2 guests

cron