pub struct Php;Expand description
The PHP array resource filter.
Implementations§
Trait Implementations§
Source§impl Filter for Php
impl Filter for Php
Source§fn sniff(&self, bytes: &[u8]) -> bool
fn sniff(&self, bytes: &[u8]) -> bool
True when the whole file is a static PHP language file: it starts with <?php, parses, and holds at least one
return or assignment statement. Tight enough to be put anywhere in the filter list.
Source§fn extensions(&self) -> &'static [&'static str]
fn extensions(&self) -> &'static [&'static str]
Lowercase extensions without the dot, e.g.
["html", "htm"].Source§fn extract(
&self,
bytes: &[u8],
opts: &ExtractOptions,
) -> Result<Document, Error>
fn extract( &self, bytes: &[u8], opts: &ExtractOptions, ) -> Result<Document, Error>
Source file to document. One segment per unit; no sentence splitting here.
Source§fn merge_with(
&self,
doc: &Document,
opts: &MergeOptions,
) -> Result<Vec<u8>, Error>
fn merge_with( &self, doc: &Document, opts: &MergeOptions, ) -> Result<Vec<u8>, Error>
Document back to a file in the original format, targets in place of sources, with
MergeOptions. Every
format honours both options: output_encoding (keep the file’s encoding, or write UTF-8) and
stamp_target_always (stamp the target language and fill plurals even when nothing is translated; the
rule is MergeOptions::should_stamp).Source§fn bilingual(&self) -> bool
fn bilingual(&self) -> bool
True when the format carries source and target (PO, XLIFF and the like): its extract may fill segment
targets and states. False for source files.
Source§fn format_option_keys(&self) -> &'static [FormatOptionKey]
fn format_option_keys(&self) -> &'static [FormatOptionKey]
The
ExtractOptions::format_options keys this filter reads ("csv.columns", …), each with the
<family>. prefix of its format. The facade refuses keys no filter declares; the filter itself refuses
undeclared keys of its own families (check_own_options). Default: none.Source§fn merge(&self, doc: &Document) -> Result<Vec<u8>, Error>
fn merge(&self, doc: &Document) -> Result<Vec<u8>, Error>
Filter::merge_with with the default options: the file’s own encoding, and no stamp when nothing is
translated (an untouched merge gives the original bytes).Source§fn preview(&self, _doc: &Document) -> Option<String>
fn preview(&self, _doc: &Document) -> Option<String>
For formats a browser can show: the translated document as HTML in which every segment’s text sits in
<span data-bl-seg="SEGMENT_ID">..</span>, so a live preview can patch one segment without reloading.
Scripts must be stripped. None when the format has no preview.Auto Trait Implementations§
impl Forget for Php
impl Freeze for Php
impl Move for Php
impl RefUnwindSafe for Php
impl Send for Php
impl Sync for Php
impl Unpin for Php
impl UnsafeUnpin for Php
impl UnwindSafe for Php
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more