r73287 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73286‎ | r73287 | r73288 >
Date:13:48, 18 September 2010
Author:siebrand
Status:deferred
Tags:
Comment:
Move script to where the file is it can create.

Follows-up CR on r73253 and r73286.
Modified paths:
  • /trunk/extensions/Translate/groups/StatusNet/genStatusNet-plugins.php (added) (history)
  • /trunk/extensions/Translate/scripts/genStatusNet-plugins.php (deleted) (history)

Diff [purge]

Index: trunk/extensions/Translate/scripts/genStatusNet-plugins.php
@@ -1,101 +0,0 @@
2 -<?php
3 -/**
4 - * Quick script to generate YAML configuration for StatusNet plugins.
5 - *
6 - * @todo Use Maitenance class and add target option for writing output file.
7 - */
8 -
9 -$plugins = array();
10 -
11 -function getPotFiles( $path, $pattern ) {
12 - global $plugins;
13 -
14 - $path = rtrim( str_replace( "\\", "/", $path ), '/' ) . '/';
15 - $matches = Array();
16 - $entries = Array();
17 - $dir = dir( $path );
18 - while ( false !== ( $entry = $dir->read() ) ) {
19 - $entries[] = $entry;
20 - }
21 - $dir->close();
22 - foreach ( $entries as $entry ) {
23 - $fullname = $path . $entry;
24 - if ( $entry != '.' && $entry != '..' && is_dir( $fullname ) ) {
25 - $subFolderResults = getPotFiles( $fullname, $pattern );
26 - } else if ( is_file( $fullname ) && preg_match( $pattern, $entry ) ) {
27 - $pathParts = explode( '/', $fullname );
28 - $plugins[] = substr( array_pop( $pathParts ), 0, -4 );
29 - }
30 - }
31 -}
32 -
33 -$baseFolder = '/home/betawiki/projects/statusnet/plugins/';
34 -$filePattern = '/[.]pot$/';
35 -
36 -getPotFiles( $baseFolder, $filePattern );
37 -
38 -$header = <<<PHP
39 -TEMPLATE:
40 - BASIC:
41 - description: "{{int:translate-group-desc-statusnet-plugin}}"
42 - namespace: NS_STATUSNET
43 - display: out/statusnet/
44 - class: FileBasedMessageGroup
45 -
46 - FILES:
47 - class: GettextFFS
48 - codeMap:
49 - en-gb: en_GB
50 - en-us: en_US
51 - nl-be: nl_BE
52 - no: nb
53 - pt-br: pt_BR
54 - zh-hans: zh_CN
55 - zh-hant: zh_TW
56 -
57 - header: |
58 - # This file is distributed under the same license as the StatusNet package.
59 - #
60 -
61 - MANGLER:
62 - class: StringMatcher
63 - patterns:
64 - - "*"
65 -
66 - CHECKER:
67 - class: MessageChecker
68 - checks:
69 - - printfCheck
70 -PHP;
71 -
72 -echo $header . "\n";
73 -
74 -$basePluginFolder = "statusnet/plugins/";
75 -$localeFolder = "/locale/%CODE%/LC_MESSAGES/";
76 -
77 -asort( $plugins );
78 -$numberPlugins = count( $plugins );
79 -$count = 0;
80 -
81 -foreach ( $plugins as $plugin ) {
82 - $pluginL = strtolower( $plugin );
83 -
84 - echo "BASIC:\n";
85 - echo " id: out-statusnet-plugin-" . $pluginL . "\n";
86 - echo " label: StatusNet - " . $plugin . "\n";
87 - echo " display: out/statusnet/plugin/" . $pluginL . "\n";
88 - echo " codeBrowser: http://gitorious.org/statusnet/mainline/blobs/0.9.x/plugins/" . $plugin . "/%FILE%#line%LINE%\n\n";
89 - echo "FILES:\n";
90 - echo " sourcePattern: %GROUPROOT%/" . $basePluginFolder . $plugin . $localeFolder . $plugin . ".po\n";
91 - echo " definitionFile: %GROUPROOT%/" . $basePluginFolder . $plugin . "/locale/" . $plugin . ".pot\n";
92 - echo " targetPattern: " . $basePluginFolder . $plugin . $localeFolder . $plugin . ".po\n\n";
93 - echo "MANGLER:\n";
94 - echo " prefix: " . $pluginL . "-\n";
95 -
96 - $count++;
97 -
98 - if ( $count < $numberPlugins ) {
99 - echo "---\n";
100 - }
101 -}
Index: trunk/extensions/Translate/groups/StatusNet/genStatusNet-plugins.php
@@ -0,0 +1,101 @@
 2+<?php
 3+/**
 4+ * Quick script to generate YAML configuration for StatusNet plugins.
 5+ *
 6+ * @todo Use Maitenance class and add target option for writing output file.
 7+ */
 8+
 9+$plugins = array();
 10+
 11+function getPotFiles( $path, $pattern ) {
 12+ global $plugins;
 13+
 14+ $path = rtrim( str_replace( "\\", "/", $path ), '/' ) . '/';
 15+ $matches = Array();
 16+ $entries = Array();
 17+ $dir = dir( $path );
 18+ while ( false !== ( $entry = $dir->read() ) ) {
 19+ $entries[] = $entry;
 20+ }
 21+ $dir->close();
 22+ foreach ( $entries as $entry ) {
 23+ $fullname = $path . $entry;
 24+ if ( $entry != '.' && $entry != '..' && is_dir( $fullname ) ) {
 25+ $subFolderResults = getPotFiles( $fullname, $pattern );
 26+ } else if ( is_file( $fullname ) && preg_match( $pattern, $entry ) ) {
 27+ $pathParts = explode( '/', $fullname );
 28+ $plugins[] = substr( array_pop( $pathParts ), 0, -4 );
 29+ }
 30+ }
 31+}
 32+
 33+$baseFolder = '/home/betawiki/projects/statusnet/plugins/';
 34+$filePattern = '/[.]pot$/';
 35+
 36+getPotFiles( $baseFolder, $filePattern );
 37+
 38+$header = <<<PHP
 39+TEMPLATE:
 40+ BASIC:
 41+ description: "{{int:translate-group-desc-statusnet-plugin}}"
 42+ namespace: NS_STATUSNET
 43+ display: out/statusnet/
 44+ class: FileBasedMessageGroup
 45+
 46+ FILES:
 47+ class: GettextFFS
 48+ codeMap:
 49+ en-gb: en_GB
 50+ en-us: en_US
 51+ nl-be: nl_BE
 52+ no: nb
 53+ pt-br: pt_BR
 54+ zh-hans: zh_CN
 55+ zh-hant: zh_TW
 56+
 57+ header: |
 58+ # This file is distributed under the same license as the StatusNet package.
 59+ #
 60+
 61+ MANGLER:
 62+ class: StringMatcher
 63+ patterns:
 64+ - "*"
 65+
 66+ CHECKER:
 67+ class: MessageChecker
 68+ checks:
 69+ - printfCheck
 70+---
 71+PHP;
 72+
 73+echo $header . "\n";
 74+
 75+$basePluginFolder = "statusnet/plugins/";
 76+$localeFolder = "/locale/%CODE%/LC_MESSAGES/";
 77+
 78+asort( $plugins );
 79+$numberPlugins = count( $plugins );
 80+$count = 0;
 81+
 82+foreach ( $plugins as $plugin ) {
 83+ $pluginL = strtolower( $plugin );
 84+
 85+ echo "BASIC:\n";
 86+ echo " id: out-statusnet-plugin-" . $pluginL . "\n";
 87+ echo " label: StatusNet - " . $plugin . "\n";
 88+ echo " display: out/statusnet/plugin/" . $pluginL . "\n";
 89+ echo " codeBrowser: http://gitorious.org/statusnet/mainline/blobs/0.9.x/plugins/" . $plugin . "/%FILE%#line%LINE%\n\n";
 90+ echo "FILES:\n";
 91+ echo " sourcePattern: %GROUPROOT%/" . $basePluginFolder . $plugin . $localeFolder . $plugin . ".po\n";
 92+ echo " definitionFile: %GROUPROOT%/" . $basePluginFolder . $plugin . "/locale/" . $plugin . ".pot\n";
 93+ echo " targetPattern: " . $basePluginFolder . $plugin . $localeFolder . $plugin . ".po\n\n";
 94+ echo "MANGLER:\n";
 95+ echo " prefix: " . $pluginL . "-\n";
 96+
 97+ $count++;
 98+
 99+ if ( $count < $numberPlugins ) {
 100+ echo "---\n";
 101+ }
 102+}
Property changes on: trunk/extensions/Translate/groups/StatusNet/genStatusNet-plugins.php
___________________________________________________________________
Added: svn:eol-style
1103 + native
Added: svn:keywords
2104 + Id

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r73253* Update StatusNet-plugins.yaml with all plugins that have i18n...siebrand21:57, 17 September 2010
r73286Rename script filesiebrand13:47, 18 September 2010

Status & tagging log