Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#97 2014-07-06 22:25:17

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,791
Website GitHub

Re: smd_macro: Create custom virtual Txp tags that do stuff

GugUser wrote #281935:

When I use smd_macro and the specified language in Textpattern is German, then under “Content” (“Inhalt”) I see “Macros” and all the labels are in English (no problem).

Presumably your default installation (at the time you installed the plugin) was German. Thus the Textpack that shipped with the plugin inserted its (English) strings against your installed de-de language in txp_lang.

When you subsequently switch to Spanish (or any other language), only strings that had already been defined in core (such as Name and Description) are used, and everything else gets its raw string representation instead, because those strings have not been inserted against any other language.

Where can I change this?

  1. Visit my download master page
  2. Find smd_macro in the list
  3. Download the en-gb textpack
  4. Modify its contents so the strings on the right are in Spanish and the language designator is es-es
  5. Paste the file contents into the ‘Install Textpack’ box in your Admin->Preferences->Languages panel and upload them.
  6. Send me the Textpack so I can integrate it with the plugin and make it available for download for other users.

P.S. if you’d like to send me a translated de-de Textpack too, that’d be fabulous!


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

#98 2014-07-07 01:26:25

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,469

Re: smd_macro: Create custom virtual Txp tags that do stuff

Many thanks Bloke. I’ll translate the two files and send them back to you.

Offline

#99 2014-07-07 03:26:14

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,469

Re: smd_macro: Create custom virtual Txp tags that do stuff

smd_macro_v0.30_de-de_textpack.txt

#@smd_macro
#@language de-de
smd_macro_attributes => Attribute
smd_macro_att_clone => [+]
smd_macro_att_clone_help => Ein Attribut hinzufügen
smd_macro_cannot_import => Das Makro kann nicht importiert werden. Bitte überprüfen Sie die Berechtigungen der Ordner und die Einstellungen Ihres Servers.
smd_macro_choose => Makro zum Bearbeiten auswählen
smd_macro_clone => Duplizieren
smd_macro_created => Makro erstellt
smd_macro_deleted => Makro gelöscht
smd_macro_exists => Der Name des Makros existiert bereits oder ist inkompatibel
smd_macro_export => Exportieren
smd_macro_file_size => Die Makrodatei ist zu groß
smd_macro_import => Importieren
smd_macro_imported => Importiert:
smd_macro_invalid => Der Name des Makros ist ungültig
smd_macro_invalid_ini => Die Makrodatei ist nicht im erwarteten Format
smd_macro_not_imported => Nicht importiert:
smd_macro_overwrite => Überschreiben erzwingen
smd_macro_repname => Ersatzname
smd_macro_saved => Makro gespeichert
smd_macro_skipped => Übersprungen:
smd_macro_tab_name => Makros
smd_macro_tag_definition => Makrodefinition
smd_macro_tbl_installed => Tabelle installiert
smd_macro_tbl_not_installed => Tabelle nicht installiert
smd_macro_tbl_not_removed => Tabelle nicht entfernt
smd_macro_tbl_removed => Tabelle entfernt
smd_macro_upload => Makrodatei

Offline

#100 2014-07-07 03:27:23

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,469

Re: smd_macro: Create custom virtual Txp tags that do stuff

smd_macro_v0.30_es-es_textpack.txt

#@smd_macro
#@language es-es
smd_macro_attributes => Atributos
smd_macro_att_clone => [+]
smd_macro_att_clone_help => Añadir un atributo
smd_macro_cannot_import => El macro no puede ser importado. Por favor, examine los permisos de carpeta y la configuración de su servidor.
smd_macro_choose => Seleccione el macro para editar
smd_macro_clone => Duplicar
smd_macro_created => Macro creado
smd_macro_deleted => Macro eliminado
smd_macro_exists => El nombre del macro ya existe o es incompatible
smd_macro_export => Exportar
smd_macro_file_size => El archivo del macro es demasiado grande
smd_macro_import => Importar
smd_macro_imported => Importado:
smd_macro_invalid => El nombre del macro no es válido
smd_macro_invalid_ini => El archivo del macro no tiene el formato esperado
smd_macro_not_imported => No importado:
smd_macro_overwrite => Forzar sobrescribir
smd_macro_repname => Nombre de reemplazo
smd_macro_saved => Macro guardado
smd_macro_skipped => Saltado:
smd_macro_tab_name => Macros
smd_macro_tag_definition => Definición del macro
smd_macro_tbl_installed => Tabla instalada
smd_macro_tbl_not_installed => Tabla no instalada
smd_macro_tbl_not_removed => Tabla no eliminada
smd_macro_tbl_removed => Tabla eliminada
smd_macro_upload => Archivo del macro

Offline

#101 2014-07-07 08:02:40

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,791
Website GitHub

Re: smd_macro: Create custom virtual Txp tags that do stuff

GugUser

Thank you very much. All your textpacks are now available for download from my site.


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

#102 2014-10-30 10:27:50

ingleslenobel
Member
Registered: 2014-10-16
Posts: 88

Re: smd_macro: Create custom virtual Txp tags that do stuff

This is very useful, I’ve used it to make a nice custom textpattern tag. One thing I don’t seem to be able to do however is add a second attribute, I don’t have a + option on the latest version of textpattern? Is this me, or a known issue, or a change??

Thank you

  • solved looks like, you have to press “ smd_macro_att_clone”, that’s the new +. Whoddathunkit :)

Last edited by ingleslenobel (2014-10-30 10:31:12)

Offline

#103 2014-10-30 10:40:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,791
Website GitHub

Re: smd_macro: Create custom virtual Txp tags that do stuff

ingleslenobel wrote #285244:

looks like, you have to press “ smd_macro_att_clone”, that’s the new +.

Sounds like the plugin’s Textpack hasn’t been installed properly for some reason. You could try downloading this one, open it, copy the contents, visit your Admin->Preferences->Languages panel and paste the content in the Install textpack textarea at the bottom then hit Upload. That should sort out the rogue interface elements and restore your [+] button to its native glory.

Sorry about the hassle. No idea why it didn’t install properly. Are all the other strings OK?


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

#104 2014-10-30 12:42:36

ingleslenobel
Member
Registered: 2014-10-16
Posts: 88

Re: smd_macro: Create custom virtual Txp tags that do stuff

Thank you Bloke – to be honest I’m fine with the text output now that I’ve actually discovered it – trying to click on a tiny + is much less friendlier than a nice long string of text!!! Though I appreciate I may bow to the inevitable as it might cause issues down the line – this is the only one I’ve come across though

Bloke wrote #285245:

Sounds like the plugin’s Textpack hasn’t been installed properly for some reason. You could try downloading this one, open it, copy the contents, visit your Admin->Preferences->Languages panel and paste the content in the Install textpack textarea at the bottom then hit Upload. That should sort out the rogue interface elements and restore your [+] button to its native glory.

Sorry about the hassle. No idea why it didn’t install properly. Are all the other strings OK?

p.

Offline

#105 2014-10-30 12:58:04

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,791
Website GitHub

Re: smd_macro: Create custom virtual Txp tags that do stuff

ingleslenobel wrote #285254:

trying to click on a tiny + is much less friendlier than a nice long string of text!!!

Feel free to edit the smd_macro_att_clone language string in the textpack to [Add attribute] or whatever you prefer and re-upload it from the Languages panel.


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

#106 2014-10-30 15:42:19

ingleslenobel
Member
Registered: 2014-10-16
Posts: 88

Re: smd_macro: Create custom virtual Txp tags that do stuff

done, thanks, that was easy =)

Bloke wrote #285256:

Feel free to edit the smd_macro_att_clone language string in the textpack to [Add attribute] or whatever you prefer and re-upload it from the Languages panel.

Offline

#107 2014-11-29 21:48:10

jagorny
Member
From: Portland, OR
Registered: 2006-08-24
Posts: 39
Website

Re: smd_macro: Create custom virtual Txp tags that do stuff

Hi Stef,

Been testing the plugin and really like it so far. A have a small request, perhaps it doesn’t make sense to you but – well, this plugin has a lot of potential in helping bring over certain widget structures from another somewhat well known CMS system, but it would be really helpful – especially in certain applications, to be able to define a prefix and suffix value for an attribute – and if there is no value, then the entire compound is eliminated.

For example, trying to bring in a lightbox application, it is sometimes possible to simply switch the item ‘on’ using an ‘on;’ switch – other times you need to define a group using a “group:#VALUE;” switch.

It would be nice to be able to have the following attributes:

name / pre / default / post / replacement

switch / "" / "" / ";" / lbSwitch
group / "group:" / "" / ";" / lbGroup

That way I can create a macro like:

<a data-application="{lbSwitch}{lbGroup}" href="whocares"> etc etc

and not need to worry about adding extra characters or trying to run a conditional clause just to get the pre- and post- value constants in there only when they apply.

Does this make sense? I suppose this could be (ab)used in the form of inline styles and classes also – but I am finding that with a lot of jquery plugins it would be handy to be able to put in parameter names in the pre, semicolons in the post and then not worry about conditionals at all.

{Added Textile around code. – Uli}

Last edited by uli (2014-11-29 22:04:16)

Offline

#108 2014-11-30 15:21:08

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

Re: smd_macro: Create custom virtual Txp tags that do stuff

Not sure if I understood exactly what you’re trying to achieve, but maybe one of these helps:

1) If everything needs to be mega-flexible you could make the prefix and suffix attributes individual attributes of the macro and specify them each time.

2) Use smd_wrap to add a prefix or suffix to whatever it wraps.

You’ll need to test this but theoretically this:

<txp:smd_wrap prefix="group:" suffix=";">{lbGroup}</txp:smd_wrap>

will return group:yourname; if the group tag exists and nothing at all if the value is empty if it doesn’t.

3) Alternatively, you can use txp:variable / txp:if_variable to test whether a value is empty. smd_if will work too. Then you can construct your tag normally without recourse to smd_wrap.

<txp:variable name="group_var">{lbGroup}</txp:variable>
<txp:variable name="switch_var">{lbSwitch}</txp:variable>

<txp:if_variable name="switch_var" value=""></txp:else />
  <txp:variable name="switch_var">{lbSwitch};</txp:variable>
</txp:if_variable>
<txp:if_variable name="group_var" value=""></txp:else />
  <txp:variable name="group_var">group:{lbGroup};</txp:variable>
</txp:if_variable>

<a data-application="<txp:variable name="switch_var" /><txp:variable name="group_var" />" href="whocares">

And if you need to have the possibility to make an smd_macro have no value, see this thread.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB