Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-01-23 15:05:23

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

smd_babel: Manage string translations from the admin side

Managing translation strings in Textpattern has traditionally meant going into the database and fiddling with content there. This is no longer the case. Welcome… smd_babel.

Features

  • Translate strings by group for any installed language from the admin side.
  • Switch between languages, retaining your current site and admin language strings alongside for reference.
  • Add new strings if required.
  • Delete (non-core) strings.
  • Export the pack in any language according to a few matching rules.

Requires Textpattern v4.7.2+

Hopefully useful for translators. Download the plugin from Github and enjoy. Any comments, please raise them here or if you have feature requests / bug feedback, raise an issue.


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

Online

#2 2019-01-23 16:00:00

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: smd_babel: Manage string translations from the admin side

Lovely stuff! It was time for smd_next_big_plugin :-)

In “Add translation string” dialog you have two (a bit confusing) Language labels.

Offline

#3 2019-01-23 16:56:19

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

Re: smd_babel: Manage string translations from the admin side

etc wrote #316246:

In “Add translation string” dialog you have two (a bit confusing) Language labels.

Oops, well spotted. Copy ‘n paste fail, and I didn’t notice it because when uploading the new version of the plugin via the Plugin Composer, it used the strings already in the DB.

v1.01 released, thank you.

EDIT: and how did you post exactly at 16:00:00… impressive!

Last edited by Bloke (2019-01-23 16:56:47)


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

Online

#4 2019-01-23 17:34:05

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: smd_babel: Manage string translations from the admin side

Bloke wrote #316243:

Managing translation strings in Textpattern has traditionally meant going into the database and fiddling with content there. This is no longer the case. Welcome… smd_babel.

Excellent! Thank you! That will undoubtedly be very useful.

Bloke wrote #316247:

and how did you post exactly at 16:00:00… impressive!

That was probably etc_stop_time at work!


TXP Builders – finely-crafted code, design and txp

Offline

#5 2019-01-23 21:31:53

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

Re: smd_babel: Manage string translations from the admin side

Minor bug fix v1.0.2 released:

  • Fixes announcement message when adding strings.
  • Auto focuses first input field in dialogs.

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

Online

#6 2019-01-24 01:59:52

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: smd_babel: Manage string translations from the admin side

Looks nice and handy. It gave me a handy reminder that I still have a bunch of language strings for a no-longer-used/no-longer-needed plugin that I really should remove. Thanks for that :-)

A minor nit so far – when you insert a smd_babel_delete button (link), could you automatically append a (non-)breaking space after said button. That would leave a bit of air in the line and the string that follows it does not need to abut the button.


Oh, and an issue with the help file which I think is not directly related to the plugin.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#7 2019-01-24 06:37:51

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,595
GitHub Twitter

Re: smd_babel: Manage string translations from the admin side

[smd_babel] smd_babel_add_string = "Ajouter une chaîne de traduction" smd_babel_export_strings = "Exporter les chaînes" smd_babel_group = "Groupe" smd_babel_key = "Clé" smd_babel_lang = "Langue" smd_babel_lang_site = "Langue du site public" smd_babel_lang_ui = "Langue de l’administration" smd_babel_lang_xlate = "Sélection de la langue" smd_babel_language_not_installed = "Langue {name} non installée." smd_babel_string_deleted = "Chaîne {name} supprimée." smd_babel_string_updated = "Chaîne {name} mise à jour." smd_babel_value = "Chaîne de traduction" tab_smd_babel = "Traductions"
#@language fr
#@admin-side
smd_babel => Traductions
#@smd_babel
smd_babel_add_string => Ajouter une chaîne de traduction
smd_babel_export_strings => Exporter les chaînes
smd_babel_group => Groupe
smd_babel_key => Clé
smd_babel_lang => Langue
smd_babel_lang_site => Langue du site public
smd_babel_lang_ui => Langue de l’administration
smd_babel_lang_xlate => Sélection de la langue
smd_babel_language_not_installed => Langue {name} non installée.
smd_babel_string_deleted => Chaîne {name} supprimée.
smd_babel_string_updated => Chaîne {name} mise à jour.
smd_babel_value => Chaîne de traduction
tab_smd_babel => Traductions

Last edited by Pat64 (2019-01-24 06:40:47)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#8 2019-01-24 09:23:52

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

Re: smd_babel: Manage string translations from the admin side

Thanks guys. Fixed and updated in v1.0.3. Glad the plugin’s useful.


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

Online

#9 2019-01-24 10:20:15

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,595
GitHub Twitter

Re: smd_babel: Manage string translations from the admin side

Oh yeah!

On the moment, I didn’t understand the purpose of your plugin, Stef. It’s very useful for… themes! And I love it ;)

Just an idea, Stef (may be it can be difficult):

Could you add a lang attribute to the <txp:text item="" /> Core tag in order to retrieve the corresponding string associated to a lang iso code?

Imagine:

<txp:text item="string" lang='<txp:lang />' />


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#10 2019-01-24 11:11:46

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: smd_babel: Manage string translations from the admin side

Pat64 wrote #316271:

Could you add a lang attribute to the <txp:text item="" /> Core tag in order to retrieve the corresponding string associated to a lang iso code?

Imagine:

<txp:text item="string" lang='<txp:lang />' />

Maybe I’ve misunderstood it, but is not your example the standard situation, e.g.:

is not: <txp:text item="string" lang='<txp:lang />' /> = <txp:text item="string" />.

However, I can imagine a lang attribute would be useful to show another language, for example for a language switcher where you explicitly say lang="fr" or when using a variable that holds the current language of a multi-language site, derived from an url variable, for example. A little while ago, I did a kind of proof of concept for that with a lang attribute with Oleg’s help. I’ll see if I can dig that out again.


TXP Builders – finely-crafted code, design and txp

Offline

#11 2019-01-24 11:15:35

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

Re: smd_babel: Manage string translations from the admin side

Pat64 wrote #316271:

It’s very useful for… themes! And I love it ;)

Great!

Could you add a lang attribute to the <txp:text item="" /> Core tag in order to retrieve the corresponding string associated to a lang iso code?

It’s something I’ve considered before but talked myself out of it. Currently that tag will output whatever item it is given in the current language. On the public site that’s the public language. In theory – though I’ve never tried it – if you used the tag on a dashboard / admin-theme / plugin it would show you the string in your admin-side language. All automatic. As far as I can tell, that’s exactly what the tag was designed for: to offer a translated text string in the current local context.

With that in mind, under what circumstances would you need to override the item and display it in a specific, fixed language for everyone?

EDIT: Oh, besides perhaps in a language switcher context: that’s a good example, jakob thanks.

Last edited by Bloke (2019-01-24 11:17:36)


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

Online

#12 2019-01-24 12:18:20

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,595
GitHub Twitter

Re: smd_babel: Manage string translations from the admin side

Yes, that’s work!

Stef: you are a master!


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

Board footer

Powered by FluxBB