Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-01-18 12:34:12

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Plugin Textpack

Just made my first foray into Textpacks. Good fun, and an interesting task for a monoglot like me. I didn’t find much recent info or notes on how people are using these. Just curious what others are doing. I’ll probably write up my notes for a brief article. What other plugins use them?


Code is topiary

Offline

#2 2011-01-18 14:20:26

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Plugin Textpack

I have to say that I don’t use Textpacks and I don’t really have any high priority plans to. I haven’t really seen any plugins that use Textpacks, but there must be some.

Are you planning to integrate Textpacks to all your plugins? Sounds lot of work :-)

Last edited by Gocom (2011-01-18 14:41:31)

Offline

#3 2011-01-18 14:49:27

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

Re: Plugin Textpack

I’ve just got a line item in my newer plugins above the ubiquitous _gTxt() function that says:

TODO: Textpack this when plugin composer supports them

So when I get my butt in gear I might take a look at them. Would like txp.org to offer textpacks as downloadable files alongside the plugin on the individual article view.

If you get a moment, Jeff, feel free to try your textpack out on the new .org area that I earmarked. I figured due to the distributed nature of packs that would be the way to go, but might be wrong. For example, Els might contribute the nl-nl pack for one of your plugins and host it herself if she uses the plugin a lot or could send you the changes each time a new version is released so you could host it.

See the soo_page_numbers entry for a possible avenue of exploration, though I don’t know how ‘default’ should be handled as it could potentially load them all? (I’m not fully up on Textpacks yet, forgive me). Nor have I figured out if they should be versioned or not. I guess it doesn’t matter so much after the recent changset which fixes the error of missing lang strings?

Last edited by Bloke (2011-01-18 14:50:41)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2011-01-18 15:42:56

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Plugin Textpack

Gocom wrote:

Are you planning to integrate Textpacks to all your plugins? Sounds lot of work :-)

I thought I’d start with an easy one (only one string per language) and see how it goes. Now that I’ve figured out the basics (I think), the main chores for adding Textpacks to more plugins are converting hard-coded text output to gTxt() items, then asking the wonderful Txp community to help me translate :)

Bloke wrote:

feel free to try your textpack out on the new .org area that I earmarked. I figured due to the distributed nature of packs that would be the way to go, but might be wrong.

We’ll see. Having it packaged in the plugin means one-step install for users, always a plus. Also versioning for free :)

Last edited by jsoo (2011-01-18 15:43:17)


Code is topiary

Offline

#5 2011-01-18 16:05:52

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

Re: Plugin Textpack

jsoo wrote:

Having it packaged in the plugin means one-step install for users, always a plus. Also versioning for free :)

Yes, and two good reasons to do it that way. The downside being that you have to ask the community for the strings before you release the plugin.

For one-string plugins that’s cool. For something like smd_admin_themes which currently has 92 strings, I’d probably be waiting a while :-D Plus if new languages come along (Pirate, Arrrrr) I have to release a new version and/or track which users have translated the strings and roll them into the next rev.

Having each language as a separate file does seem enticing in that regard but, as you say, requires an N-step install (where N ranges from 1 to number of langs installed on target site). The plugin template format does support textpacks inside it so certainly as a minimum the default strings can be packaged into the plugin at compile / distribution time, which is what I’d like the Composer to do. That makes it a one-step install for at least the default strings.

Over time, if you want to grab textpacks from other contributors, and install them on your system I’d like the Composer to offer you the option to merge them in too at plugin export time. By default it’ll only include the language of your current admin side (or your nominated export language of choice) to keep plugin sizes down; I want to merely provide a useful tool and leave the choice of which langs you ship inside your plugin .txt file to authors.

If I can figure out a neat interface for this then I hope it’ll prove a useful addition to the Composer. What I may do though is end up writing a separate management plugin — like Rick’s (I may even steal the code or simply the idea or the api) — and get the Composer to just manage your lang prefs, read the currently installed strings, have the cleverness to interface with said management plugin, and allow you to inject/edit new strings as you develop. Hmmm. Lots to think about.

Last edited by Bloke (2011-01-18 16:08:26)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#6 2011-01-18 16:56:34

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Plugin Textpack

Bloke wrote:

For something like smd_admin_themes which currently has 92 strings, I’d probably be waiting a while :-D

Righto. I see your point.

By default it’ll only include the language of your current admin side (or your nominated export language of choice) to keep plugin sizes down

I can see with a large plugin with many strings (as per your example) this is an issue. For most plugins I don’t think it is. Has minimal effect on the installed size (unless the site has a lot of languages installed, in which case they probably want the full Textpack anyway), and with compression I think it’s a rare plugin that creates problems on install.

Obviously there’s nothing in your ideas to prevent a plugin author packing the strings in the plugin itself, so sounds like a win-win.


Code is topiary

Offline

#7 2011-01-18 17:38:05

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: Plugin Textpack

Bloke wrote:

The plugin template format does support textpacks inside it

jsoo wrote:

Has minimal effect on the installed size

Forgive me for my ignorance – I’ve only mildly paid attention to Textpacks, so I don’t completely understand how they work.

Am I understanding correctly that packaging Textpacks in the plugin doesn’t bloat the plugin with unneeded language strings?

For example if you are using a single language on your site, you won’t end up with unneeded translations?

Last edited by maverick (2011-01-18 17:38:33)

Offline

#8 2011-01-18 18:34:13

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Plugin Textpack

Correct. When you install a plugin with a Textpack, the only strings added to txp_lang are those in languages that are already installed on the user’s site.

I didn’t know that either, until I started testing the installation.


Code is topiary

Offline

Board footer

Powered by FluxBB