From 5f7fb52258f2fb161dab4e7e6194e76a85d5a9a6 Mon Sep 17 00:00:00 2001 From: Boris Verkhovskiy Date: Wed, 27 Apr 2022 22:39:04 -0700 Subject: [PATCH] support Locale-Specific Translation strings (#402) --- README.md | 2 +- src/util.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d9ce072..fe60783 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ data = { response = requests.post('http://example.com', data=data) ``` -You can choose the output language by passing `--language `. The options are `python` (the default), `javascript`/`node`/`node-request`, `php`, `go`, `java`, `r`, `rust`, `elixir`, `dart`, `matlab`, `cfml` and a few more. +You can choose the output language by passing `--language `. The options are `python` (the default), `javascript`/`node`, `node-axios`, `php`, `go`, `java`, `r`, `rust`, `elixir`, `dart`, `matlab` and a few more. [![NPM version][npm-image]][npm-url] diff --git a/src/util.ts b/src/util.ts index 0d775a3..3027966 100644 --- a/src/util.ts +++ b/src/util.ts @@ -849,6 +849,9 @@ const parseDoubleQuoteString = (str: string): string => { const unescapeChar = (m: string) => (m.charAt(1) === "\n" ? "" : m.charAt(1)); return str.slice(1, -1).replace(BACKSLASHES, unescapeChar); }; +const parseTranslatedString = (str: string): string => { + return parseDoubleQuoteString(str.slice(1)); +}; // ANSI-C quoted strings look $'like this'. // Not all shells have them but bash does // https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html @@ -957,6 +960,8 @@ function toVal(node: Parser.SyntaxNode, curlCommand: string): string { return parseSingleQuoteString(node.text); case "ansii_c_string": return parseAnsiCString(node.text); + case "string_expansion": + return parseTranslatedString(node.text); case "concatenation": // item[]=1 turns into item=1 if we don't do this // https://github.com/tree-sitter/tree-sitter-bash/issues/104