From 92d5574f13d36fbc03f6fbda7fb637fbf8d932e2 Mon Sep 17 00:00:00 2001 From: carstenklapp Date: Thu, 27 Dec 2001 07:58:36 +0000 Subject: [PATCH] Added a note how to auto-activate po-mode in emacs. Minor text reformatting. git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@903 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- doc/README.coding | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/doc/README.coding b/doc/README.coding index 9b8f87f88..3bb7b9cb3 100644 --- a/doc/README.coding +++ b/doc/README.coding @@ -1,4 +1,3 @@ -$Id: README.coding,v 1.2 2001-12-16 18:33:25 dairiki Exp $ Here are the coding guidelines for PhpWiki. @@ -6,7 +5,7 @@ Here are the coding guidelines for PhpWiki. We follow, for the most part, the PEAR coding standards: -* http://www.php.net/manual/en/pear.standards.php + There's code snippets for configuring Emacs and Vim as well as several other text editors at the above URL. @@ -17,12 +16,12 @@ For editing files in Emacs, set indent-tabs-mode to nil. Some people argue that it's better to use tabs and let people set their tab width, but I think we're better off using just spaces because aligned comments in the right region will not align correctly. For a detailed -argument see http://www.jwz.org/doc/tabs-vs-spaces.html. -Also use a tab-width of eight, so that just in case tabs do creep -into the source code, they have a standard width. +argument see . Also use a +tab-width of eight, so that just in case tabs do creep into the source +code, they have a standard width. Use php-mode as well. This is freely available on the net -(http://sourceforge.net/projects/php-mode/). Put something like this +. Put something like this in your .emacs file: (autoload 'php-mode "php-mode" "PHP editing mode" t) @@ -46,23 +45,33 @@ in your .emacs file: !!! I18N: Using gettext() -String literals which end up making it into the HTML output should be wrapped -with a call to ''gettext()''. This allows translations to be substituted when -PhpWiki is run in non-english environments. +String literals which end up making it into the HTML output should be +wrapped with a call to ''gettext()''. This allows translations to be +substituted when PhpWiki is run in non-english environments. -Since xgettext (part of the "GNU gettext utilities") is used to find strings -for translation, It is important that the argument of ''gettext()'' be a constant -string literal, in double quotes ("). +Since xgettext (part of the "GNU gettext utilities") is used to find +strings for translation, It is important that the argument of +''gettext()'' be a constant string literal, in double quotes ("). -(You can now use _("foo") as an alias for gettext("foo").) +You can now use _("foo") as an alias for gettext("foo"). OKAY: gettext("This is a message."); OKAY: _("Fazool."); - OKAY: sprintf(gettext("Hello %s"), $name); + OKAY: sprintf(_("Hello %s"), $name); OKAY: sprintf(_("Hello %s"), $name); - BAD: gettext('This will be ignored by xgettext.'); + BAD: _('This will be ignored by xgettext.'); BAD: _("Howdy" . ", wazoo"); - BAD: gettext("Hello $name"); + BAD: _("Hello $name"); BAD: define("MES", "howdy"); gettext(MES); - BAD: gettext($string); + BAD: _($string); + +If you want Emacs po mode to automatically kick-in when you edit a po +file, add the following to your .emacs file: + + (setq auto-mode-alist + (cons '("\\.po[tx]?\\'\\|\\.po\\." . po-mode) auto-mode-alist)) + (autoload 'po-mode "po-mode") + + +$Id: README.coding,v 1.3 2001-12-27 07:58:36 carstenklapp Exp $ -- 2.45.0