Auf und ab.

Translating strings in Magento

Magento has no default-installation translation module. Instead translations are done on a per-module override or a one file overrides all basis.

To set up a override-all, go to the design section in the configuration in the backend and set the theme for the translations. Then in app/design/frontend/default/YourTheme/locale/en_US there is a csv file called translate.csv, and if not just creat it. To translate any string write on a new line

“Sentence to translate”,”Sentenced translated”

So if you want do it for some other language just create the appropiate folder like fr_FR for french and so on and add the translate.csv file.

For a module based translation have a look in app/local/en_US and you will get the picture. I am guessing you would just copy the specific module csv file to your theme’s locale clear it, except for the strings you want to translate. Look here for a more thorough description.

This might also be useful.

Drupal Views grid style template with float and divs

Copy and save in a file named views-view-grid.tpl.php in your themes template catalog. Set number of columns in the View. Make the divs float via CSS. Voila!

<?php
/**
 * @file views-view-grid.tpl.php
 * Default simple view template to display a rows in a grid.
 *
 * - $rows contains a nested array of rows. Each row contains an array of
 *   columns.
 *
 * @ingroup views_templates
 */
?>
<?php if (!empty($title)) : ?>
  <h3><?php print $title; ?></h3>
<?php endif; ?>
<div class="clearfix"> 
<?php 
  // Check number of columns in grid
  $numberOfColumns = sizeof($rows[0]);
  $columnContainers = array();
 
  // Create containers for all divs
  for ( $iter=0; $iter < $numberOfColumns;  $iter++){
    $columnContainers[] = '<div class="grid-column col-' .$iter. ' clearfix">';
  }
 
  foreach ($rows as $row_number => $columns){
    foreach ( $columns as $column_number => $item ) {
      $columnContainers[$column_number] = $columnContainers[$column_number] . 
                                        '<div class="' . $column_classes[$row_number][$column_number] . '">' . 
                                          $item . 
                                        '</div>';
    }
  }
 
  for ( $iter=0; $iter < $numberOfColumns;  $iter++){
    echo $columnContainers[$iter] . '</div>';
  }     
?>  
</div>

Magento: Frontend category navigation selectbox

I was looking for some way of adding a selectbox in the navigation so that one could pick a category and then get directed to the page with all products in that category. After much looking I found this page, that did sort of what I wanted. Customizing I got the following code for the top block in Magento.

<div class="header-nav-container">
  <div class="header-nav">
    <select class="browser_box" name="browser" onchange="location = this.options[this.selectedIndex].value;">
      <option>Please select a category...</option>
<?php
  $obj = new Mage_Catalog_Block_Navigation();
  $store_cats = $obj->getStoreCategories();
  $current_cat = $obj->getCurrentCategory();
  $current_cat = (is_object($current_cat) ? $current_cat->getName() : '');
 
  foreach ($store_cats as $cat) {
	  echo '<option value="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."</option>";
  }
?>
    </select>
  </div>
</div>

Wikipedia User-script

I am a big fan of user-scripts and Wikipedia. However the Wikipedia design has always struck me as a bit unwieldy sort of when the design becomes too flexible for it’s own good. I found myself always resizing the window whenever viewing a Wikipedia article so I wrote this tiny user-script that sets text-width to 450 pixels and changes the type to Georgia. I am gonna try to do a black background save-the-eyes-script alternative soon as well.

You can find the script here

Spotify Playlist for September 2010 0.9.5

Spotify Playlist for September 2010 0.9.5

The great Lemix.

Playlist:

Lem – April.02 Lemix
Tex La Homa – The Greatest Key
Avey Tare – Opis Helpus
Julia Holter – Moto Perpetuo
Roots Manuva – Revolution 5
Julia Holter – Why Sad Song?
Various Artists – De Vez En Cuando
Air – Soldissimo – EDC Remix
Manekinekod – Unable To Display
Malaria! – Lay Lady Lay
I’m Not A Gun – These Thoughts Break
Per ‘Texas’ Johansson – Nästa Morgon

Spotify Playlist for September 2010 0.9

Spotify Playlist for September 2010 0.9

The YACHT list

Playlist:

Takeo Toyama – Tremolo
The Tough Alliance – Leg 9
Toro Y Moi – Low Shoulders
Metronomy – A Thing For Me
YACHT – The Denver Nuggets
YACHT – Psychic City – Classixx Remix
Phil Elverum & Nick Krgovich – Whatcha Doin’?
Aidan Moffat & The Best-Ofs – Your Hands Are Cold
Motohiro Nakashima – Meow
Metronomy – Not Made For Love
Shuta Hasunuma – Soul Osci
Esser – Bones
Glider – Floating Feeling Remixé Par Couch
Arvo Pärt – Summa
Gladys Knight & The Pips – It’s A Better Than Good Time – Walter Gibbons acetate mix

Spotify Playlist for August 2010 0.8

Spotify Playlist for August 2010 0.8

The Key

Playlist:

Speech Debelle – The Key
Invisible – London Girl
Micachu – Curly Teeth
Metronomy – Heartbreaker
Camille – 1,2,3
Tunng – Hustle
Marc Evans – Given Me Joy [Lovebirds Suite Vocal]
Scott Matthews – Elusive
Broken Bells – Vaporize
Two Door Cinema Club – Undercover Martyn

Spotify Playlist 2010 0.7.5

Spotify Playlist for Juli second part 2010 0.7.5

God  didn’t kill Johnny Cash

Playlist:

Max Richter – The Blue Notebooks
Mansbestfriend – Bosnian Jazz
The Antlers – Bear
Mumford & Sons – Little Lion Man
I Was a Teenage Satan Worshipper – Art School Creeps
Saul Williams – Telegram
Speech Debelle – Spinnin’ – Radio Edit
The Miserable Rich – Chestnut Sunday
The Voluntary Butler Scheme – Trading Things In
Sage Francis – Jah Didn’t Kill Johnny
Takagi Masakatsu – Wonderland
The Foreign Exchange – Daykeeper
Madvillain – Monkey Suite

Spotify Playlist 2010 0.7.0

Spotify Playlist for Juli 2010 0.7

A homage to Marriage Records in Portland sort of.

Playlist:

Max Richter – The Road Is A Grey Tape
Be Gulls – Hello?
White Fang – Portland Sucks
The Kallikak Family – Dulce De Leche
Kanda – They’ll Need Cocaine
Karl Blau – Put Me Back
S. American Agriculture – Close Your Eyes…
Lucky Dragons – Fake Is Forever
White Fang – Eat My Shred
Kanda – Where Do They?
Takagi Masakatsu – Golden Town With Sunglasses
Dear Nora – Hot Boyz
Be Gulls – Good Again
Karl Blau – Kill The Messenger
Devendra Banhart – Happy Birthday!
Drakkar Sauna – Don’t Hex A Polygon
Janelle Monae – Mr. President – EP Version
Cappadonna – N.y.c. Stand Up

Spotify Playlist 2010 0.6

Spotify Playlist for Juli second part 2010 0.6

(I Want You) More Than Ever

Playlist:

Fionn Regan – Be Good Or Be Gone
Elektrofant – Whatever You Do, It’s Alright
Oskar Linnros – Från och med Du
Sportsday Megaphone – Less and Less
Kim Hiorthøy – Forskjellige Gode Ting
This Is The Kit – Our Socks Forever More
The Go-Betweens – Right Here
Grand National – Peanut Dreams
DJ Shadow – Why Hip-Hop Sucks In ’96
Rune Lindbaek – Sondags Beste
Machine Drum – Late Night Operation
Dam Funk – Sunset
Yoyoyo Acapulco – Mexican Wolfgasket
Oskar Linnros – Från och med Du
Roy Davis Jr. – All I Do
Fred Everything – Mercyless – Atjazz Vocal Mix
The Clientele – (I Want You) More Than Ever
Raekwon – PJ’s

Auf und ab. (RSS) + Sator-ii theme by Felipe Lavín