Sociable Makes Blogs Happy «
»


Biz: ,
3 comments

I just read a neat blog post on one guy’s experience using Sociable. It even has a nice graph. That’s a nice spike in traffic.

The next version of Sociable is under way. I’ve moving development to Sourceforge so that other folks can get involved, at the moment it’s mostly translation efforts (Spanish, German, Italian, Hungarian, maybe more). And on that note, if anyone has a good tutorial on using gettext in PHP, I’d love a link. I’m stuck on the code, so there’s no development happening at the moment. Frustration!


Comments

  1. Hi.

    Use php-Gettext. Many other projects already use it and it doesn’t require Gettext compiled in users system.
    Check it out at I Hate PHP
    Get it at Savannah

    Documentation and examples on usage of both PHP native Gettext at Pablo Hoch blog or on the php-Gettext Class at BlogFish and why should you choose it instead PHP’s default one.

    You will need to use __(‘text to translate’) when you don’t want to use it to return translation or _e(‘text to translate’) if you want to echo translation inside your code.

    Then you can use my bash script (requires Linux and GNU Gettext installed in your local machine):

    #! /bin/sh
    #
    # ***** BEGIN LICENSE BLOCK *****
    # Version: GPL 2.0 / LGPL 2.1
    #
    # The Original Code is Humaneasy Consulting code.
    #
    # The Initial Developer of the Original Code is
    # Humaneasy Consulting.
    # Portions created by the Initial Developer are Copyright (C) 2006
    # the Initial Developer. All Rights Reserved.
    #
    # Contributor(s):
    #
    # Alternatively, the contents of this file may be used under the terms of
    # either of the GNU General Public License Version 2 or later (the "GPL"),
    # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    # in which case the provisions of the GPL or the LGPL are applicable instead
    # of those above. If you wish to allow use of your version of this file only
    # under the terms of either the GPL or the LGPL indicate your decision by
    # deleting the provisions above and replace them with the notice and other
    # provisions required by the GPL or the LGPL. If you do not delete the 
    # the provisions above, a recipient may use your version of this file under
    # the terms of any one of the GPL or the LGPL.
    #
    # ***** END LICENSE BLOCK *****
     
    cmdname=`basename "$0"`
    MKT_DIST_TRANS=`pwd`      # `dirname "$0"`
    MKT_DEFAULT_NAME="./${cmdname}"
     
    exitcode=0
     
    #
    ##
    ## Functions
    ##
    ##########################################################################
    mkt_usage()
    {
    echo "Usage:  ${cmdname} [option] [srcfile] [destfile]"
    echo ""
    echo "  options:"
    echo ""
    echo "    -p                   Creates the PO, POT and original MO files."
    echo "    --makepo"
    echo ""
    echo "    -m                   Creates only the MO file."
    echo "    --makemo"
    echo ""
    echo "  Example for PO/POT files:"
    echo "    ${cmdname} -p '.php filename w/o extension' 'langcode'"
    echo "       'langcode' could be, for instance, 'es' or 'pt' "
    echo ""
    echo "  Example for just MO"
    echo "    ${cmdname} -m '.po filename'"
    echo ""
    echo "  -m superseeds -p. Use just one at a time."
    echo "  Example for just MO"
    	return 0
    }
     
    ##########################################################################
    #
    OPTIONVAR=$1
    if [ "${OPTIONVAR}" == "" ]; then
       mkt_usage
       exit 1
    fi
     
    echo ""
    # MKT_DIST_TRANS="${MKT_DIST_TRANS}/wp-translations"
    X=`mkdir -p "${MKT_DIST_TRANS}"/mo`
    SRCFILE=$2
     
    if [ "${OPTIONVAR}" == "-m" ] || [ "${OPTIONVAR}" == "-makemo" ]
    then
       if [ "${SRCFILE}" == "" ] 
       then
           mkt_usage
           exit 1
        fi
     
        SRCFILEPO="${MKT_DIST_TRANS}/${SRCFILE}.po"
        SRCFILEMO="${MKT_DIST_TRANS}/mo/${SRCFILE}.mo"
     
        if [ -f "${SRCFILEPO}" ]
     	then
            echo "Making ${SRCFILE} MO file for your plugin at ${MKT_DIST_TRANS}/mo' ..."
            msgfmt -o "$SRCFILEMO" "$SRCFILEPO"
            echo "The file $SRCFILEMO is ready. Can use it in your application."
         else
            echo "Source file ${SRCFILEPO} NOT found."
            echo ""
            exit 1
         fi
    fi
    #
     
    if [ "${OPTIONVAR}" == "-p" ] || [ "${OPTIONVAR}" == "-makepot" ]
    then
        LANG=$3
        if [ "${SRCFILE}" == "" ] || [ "${LANG}" == "" ] 
        then
           mkt_usage
           exit 1
        fi
     
        SRCFILEPHP="${SRCFILE}.php"
        SRCFILEPOT="./wp-translations/${SRCFILE}.pot"
        SRCFILEPO="./wp-translations/${SRCFILE}-${LANG}.po"
     
        if [ -f "${SRCFILEPHP}" ]
     	then
            echo "Making $SRCFILE POT file for your Wordpress plugin/theme..."
            xgettext --keyword=__ --keyword=_e --default-domain="${SRCFILE}" \
                     --language=php "${SRCFILEPHP}" --output="${SRCFILEPOT}"
    	if [ -f "${SRCFILEPOT}" ]
    	   then
               cp "${SRCFILEPOT}" "${SRCFILEPO}"
               echo "${SRCFILEPO} file is ready. Can start translating."
    	else
    	   echo "No need to translate. Next, please ;)"
    	fi
         else
            echo "Source file ${SRCFILE}.php NOT found."
            echo ""
            exit 1
         fi
    fi
    #
     
    echo "Done. "
     
    exit $exitcode

    Hope it helps.

Comments are closed.