diff options
author | Filip Komar <filip@mageia.org> | 2013-06-20 21:47:39 +0000 |
---|---|---|
committer | Filip Komar <filip@mageia.org> | 2013-06-20 21:47:39 +0000 |
commit | 72ca7f736e3d6789896e22aaad2da30946a050be (patch) | |
tree | c2a2c8ce5dff0b3a43ac6d93fb62c7ea190ca8cb | |
parent | f980d553b806a70ced4f05a2b95b673847a3a924 (diff) | |
download | www-72ca7f736e3d6789896e22aaad2da30946a050be.tar www-72ca7f736e3d6789896e22aaad2da30946a050be.tar.gz www-72ca7f736e3d6789896e22aaad2da30946a050be.tar.bz2 www-72ca7f736e3d6789896e22aaad2da30946a050be.tar.xz www-72ca7f736e3d6789896e22aaad2da30946a050be.zip |
first license test (bug # 10424)
l--------- | cs/about/license | 1 | ||||
l--------- | de/about/license | 1 | ||||
l--------- | el/about/license | 1 | ||||
-rw-r--r-- | en/about/license/index.php | 92 | ||||
-rw-r--r-- | en/about/license/php-mo.php | 232 | ||||
l--------- | es/about/license | 1 | ||||
l--------- | et/about/license | 1 | ||||
l--------- | fi/about/license | 1 | ||||
l--------- | fr/about/license | 1 | ||||
l--------- | it/about/license | 1 | ||||
l--------- | lv/about/license | 1 | ||||
l--------- | nl/about/license | 1 | ||||
l--------- | pl/about/license | 1 | ||||
l--------- | pt-br/about/license | 1 | ||||
l--------- | pt/about/license | 1 | ||||
l--------- | ro/about/license | 1 | ||||
l--------- | ru/about/license | 1 | ||||
l--------- | sl/about/license | 1 | ||||
l--------- | tr/about/license | 1 | ||||
l--------- | zh-tw/about/license | 1 |
20 files changed, 342 insertions, 0 deletions
diff --git a/cs/about/license b/cs/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/cs/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/de/about/license b/de/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/de/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/el/about/license b/el/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/el/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/en/about/license/index.php b/en/about/license/index.php new file mode 100644 index 000000000..f7add6425 --- /dev/null +++ b/en/about/license/index.php @@ -0,0 +1,92 @@ +<?php + +define('HLANG', true); +require '../../../langs.php'; +//$locale = 'sl'; // qq debug +_lang_load($locale, 'about/license'); + +require('php-mo.php'); + +if($locale == 'en') { // this can be done better maybe with preg_replace strtoupper combo + $po_locale = 'libDrakX.pot'; +} else if($locale == 'pa_in') { + $po_locale = 'pa_IN.po'; +} else if($locale == 'pt_br') { + $po_locale = 'pt_BR.po'; +} else if($locale == 'zh_cn') { + $po_locale = 'zh_CN.po'; +} else if($locale == 'zh_tw') { + $po_locale = 'zh_TW.po'; +} else { + $po_locale = "$locale.po"; +} + +//$po_files_path = "../../../../drakx_share/"; // qq debug +//$po_files_end = ""; // qq debug +$po_files_path = "http://svnweb.mageia.org/soft/drakx/trunk/perl-install/share/po/"; +$po_files_end = "?view=co"; + +$po_file = phpmo_parse_po_file($po_files_path . $po_locale . $po_files_end); +if($po_file === false) { +// echo "ERROR loading " . $po_files_path . $po_locale . $po_files_end; // qq debug + $po_file = phpmo_parse_po_file($po_files_path . "libDrakX.pot" . $po_files_end); +} +if($po_file === false) { +// echo "ERROR loading " . $po_files_path . "libDrakX.pot" . $po_files_end; // qq debug +} +//var_dump($po_file); // qq debug + +$license_strings = array(); + +$license_strings[] = array('_: You can warn about unofficial translation here'); +$license_strings[] = array('The operating system and the different components available in the Mageia distribution \nshall be called the \"Software Products\" hereafter. The Software Products include, but are not \nrestricted to, the set of programs, methods, rules and documentation related to the operating \nsystem and the different components of the Mageia distribution, and any applications \ndistributed with these products provided by Mageia\'s licensors or suppliers.'); +$license_strings[] = array('1. License Agreement', 'h3'); +$license_strings[] = array('Please read this document carefully. This document is a license agreement between you and \nMageia which applies to the Software Products.\nBy installing, duplicating or using any of the Software Products in any manner, you explicitly \naccept and fully agree to conform to the terms and conditions of this License. \nIf you disagree with any portion of the License, you are not allowed to install, duplicate or use \nthe Software Products. \nAny attempt to install, duplicate or use the Software Products in a manner which does not comply \nwith the terms and conditions of this License is void and will terminate your rights under this \nLicense. Upon termination of the License, you must immediately destroy all copies of the \nSoftware Products.'); +$license_strings[] = array('2. Limited Warranty', 'h3'); +$license_strings[] = array('The Software Products and attached documentation are provided \"as is\", with no warranty, to the \nextent permitted by law.\nNeither Mageia nor its licensors or suppliers will, in any circumstances and to the extent \npermitted by law, be liable for any special, incidental, direct or indirect damages whatsoever \n(including without limitation damages for loss of business, interruption of business, financial \nloss, legal fees and penalties resulting from a court judgment, or any other consequential loss) \narising out of the use or inability to use the Software Products, even if Mageia or its \nlicensors or suppliers have been advised of the possibility or occurrence of such damages.\n\nLIMITED LIABILITY LINKED TO POSSESSING OR USING PROHIBITED SOFTWARE IN SOME COUNTRIES\n\nTo the extent permitted by law, neither Mageia nor its licensors, suppliers or\ndistributors will, in any circumstances, be liable for any special, incidental, direct or indirect \ndamages whatsoever (including without limitation damages for loss of business, interruption of \nbusiness, financial loss, legal fees and penalties resulting from a court judgment, or any \nother consequential loss) arising out of the possession and use of software components or \narising out of downloading software components from one of Mageia sites which are \nprohibited or restricted in some countries by local laws.\nThis limited liability applies to, but is not restricted to, the strong cryptography components \nincluded in the Software Products.\nHowever, because some jurisdictions do not allow the exclusion or limitation or liability for \nconsequential or incidental damages, the above limitation may not apply to you.'); +$license_strings[] = array('3. The GPL License and Related Licenses', 'h3'); +$license_strings[] = array('The Software Products consist of components created by different persons or entities.\nMost of these licenses allow you to use, duplicate, adapt or redistribute the components which \nthey cover. Please read carefully the terms and conditions of the license agreement for each component \nbefore using any component. Any question on a component license should be addressed to the component \nlicensor or supplier and not to Mageia.\nThe programs developed by Mageia are governed by the GPL License. Documentation written \nby Mageia is governed by \"%s\" License.', null, 'CC-By-SA'); // "CC-By-SA" http://svnweb.mageia.org/soft/drakx/trunk/perl-install/messages.pm?revision=5942&view=markup +$license_strings[] = array('4. Intellectual Property Rights', 'h3'); +$license_strings[] = array('All rights to the components of the Software Products belong to their respective authors and are \nprotected by intellectual property and copyright laws applicable to software programs.\nMageia and its suppliers and licensors reserves their rights to modify or adapt the Software \nProducts, as a whole or in parts, by all means and for all purposes.\n\"Mageia\" and associated logos are trademarks of %s', null, 'Mageia.Org'); // "Mageia.Org" http://svnweb.mageia.org/soft/drakx/trunk/perl-install/messages.pm?revision=5942&view=markup +$license_strings[] = array('5. Governing Laws', 'h3'); +$license_strings[] = array('If any portion of this agreement is held void, illegal or inapplicable by a court judgment, this \nportion is excluded from this contract. You remain bound by the other applicable sections of the \nagreement.\nThe terms and conditions of this License are governed by the Laws of France.\nAll disputes on the terms of this license will preferably be settled out of court. As a last \nresort, the dispute will be referred to the appropriate Courts of Law of Paris - France.\nFor any question on this document, please contact Mageia.'); +$license_strings[] = array('Warning: Free Software may not necessarily be patent free, and some Free\nSoftware included may be covered by patents in your country. For example, the\nMP3 decoders included may require a license for further usage (see\nhttp://www.mp3licensing.com for more details). If you are unsure if a patent\nmay be applicable to you, check your local laws.'); + +?> +<!DOCTYPE html> +<html lang="<?php echo $locale; ?>"> +<head> + <meta charset="utf-8"> + <title><?php _e('Mageia license')?></title> + <link rel="stylesheet" href="/g/style/all.css"> + <style> + .para { text-align: left; float: left; display: block; } + hr { margin-top: 2em; } + </style> + <?php include '../../../analytics.php'; ?> +</head> +<body class="about"> + <?php echo $hsnav; ?> + <h1 id="mgnavtitle"><?php _e('Mageia license')?></h1> + <div id="doc" class="yui-t7"> + <div id="bd" role="main" class="para"> + <section> + <?php + echo '<div id="preamble">'; + _h('An introduction text ... (summarizing, explaining the core principles, and why this license was chosen).'); + echo '<p>' . sprintf(_t('See also %swiki page about licensing policy</a>.'), + '<a href="https://wiki.mageia.org/en/Licensing_policy">') . '</p></div>'; + _h('Mageia license', null, 'h2'); + $search = array('\\"','\n\n', '\n', ' '); + $replace = array('"','<br>', ' ', ' '); + foreach($license_strings as $value) { + $license_string = str_replace('%s', (isset($value[2]) ? $value[2] : ''), ((isset($po_file[$value[0]]["msgstr"][0]) && $locale != 'en') ? $po_file[$value[0]]["msgstr"][0] : $value[0])); + echo '<' . (isset($value[1]) ? $value[1] : 'p') . '>' . str_replace($search, $replace, $license_string) . '</' . (isset($value[1]) ? $value[1] : 'p') . '>'; + } + ?> + + </section> + </div> + </div> +</body> +</html> diff --git a/en/about/license/php-mo.php b/en/about/license/php-mo.php new file mode 100644 index 000000000..616440735 --- /dev/null +++ b/en/about/license/php-mo.php @@ -0,0 +1,232 @@ +<?php +/** + * php.mo 0.1 by Joss Crowcroft (http://www.josscrowcroft.com) + * + * Converts gettext translation '.po' files to binary '.mo' files in PHP. + * + * Usage: + * <?php require('php-mo.php'); phpmo_convert( 'input.po', [ 'output.mo' ] ); ?> + * + * NB: + * - If no $output_file specified, output filename is same as $input_file (but .mo) + * - Returns true/false for success/failure + * - No warranty, but if it breaks, please let me know + * + * More info: + * https://github.com/josscrowcroft/php.mo + * + * Based on php-msgfmt by Matthias Bauer (Copyright © 2007), a command-line PHP tool + * for converting .po files to .mo. + * (http://wordpress-soc-2007.googlecode.com/svn/trunk/moeffju/php-msgfmt/msgfmt.php) + * + * License: GPL v3 http://www.opensource.org/licenses/gpl-3.0.html + */ + +/** + * The main .po to .mo function + */ +function phpmo_convert($input, $output = false) { + if ( !$output ) + $output = str_replace( '.po', '.mo', $input ); + + $hash = phpmo_parse_po_file( $input ); + if ( $hash === false ) { + return false; + } else { + phpmo_write_mo_file( $hash, $output ); + return true; + } +} + +function phpmo_clean_helper($x) { + if (is_array($x)) { + foreach ($x as $k => $v) { + $x[$k] = phpmo_clean_helper($v); + } + } else { + if ($x[0] == '"') + $x = substr($x, 1, -1); + $x = str_replace("\"\n\"", '', $x); + $x = str_replace('$', '\\$', $x); + } + return $x; +} + +/* Parse gettext .po files. */ +/* @link http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files */ +function phpmo_parse_po_file($in) { + // read .po file + $fh = fopen($in, 'r'); + if ($fh === false) { + // Could not open file resource + return false; + } + + // results array + $hash = array (); + // temporary array + $temp = array (); + // state + $state = null; + $fuzzy = false; + $num = 0; // qq + + // iterate over lines + while(($line = fgets($fh, 65536)) !== false) { + $num++; // qq + $line = trim($line); + if ($line === '') + continue; + + $array_of_splited_string = preg_split('/\s/', $line, 2); + $key = $array_of_splited_string[0]; + $data = (isset($array_of_splited_string[1]) ? $array_of_splited_string[1] : ''); + +// echo PHP_EOL . ' $key: ' . $key . ' ' . PHP_EOL . '$data: ' . $data . ' ' . PHP_EOL . '$line: ' . $line . PHP_EOL; + + switch ($key) { + case '#,' : // flag... + $fuzzy = in_array('fuzzy', preg_split('/,\s*/', $data)); + case '#' : // translator-comments + case '#.' : // extracted-comments + case '#:' : // reference... + case '#|' : // msgid previous-untranslated-string + // start a new entry + if (sizeof($temp) && array_key_exists('msgid', $temp) && array_key_exists('msgstr', $temp)) { + if (!$fuzzy) + $hash[] = $temp; + $temp = array (); + $state = null; + $fuzzy = false; + } + break; + case 'msgctxt' : + // context + case 'msgid' : + // untranslated-string + case 'msgid_plural' : + // untranslated-string-plural + $state = $key; + $temp[$state] = $data; + break; + case 'msgstr' : + // translated-string + $state = 'msgstr'; + $temp[$state][] = $data; + break; + default : + if (strpos($key, 'msgstr[') !== FALSE) { + // translated-string-case-n + $state = 'msgstr'; + $temp[$state][] = $data; + } else { + // continued lines + switch ($state) { + case 'msgctxt' : + case 'msgid' : + case 'msgid_plural' : + $temp[$state] .= "\n" . $line; + break; + case 'msgstr' : + $temp[$state][sizeof($temp[$state]) - 1] .= "\n" . $line; + break; + default : + // parse error + fclose($fh); + echo ' $line: ' . $line . ' $key: ' . $key . ' $num: ' . $num . ' $data: ' . $data . ' $state: ' . $state . ' '; // qq + return FALSE; + } + } + break; + } + } + fclose($fh); + + // add final entry + if ($state == 'msgstr') + $hash[] = $temp; + + // Cleanup data, merge multiline entries, reindex hash for ksort + $temp = $hash; + $hash = array (); + foreach ($temp as $entry) { + foreach ($entry as & $v) { + $v = phpmo_clean_helper($v); + if ($v === FALSE) { + // parse error + return FALSE; + } + } + $hash[$entry['msgid']] = $entry; + } + + return $hash; +} + +/* Write a GNU gettext style machine object. */ +/* @link http://www.gnu.org/software/gettext/manual/gettext.html#MO-Files */ +function phpmo_write_mo_file($hash, $out) { + // sort by msgid + ksort($hash, SORT_STRING); + // our mo file data + $mo = ''; + // header data + $offsets = array (); + $ids = ''; + $strings = ''; + + foreach ($hash as $entry) { + $id = $entry['msgid']; + if (isset ($entry['msgid_plural'])) + $id .= "\x00" . $entry['msgid_plural']; + // context is merged into id, separated by EOT (\x04) + if (array_key_exists('msgctxt', $entry)) + $id = $entry['msgctxt'] . "\x04" . $id; + // plural msgstrs are NUL-separated + $str = implode("\x00", $entry['msgstr']); + // keep track of offsets + $offsets[] = array ( + strlen($ids + ), strlen($id), strlen($strings), strlen($str)); + // plural msgids are not stored (?) + $ids .= $id . "\x00"; + $strings .= $str . "\x00"; + } + + // keys start after the header (7 words) + index tables ($#hash * 4 words) + $key_start = 7 * 4 + sizeof($hash) * 4 * 4; + // values start right after the keys + $value_start = $key_start +strlen($ids); + // first all key offsets, then all value offsets + $key_offsets = array (); + $value_offsets = array (); + // calculate + foreach ($offsets as $v) { + list ($o1, $l1, $o2, $l2) = $v; + $key_offsets[] = $l1; + $key_offsets[] = $o1 + $key_start; + $value_offsets[] = $l2; + $value_offsets[] = $o2 + $value_start; + } + $offsets = array_merge($key_offsets, $value_offsets); + + // write header + $mo .= pack('Iiiiiii', 0x950412de, // magic number + 0, // version + sizeof($hash), // number of entries in the catalog + 7 * 4, // key index offset + 7 * 4 + sizeof($hash) * 8, // value index offset, + 0, // hashtable size (unused, thus 0) + $key_start // hashtable offset + ); + // offsets + foreach ($offsets as $offset) + $mo .= pack('i', $offset); + // ids + $mo .= $ids; + // strings + $mo .= $strings; + + file_put_contents($out, $mo); +} +?>
\ No newline at end of file diff --git a/es/about/license b/es/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/es/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/et/about/license b/et/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/et/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/fi/about/license b/fi/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/fi/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/fr/about/license b/fr/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/fr/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/it/about/license b/it/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/it/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/lv/about/license b/lv/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/lv/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/nl/about/license b/nl/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/nl/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/pl/about/license b/pl/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/pl/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/pt-br/about/license b/pt-br/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/pt-br/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/pt/about/license b/pt/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/pt/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/ro/about/license b/ro/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/ro/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/ru/about/license b/ru/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/ru/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/sl/about/license b/sl/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/sl/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/tr/about/license b/tr/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/tr/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file diff --git a/zh-tw/about/license b/zh-tw/about/license new file mode 120000 index 000000000..cbc541ebb --- /dev/null +++ b/zh-tw/about/license @@ -0,0 +1 @@ +../../en/about/license
\ No newline at end of file |