Units API.

See the Weblate's Web API documentation for detailed description of the API.

GET /api/units/9299104/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "translation": "https://l10n.opensuse.org/api/translations/packages-i18n/perl-master/ja/?format=api",
    "source": [
        "An 'HTTP::Message' object contains some headers and a content body. The following methods are available: \n* $mess = HTTP::Message->new \n* $mess = HTTP::Message->new( $headers ) \n* $mess = HTTP::Message->new( $headers, $content )\n\nThis constructs a new message object. Normally you would want construct 'HTTP::Request' or 'HTTP::Response' objects instead.\n\nThe optional $header argument should be a reference to an 'HTTP::Headers' object or a plain array reference of key/value pairs. If an 'HTTP::Headers' object is provided then a copy of it will be embedded into the constructed message, i.e. it will not be owned and can be modified afterwards without affecting the message.\n\nThe optional $content argument should be a string of bytes. \n* $mess = HTTP::Message->parse( $str )\n\nThis constructs a new message object by parsing the given string. \n* $mess->headers\n\nReturns the embedded 'HTTP::Headers' object. \n* $mess->headers_as_string \n* $mess->headers_as_string( $eol )\n\nCall the as_string() method for the headers in the message. This will be the same as\n\n    $mess->headers->as_string\n\nbut it will make your program a whole character shorter :-) \n* $mess->content \n* $mess->content( $bytes )\n\nThe content() method sets the raw content if an argument is given. If no argument is given the content is not touched. In either case the original raw content is returned.\n\nIf the 'undef' argument is given, the content is reset to its default value, which is an empty string.\n\nNote that the content should be a string of bytes. Strings in perl can contain characters outside the range of a byte. The 'Encode' module can be used to turn such strings into a string of bytes. \n* $mess->add_content( $bytes )\n\nThe add_content() methods appends more data bytes to the end of the current content buffer. \n* $mess->add_content_utf8( $string )\n\nThe add_content_utf8() method appends the UTF-8 bytes representing the string to the end of the current content buffer. \n* $mess->content_ref \n* $mess->content_ref( \\$bytes )\n\nThe content_ref() method will return a reference to content buffer string. It can be more efficient to access the content this way if the content is huge, and it can even be used for direct manipulation of the content, for instance:\n\n  ${$res->content_ref} =~ s/\\bfoo\\b/bar/g;\n\nThis example would modify the content buffer in-place.\n\nIf an argument is passed it will setup the content to reference some external source. The content() and add_content() methods will automatically dereference scalar references passed this way. For other references content() will return the reference itself and add_content() will refuse to do anything. \n* $mess->content_charset\n\nThis returns the charset used by the content in the message. The charset is either found as the charset attribute of the 'Content-Type' header or by guessing.\n\nSee http://www.w3.org/TR/REC-html40/charset.html#spec-char-encoding for details about how charset is determined. \n* $mess->decoded_content( %options )\n\nReturns the content with any 'Content-Encoding' undone and for textual content the raw content encoded to Perl's Unicode strings. If the 'Content-Encoding' or 'charset' of the message is unknown this method will fail by returning 'undef'.\n\nThe following options can be specified.\n\n  * 'charset'\n\nThis override the charset parameter for text content. The value 'none' can used to suppress decoding of the charset.\n\n  * 'default_charset'\n\nThis override the default charset guessed by content_charset() or if that fails \"ISO-8859-1\".\n\n  * 'alt_charset'\n\nIf decoding fails because the charset specified in the Content-Type header isn't recognized by Perl's Encode module, then try decoding using this charset instead of failing. The 'alt_charset' might be specified as 'none' to simply return the string without any decoding of charset as alternative.\n\n  * 'charset_strict'\n\nAbort decoding if malformed characters is found in the content. By default you get the substitution character (\"\\x{FFFD}\") in place of malformed characters.\n\n  * 'raise_error'\n\nIf TRUE then raise an exception if not able to decode content. Reason might be that the specified 'Content-Encoding' or 'charset' is not supported. If this option is FALSE, then decoded_content() will return 'undef' on errors, but will still set $@.\n\n  * 'ref'\n\nIf TRUE then a reference to decoded content is returned. This might be more efficient in cases where the decoded content is identical to the raw content as no data copying is required in this case. \n* $mess->decodable \n* HTTP::Message::decodable()\n\nThis returns the encoding identifiers that decoded_content() can process. In scalar context returns a comma separated string of identifiers.\n\nThis value is suitable for initializing the 'Accept-Encoding' request header field. \n* $mess->decode\n\nThis method tries to replace the content of the message with the decoded version and removes the 'Content-Encoding' header. Returns TRUE if successful and FALSE if not.\n\nIf the message does not have a 'Content-Encoding' header this method does nothing and returns TRUE.\n\nNote that the content of the message is still bytes after this method has been called and you still need to call decoded_content() if you want to process its content as a string. \n* $mess->encode( $encoding, ... )\n\nApply the given encodings to the content of the message. Returns TRUE if successful. The \"identity\" (non-)encoding is always supported; other currently supported encodings, subject to availability of required additional modules, are \"gzip\", \"deflate\", \"x-bzip2\" and \"base64\".\n\nA successful call to this function will set the 'Content-Encoding' header.\n\nNote that 'multipart/*' or 'message/*' messages can't be encoded and this method will croak if you try. \n* $mess->parts \n* $mess->parts( @parts ) \n* $mess->parts( \\@parts )\n\nMessages can be composite, i.e. contain other messages. The composite messages have a content type of 'multipart/*' or 'message/*'. This method give access to the contained messages.\n\nThe argumentless form will return a list of 'HTTP::Message' objects. If the content type of $msg is not 'multipart/*' or 'message/*' then this will return the empty list. In scalar context only the first object is returned. The returned message parts should be regarded as read-only (future versions of this library might make it possible to modify the parent by modifying the parts).\n\nIf the content type of $msg is 'message/*' then there will only be one part returned.\n\nIf the content type is 'message/http', then the return value will be either an 'HTTP::Request' or an 'HTTP::Response' object.\n\nIf a @parts argument is given, then the content of the message will be modified. The array reference form is provided so that an empty list can be provided. The @parts array should contain 'HTTP::Message' objects. The @parts objects are owned by $mess after this call and should not be modified or made part of other messages.\n\nWhen updating the message with this method and the old content type of $mess is not 'multipart/*' or 'message/*', then the content type is set to 'multipart/mixed' and all other content headers are cleared.\n\nThis method will croak if the content type is 'message/*' and more than one part is provided. \n* $mess->add_part( $part )\n\nThis will add a part to a message. The $part argument should be another 'HTTP::Message' object. If the previous content type of $mess is not 'multipart/*' then the old content (together with all content headers) will be made part #1 and the content type made 'multipart/mixed' before the new part is added. The $part object is owned by $mess after this call and should not be modified or made part of other messages.\n\nThere is no return value. \n* $mess->clear\n\nWill clear the headers and set the content to the empty string. There is no return value \n* $mess->protocol \n* $mess->protocol( $proto )\n\nSets the HTTP protocol used for the message. The protocol() is a string like 'HTTP/1.0' or 'HTTP/1.1'. \n* $mess->clone\n\nReturns a copy of the message object. \n* $mess->as_string \n* $mess->as_string( $eol )\n\nReturns the message formatted as a single string.\n\nThe optional $eol parameter specifies the line ending sequence to use. The default is \"\\n\". If no $eol is given then as_string will ensure that the returned string is newline terminated (even when the message content is not). No extra newline is appended if an explicit $eol is passed. \n* $mess->dump( %opt )\n\nReturns the message formatted as a string. In void context print the string.\n\nThis differs from '$mess->as_string' in that it escapes the bytes of the content so that it's safe to print them and it limits how much content to print. The escapes syntax used is the same as for Perl's double quoted strings. If there is no content the string \"(no content)\" is shown in its place.\n\nOptions to influence the output can be passed as key/value pairs. The following options are recognized:\n\n  * maxlength => $num\n\nHow much of the content to show. The default is 512. Set this to 0 for unlimited.\n\nIf the content is longer then the string is chopped at the limit and the string \"...\\n(### more bytes not shown)\" appended.\n\n  * no_content => $str\n\nReplaces the \"(no content)\" marker.\n\n  * prefix => $str\n\nA string that will be prefixed to each line of the dump.\n\nAll methods unknown to 'HTTP::Message' itself are delegated to the 'HTTP::Headers' object that is part of every message. This allows convenient access to these methods. Refer to HTTP::Headers for details of these methods:\n\n    $mess->header( $field => $val )     $mess->push_header( $field => $val )     $mess->init_header( $field => $val )     $mess->remove_header( $field )     $mess->remove_content_headers     $mess->header_field_names     $mess->scan( \\&doit )\n\n    $mess->date     $mess->expires     $mess->if_modified_since     $mess->if_unmodified_since     $mess->last_modified     $mess->content_type     $mess->content_encoding     $mess->content_length     $mess->content_language     $mess->title     $mess->user_agent     $mess->server     $mess->from     $mess->referer     $mess->www_authenticate     $mess->authorization     $mess->proxy_authorization     $mess->authorization_basic     $mess->proxy_authorization_basic"
    ],
    "previous_source": "",
    "target": [
        "'HTTP::Message' オブジェクトには、いくつかのヘッダと内容が含まれています。下記のようなメソッドを利用することができます:\n* $mess = HTTP::Message->new\n* $mess = HTTP::Message->new( $headers )\n* $mess = HTTP::Message->new( $headers, $content )\n\n  これらのメソッドは、いずれも新しいメッセージオブジェクトを作成します。通常はこのオブジェクトを直接作成することはなく、 'HTTP::Request' または 'HTTP::Response' オブジェクトを作成します。\n\n  オプションで指定することのできる $header パラメータは、 'HTTP::Headers' オブジェクトに対する参照を指定することができるほか、純粋にキーと値の対を持つ配列参照を指定することもできます。なお、 'HTTP::Headers' オブジェクトを指定した場合は、オブジェクトをコピーして保持するようになります。つまり、指定したオブジェクトは、メッセージに影響することなく後から利用できることになります。\n\n  また、オプションで指定できる $content は、バイトデータの文字列を指定します。\n* $mess = HTTP::Message->parse( $str )\n\n  このメソッドは、指定された文字列を処理して新しいメッセージオブジェクトを作成します。\n* $mess->headers\n\n  取り込まれている 'HTTP::Headers' オブジェクトを返します。n\n* $mess->headers_as_string\n* $mess->headers_as_string( $eol )\n\n  メッセージ内のヘッダに対して as_string() を呼び出します。下記のメソッドと同じ意味になります:\n\n      $mess->headers->as_string\n\n  ただし、 header_as_string のほうが幾分記述する文字数が少なくできます :-)\n* $mess->content\n* $mess->content( $bytes )\n\n  content() メソッドは、パラメータが指定されていた場合はその内容をそのまま保存します。何もパラメータが指定されていない場合は、内容は変更されません。いずれの場合も、内容のそのままのデータが返されます。\n\n  ただし、内容はバイトデータの文字列であるべきことに注意してください。 Perl における文字列は、バイト範囲外の文字も含めることができてしまいますが、そのような場合は 'Encode' モジュールを利用して、文字列をバイトデータの文字列に変換してください。\n* $mess->add_content( $bytes )\n\n  add_content() メソッドは、現在保存されている内容にデータバイトを追記します。\n* $mess->add_content_utf8( $string )\n\n  add_content_utf8() メソッドは、現在保存されている内容に UTF-8 形式で文字列のバイトデータを追記します。\n* $mess->content_ref\n* $mess->content_ref( \\$bytes )\n\n  content_ref() メソッドは、現在保存されている内容を参照で返します。内容が巨大なサイズである場合、この方法でアクセスしたほうがより効率的になる場合があります。それは、下記のようにして直接的な操作を実施することができるためです:\n\n    ${$res->content_ref} =~ s/\\bfoo\\b/bar/g;\n\n  上記の例では、内容バッファをその場で修正します。\n\n  パラメータを指定した場合は、その情報に対する参照を保存します。 content(), add_content() メソッドでは、その方法で指定した参照を自動的に外します。その他の参照の場合、 content() は参照それ自身を返すほか、 add_content() はいかなる処理も拒否するようになってしまいます。\n* $mess->content_charset\n\n  このメソッドを実行すると、メッセージ内の内容で使用されている文字セットを返します。文字セットはヘッダ内の 'Content-Type' ヘッダに記されたもののほか、推測で返す場合もあります。\n\n  文字セットの判断について、詳しくは http://www.w3.org/TR/REC-html40/charset.html#spec-char-encoding をお読みください。\n* $mess->decoded_content( %options )\n\n  'Content-Encoding' によるエンコードを実施する前の内容で、かつ Perl の Unicode 文字列にエンコードされた生データを返します。メッセージの 'Content-Encoding' および 'charset' がわからない場合、このメソッドは 'undef' を返して失敗を表します。\n\n  下記のオプションを指定することができます。\n  * 'charset'\n\n    このオプションを指定すると、 charset パラメータを上書きすることができます。 'none' を指定すると、文字セットのデコードを行なわなくなります。\n\n  * 'default_charset'\n\n    このオプションを指定すると、 content_charset() で既定の文字セットを推測するようになります。推測が失敗した場合は \"ISO-8859-1\" になります。\n  * 'alt_charset'\n\n    Content-Type ヘッダ内に設定された文字セットが Perl の Encode モジュールで認識されずに失敗した場合、ここで指定した文字セットでデコードを行なうようになります。 'alt_charset' に 'none' を指定すると、代替の文字セットを判断することなく、デコード前の文字列をそのまま返すようになります。\n  * 'charset_strict'\n\n    Abort decoding if malformed characters is found in the content. By     default you get the substitution character (\"\\x{FFFD}\") in place of     malformed characters.\n  * 'raise_error'\n\n    TRUE を指定すると、内容をデコードできない場合に例外を発生させるようになります。いずれの場合も、理由は 'Content-Encoding' または 'charset' が未対応のものであった場合です。 FALSE を指定すると、 decoded_content() はエラー時に 'undef' を返すようになりますが、 $@ にも値は設定されます。\n  * 'ref'\n\n    TRUE を指定すると、デコードされた内容の参照を返すようになります。これはデコードされた内容が元々の内容と同じで、データのコピーが不要となるような場合により効率的になります。\n* $mess->decodable\n* HTTP::Message::decodable()\n\n  このメソッドは、 decoded_content() が処理することのできる識別子を返します。スカラー形式で、カンマ区切りの複数の識別子が返されます。\n\n  この値は、 'Accept-Encoding' リクエストヘッダを設定する際に便利です。\n* $mess->decode\n\n  このメソッドはメッセージの内容をデコードしたもので置き換え、 'Content-Encoding' ヘッダを削除します。成功した場合は TRUE を、失敗した場合は FALSE を返します。\n\n  メッセージ内に 'Content-Encoding' ヘッダが含まれていない場合、このメソッドは何も実施せずに TRUE を返します。\n\n  ただし、このメッセージを呼び出しても、メッセージの内容がバイトデータのままであることに注意してください。文字列として内容を取り出すには、 decoded_content() を呼び出す必要があります。\n* $mess->encode( $encoding, ... )\n\n  指定したエンコーディングをメッセージの内容に適用します。成功した場合は TRUE を返します。 \"identity\" (何もエンコードしない) 指定にも対応しています。その他のエンコーディング、具体的には \"gzip\", \"deflate\", \"x-bzip2\", \"base64\" については、それぞれ追加のモジュールが必要となります。\n\n  このメソッドの呼び出しが成功すると、 'Content-Encoding' ヘッダが設定されます。\n\n  なお、 'multipart/*' や 'message/*' のメッセージはエンコードできません。このメソッドを呼び出すと、 croak が実行されます。\n* $mess->parts\n* $mess->parts( @parts )\n* $mess->parts( \\@parts )\n\n  あるメッセージには他のメッセージを包含することができます。包含されたメッセージは 'multipart/*' または 'message/*' の Content-Type が設定されます。このメソッドを利用することで、このような包含メッセージにアクセスすることができます。\n\n  何もパラメータを指定しない場合は、 'HTTP::Message' のリストが返却されます。メッセージの Content-Type が 'multipart/*' または 'message/*' のどちらでもない場合、このメソッドは空のリストを返します。スカラーコンテキストの場合は、最初のオブジェクトのみを返します。なお、返却されたメッセージのパーツは、読み込み専用で利用すべきものです (このライブラリの将来のバージョンでは、パーツを修正することで元のオブジェクトを修正できるようになる予定です) 。\n\n  メッセージの Content-Type が 'message/*' である場合、 1 つのパートのみがあるものとみなされて返されます。\n\n  Content-Type が 'message/http' である場合、返却される値は 'HTTP::Request' または 'HTTP::Response' オブジェクトのいずれかになります。\n\n  @parts パラメータを指定した場合は、メッセージの内容を修正します。配列の参照で指定する場合は、空のリストも設定することができます。 @parts 配列は 'HTTP::Message' のオブジェクトを含んでいるべきです。 @parts で指定したオブジェクトは、このコール実行後に占有されることになりますので、後から変更したり他のメッセージの一部にしたりすべきではありません。\n\n  このメソッドを利用してメッセージを更新していて、古いほうの内容の Content-Type が 'multipart/*' または 'message/*' のいずれでもない場合、 Content-Type は 'multipart/mixed' に設定され、その他のすべての Content ヘッダが消去されます。\n\n  Content-Type が 'message/*' であり、 1 つ以上のパーツを指定した場合には croak が実行されます。\n* $mess->add_part( $part )\n\n  このメソッドを実行すると、 $part をメッセージに追加します。 $part パラメータは他の 'HTTP::Message' オブジェクトであるべきです。メッセージの Content-Type が 'multipart/*' でない場合、古い内容 (および内容関連のヘッダ) はパート #1 として設定され、新しいパートを追加する前に Content-Type が 'multipart/mixed' に設定されます。 $part で指定したオブジェクトは、このコール実行後に占有されることになりますので、後から変更したり他のメッセージの一部にしたりすべきではありません。\n\n  このメソッドは何も値を返しません。\n* $mess->clear\n\n  ヘッダを消去し、内容を空の文字列に設定します。このメソッドは何も値を返しません。\n* $mess->protocol\n* $mess->protocol( $proto )\n\n  メッセージで使用する HTTP プロトコルを指定します。 'HTTP/1.0' や 'HTTP/1.1' のような文字列を指定します。\n* $mess->clone\n\n  メッセージオブジェクトのコピーを返します。\n* $mess->as_string\n* $mess->as_string( $eol )\n\n  単一の文字列に変換してメッセージを返します。\n\n  オプションの $eol パラメータを指定すると、使用すべき行末文字を設定することができます。既定値は \"\\n\" で、何も $eol を指定しない場合は、この既定値を行末の区切りとします (メッセージの内容がそうでなくても) 。明示的に $eol を指定すると、その文字を行末の区切りとします。\n* $mess->dump( %opt )\n\n  メッセージを文字列に変換して返します。\n\n  '$mess->as_string' との違いは内容の処理方法にあります。このメソッドでは、安全に表示できない文字をエスケープ処理するほか、表示する最大の長さを指定することもできます。エスケープ処理は、 Perl の二重引用符内でのものと同じ方式です。何も内容が設定されていない場合は、 \"(no content)\" と表示されます。\n\n  キー/値の対で、オプションパラメータを指定することもできます。それぞれ下記のオプションに対応しています:\n  * maxlength => $num\n\n    表示すべき内容の最大長を指定します。既定値は 512 で、 0 を指定すると無制限になります。\n\n    内容がこの値よりも長い場合は、文字列がそこで切られて、末尾に \"...\\n(### more bytes not shown)\" が付加されます。\n  * no_content => $str\n\n    \"(no content)\" の置き換えを指定します。\n  * prefix => $str\n\n    各ダンプ行の冒頭に、指定した文字列を表示します。\n\nなお、 'HTTP::Message' 自身で理解できないすべてのメソッドは、各メッセージにある 'HTTP::Headers' オブジェクトに転送されます。これにより、メソッドにアクセスしやすく作られています。下記のメソッドについての詳細は、 HTTP::Headers のマニュアルページをお読みください:\n\n    $mess->header( $field => $val )     $mess->push_header( $field => $val )     $mess->init_header( $field => $val )     $mess->remove_header( $field )     $mess->remove_content_headers     $mess->header_field_names     $mess->scan( \\&doit )\n\n    $mess->date     $mess->expires     $mess->if_modified_since     $mess->if_unmodified_since     $mess->last_modified     $mess->content_type     $mess->content_encoding     $mess->content_length     $mess->content_language     $mess->title     $mess->user_agent     $mess->server     $mess->from     $mess->referer     $mess->www_authenticate     $mess->authorization     $mess->proxy_authorization     $mess->authorization_basic     $mess->proxy_authorization_basic"
    ],
    "id_hash": 6976786159966930163,
    "content_hash": 6976786159966930163,
    "location": "",
    "context": "",
    "note": "leap/perl-HTTP-Message/description",
    "flags": "",
    "labels": [],
    "state": 20,
    "fuzzy": false,
    "translated": true,
    "approved": false,
    "position": 933,
    "has_suggestion": false,
    "has_comment": false,
    "has_failing_check": false,
    "num_words": 1530,
    "source_unit": "https://l10n.opensuse.org/api/units/12618488/?format=api",
    "priority": 100,
    "id": 9299104,
    "web_url": "https://l10n.opensuse.org/translate/packages-i18n/perl-master/ja/?checksum=e0d2860c42b0c4f3",
    "url": "https://l10n.opensuse.org/api/units/9299104/?format=api",
    "explanation": "",
    "extra_flags": "",
    "pending": false,
    "timestamp": "2017-10-09T11:06:41.426414Z"
}