admin-fscheck.tpl.php
9 years ago
admin-list.tpl.php
9 years ago
admin-nav.tpl.php
9 years ago
admin-opts.tpl.php
9 years ago
admin-poedit.tpl.php
9 years ago
admin-poinit.tpl.php
9 years ago
admin-root.tpl.php
9 years ago
admin-poedit.tpl.php
164 lines
| 1 | <?php |
| 2 | /** |
| 3 | * PO file editor screen |
| 4 | */ |
| 5 | $nav = array ( |
| 6 | __('Packages','loco-translate') => array( 'href' => LocoAdmin::uri() ), |
| 7 | __('Settings','loco-translate') => array( 'href' => LocoAdmin::uri( array(), 'settings' ), 'icon' => 'admin-settings' ), |
| 8 | // |
| 9 | $name => array( 'icon' => 'POT' === $type ? 'edit' : 'translation' ), |
| 10 | ); |
| 11 | |
| 12 | $phpbase = Loco::html( Loco::baseurl() ).'/php'; |
| 13 | $argpair = $package->get_query(); |
| 14 | |
| 15 | // whether to show file switcher |
| 16 | $pofiles = $package->get_gettext_files(); |
| 17 | $modified or $pofiles[] = $path; |
| 18 | |
| 19 | ?> |
| 20 | <div class="wrap loco-admin loco-edit"><?php |
| 21 | |
| 22 | // Main navigation |
| 23 | Loco::render('admin-nav', compact('nav') )?> |
| 24 | |
| 25 | <h3 class="title"><?php |
| 26 | |
| 27 | // print flag or template indicator |
| 28 | if( $locale ):?> |
| 29 | <span class="<?php echo $locale->icon_class()?>"></span> <?php |
| 30 | Loco::h( $locale->get_name() )?>:<?php |
| 31 | else: |
| 32 | Loco::h( __('Template file','loco-translate') )?>: <?php |
| 33 | endif; |
| 34 | |
| 35 | // print switcher if more than one file available |
| 36 | if( 1 < count($pofiles) ):?> |
| 37 | <form action="#" class="loco-switcher"> |
| 38 | <select onchange="void function(u){ u && location.assign(u) }( this.options[this.options.selectedIndex].value);"> |
| 39 | <option value=""> |
| 40 | <?php Loco::h(_x('Switch to...','Dropdown label','loco-translate'))?> |
| 41 | </option><?php |
| 42 | // drop down of files in package |
| 43 | $poname = str_replace( '.mo', '.po', basename( $path ) ); |
| 44 | foreach( $pofiles as $_path ): |
| 45 | $label = str_replace( '.mo', '.po', basename($_path) ); |
| 46 | $url = LocoAdmin::edit_uri( $package, $_path ); |
| 47 | ?> |
| 48 | <option value="<?php Loco::h($url)?>" <?php $poname === $label and print('selected')?>> |
| 49 | <?php Loco::h($label)?> |
| 50 | </option><?php |
| 51 | endforeach?> |
| 52 | </select> |
| 53 | </form><?php |
| 54 | endif?> |
| 55 | |
| 56 | <span class="loco-meta"> |
| 57 | <?php Loco::h( _x('Updated','Modified time','loco-translate') )?>: |
| 58 | <span id="loco-po-modified"> |
| 59 | <?php if( $modified ):?> |
| 60 | <?php Loco::h($modified)?> |
| 61 | <?php else:?> |
| 62 | <em><?php Loco::h( __('never','loco-translate') )?></em> |
| 63 | <?php endif?> |
| 64 | </span> |
| 65 | — |
| 66 | <span id="loco-po-status"> |
| 67 | <!-- js will load status --> |
| 68 | </span> |
| 69 | </span> |
| 70 | </h3> |
| 71 | |
| 72 | |
| 73 | <?php foreach( $warnings as $text ): LocoAdmin::warning($text); endforeach?> |
| 74 | |
| 75 | |
| 76 | <div id="loco-poedit"> |
| 77 | |
| 78 | <nav id="loco-nav" class="wp-core-ui"> |
| 79 | <form action="<?php echo $phpbase?>/loco-fail.php" method="post" id="loco-poedit-save"> |
| 80 | <input type="hidden" name="po" value="" /> |
| 81 | <input type="hidden" name="path" value="<?php Loco::h($path)?>" /> |
| 82 | <input type="hidden" name="action" value="loco-posave" /><?php |
| 83 | foreach( $argpair as $k => $v ):?> |
| 84 | <input type="hidden" name="<?php Loco::h($k)?>" value="<?php Loco::h($v)?>" /><?php |
| 85 | endforeach?> |
| 86 | <button class="button loco-save" data-loco="save" type="submit" disabled> |
| 87 | <span><?php Loco::h( _x('Save','Editor button','loco-translate') )?></span> |
| 88 | </button> |
| 89 | </form> |
| 90 | <form action="<?php echo $phpbase?>/loco-fail.php" method="post"> |
| 91 | <input type="hidden" name="po" value="" /> |
| 92 | <input type="hidden" name="action" value="loco-download" /> |
| 93 | <input type="hidden" name="path" value="<?php Loco::h($path)?>" /> |
| 94 | <button class="button loco-download" data-loco="download_po" type="submit" disabled title="<?php Loco::h( _x('Download','Editor button','loco-translate') )?> PO"> |
| 95 | <span><?php echo $locale ? 'PO' : 'POT' ?></span> |
| 96 | </button> |
| 97 | </form><?php |
| 98 | if( $locale ):?> |
| 99 | <form action="<?php echo $phpbase?>/loco-fail.php" method="post"> |
| 100 | <input type="hidden" name="po" value="" /> |
| 101 | <input type="hidden" name="action" value="loco-download" /> |
| 102 | <input type="hidden" name="path" value="<?php Loco::h( preg_replace('/\.po$/','.mo',$path) )?>" /> |
| 103 | <button class="button loco-download" data-loco="download_mo" type="submit" disabled title="<?php Loco::h( _x('Download','Editor button','loco-translate') )?> MO"> |
| 104 | <span>MO</span> |
| 105 | </button> |
| 106 | </form><?php |
| 107 | endif?> |
| 108 | <form action="<?php echo $phpbase?>/loco-fail.php" method="post"> |
| 109 | <input type="hidden" name="path" value="<?php Loco::h($path)?>" /> |
| 110 | <input type="hidden" name="action" value="loco-posync" /><?php |
| 111 | foreach( $argpair as $k => $v ):?> |
| 112 | <input type="hidden" name="<?php Loco::h($k)?>" value="<?php Loco::h($v)?>" /><?php |
| 113 | endforeach?> |
| 114 | <button class="button loco-sync" data-loco="sync" disabled> |
| 115 | <span><?php Loco::h( _x('Sync','Editor button','loco-translate') )?></span> |
| 116 | </button> |
| 117 | </form> |
| 118 | <form action="<?php echo $phpbase?>/loco-fail.php" method="get"> |
| 119 | <button class="button loco-revert" data-loco="revert" disabled> |
| 120 | <span><?php Loco::h( _x('Revert','Editor button','loco-translate') )?></span> |
| 121 | </button> |
| 122 | </form> |
| 123 | <form action="<?php echo $phpbase?>/loco-fail.php"> |
| 124 | <button class="button loco-add" data-loco="add" disabled> |
| 125 | <span><?php Loco::h( _x('Add','Editor button','loco-translate') )?></span> |
| 126 | </button> |
| 127 | </form> |
| 128 | <form action="<?php echo $phpbase?>/loco-fail.php"> |
| 129 | <button class="button loco-del" data-loco="del" disabled> |
| 130 | <span><?php Loco::h( _x('Del','Editor button','loco-translate') )?></span> |
| 131 | </button> |
| 132 | </form> |
| 133 | <form action="<?php echo $phpbase?>/loco-fail.php"> |
| 134 | <button class="button loco-fuzzy" data-loco="fuzzy" disabled> |
| 135 | <span><?php Loco::h( _x('Fuzzy','Editor button','loco-translate') )?></span> |
| 136 | </button> |
| 137 | </form> |
| 138 | <form action="<?php echo $phpbase?>/loco-fail.php" id="loco-filter"> |
| 139 | <div class="loco-clearable"> |
| 140 | <input type="text" maxlength="100" name="q" id="loco-search" placeholder="<?php Loco::h(__('Filter translations','loco-translate'))?>" autocomplete="off" disabled /> |
| 141 | </div> |
| 142 | </form> |
| 143 | <form action="https://localise.biz/help/wordpress/translate-plugin/support" target="_blank" class="loco-right"> |
| 144 | <button class="button loco-help" data-loco="help" type="submit"> |
| 145 | <span><?php Loco::h( _x('Help','Editor button','loco-translate') )?></span> |
| 146 | </button> |
| 147 | </form> |
| 148 | </nav> |
| 149 | |
| 150 | <div id="loco-poedit-inner" class="loco-editor loading"> |
| 151 | <span>Loading..</span> |
| 152 | </div> |
| 153 | |
| 154 | </div> |
| 155 | |
| 156 | |
| 157 | <script> |
| 158 | loco = window.loco || {}; |
| 159 | loco.conf = <?php echo json_encode( compact('po','pot','headers') + array( |
| 160 | 'locale' => $locale ? $locale->export() : null, |
| 161 | ) )?>; |
| 162 | </script> |
| 163 | |
| 164 | </div> |