From c9078eb8d568a957989bf06f3a3e2b20e0b6c565 Mon Sep 17 00:00:00 2001 From: Aerex Date: Mon, 13 Nov 2023 20:08:21 -0600 Subject: [PATCH 01/13] wip: started adding english translation --- i18n4go/i18n/excluded.json | 57 + i18n4go/i18n/resources/ast.go.en.json | 7 + i18n4go/i18n/resources/checkup.go.en.json | 92 ++ i18n4go/i18n/resources/common.go.en.json | 47 + .../resources/create_translations.go.en.json | 152 ++ i18n4go/i18n/resources/en.all.json | 1227 +++++++++++++++++ .../i18n/resources/extract_strings.go.en.json | 272 ++++ i18n4go/i18n/resources/fixup.go.en.json | 117 ++ i18n4go/i18n/resources/i18n4go.go.en.json | 327 +++++ i18n4go/i18n/resources/init.go.en.json | 87 ++ .../i18n/resources/merge_string.go.en.json | 57 + .../i18n/resources/rewrite_package.go.en.json | 262 ++++ .../resources/show_missing_strings.go.en.json | 77 ++ .../i18n/resources/verify_strings.go.en.json | 162 +++ i18n4go/i18n/resources/version.go.en.json | 27 + 15 files changed, 2970 insertions(+) create mode 100644 i18n4go/i18n/excluded.json create mode 100644 i18n4go/i18n/resources/ast.go.en.json create mode 100644 i18n4go/i18n/resources/checkup.go.en.json create mode 100644 i18n4go/i18n/resources/common.go.en.json create mode 100644 i18n4go/i18n/resources/create_translations.go.en.json create mode 100644 i18n4go/i18n/resources/en.all.json create mode 100644 i18n4go/i18n/resources/extract_strings.go.en.json create mode 100644 i18n4go/i18n/resources/fixup.go.en.json create mode 100644 i18n4go/i18n/resources/i18n4go.go.en.json create mode 100644 i18n4go/i18n/resources/init.go.en.json create mode 100644 i18n4go/i18n/resources/merge_string.go.en.json create mode 100644 i18n4go/i18n/resources/rewrite_package.go.en.json create mode 100644 i18n4go/i18n/resources/show_missing_strings.go.en.json create mode 100644 i18n4go/i18n/resources/verify_strings.go.en.json create mode 100644 i18n4go/i18n/resources/version.go.en.json diff --git a/i18n4go/i18n/excluded.json b/i18n4go/i18n/excluded.json new file mode 100644 index 0000000..0fb1804 --- /dev/null +++ b/i18n4go/i18n/excluded.json @@ -0,0 +1,57 @@ +{ + "excludedStrings": [ + "%s.", + "", + "\"", + " ", + " ", + "\n", + ">", + "\\<", + "\\&", + "&", + "\t", + "\n\t", + "extract_strings", + "excluded.json", + "en_US", + "i18n4go", + ".en.json", + ".extracted.json", + "json:\"id\"", + "json:\"filename\"", + "json:\"excludedStrings\"", + "json:\"translation\"", + "json:\"value\"", + "json:\"offset\"", + "json:\"line\"", + "json:\"column\"", + "recursive:", + ".json", + ".po", + ", column: ", + ", line: ", + ", offset: ", + "msgid ", + "msgstr ", + "# filename: ", + ".", + "<", + "\\", + "help", + ".go", + "/", + ",", + "false", + "true" + ], + "excludedRegexps": [ + "^\\d+$", + "^-\\w$", + "^\\w$", + "^json:", + "^\\&.*", + "^https:", + "^%.*" + ] +} diff --git a/i18n4go/i18n/resources/ast.go.en.json b/i18n4go/i18n/resources/ast.go.en.json new file mode 100644 index 0000000..efb07e6 --- /dev/null +++ b/i18n4go/i18n/resources/ast.go.en.json @@ -0,0 +1,7 @@ +[ + { + "id": "Could not find imports for root node:\n\t%#v\n", + "translation": "Could not find imports for root node:\n\t%#v\n", + "modified": false + } +] diff --git a/i18n4go/i18n/resources/checkup.go.en.json b/i18n4go/i18n/resources/checkup.go.en.json new file mode 100644 index 0000000..8d7be12 --- /dev/null +++ b/i18n4go/i18n/resources/checkup.go.en.json @@ -0,0 +1,92 @@ +[ + { + "id": "excluded|json|all", + "translation": "excluded|json|all", + "modified": false + }, + { + "id": "checkup", + "translation": "checkup", + "modified": false + }, + { + "id": "Checks the transated files", + "translation": "Checks the transated files", + "modified": false + }, + { + "id": "Couldn't find the english strings: %s", + "translation": "Couldn't find the english strings: %s", + "modified": false + }, + { + "id": "Could not find an i18n file for locale: en_US", + "translation": "Could not find an i18n file for locale: en_US", + "modified": false + }, + { + "id": "OK", + "translation": "OK", + "modified": false + }, + { + "id": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)", + "translation": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)", + "modified": false + }, + { + "id": ".*test.*", + "translation": ".*test.*", + "modified": false + }, + { + "id": "recursively extract strings from all files in the same directory as filename or dirName", + "translation": "recursively extract strings from all files in the same directory as filename or dirName", + "modified": false + }, + { + "id": "qualifier", + "translation": "qualifier", + "modified": false + }, + { + "id": "_test.go", + "translation": "_test.go", + "modified": false + }, + { + "id": "Error when inspecting go file: ", + "translation": "Error when inspecting go file: ", + "modified": false + }, + { + "id": "Couldn't get the strings from %s: %s", + "translation": "Couldn't get the strings from %s: %s", + "modified": false + }, + { + "id": "\"%s\" exists in %s, but not in %s\n", + "translation": "\"%s\" exists in %s, but not in %s\n", + "modified": false + }, + { + "id": "Strings don't match", + "translation": "Strings don't match", + "modified": false + }, + { + "id": "ignore-regexp", + "translation": "ignore-regexp", + "modified": false + }, + { + "id": "Couldn't find any source strings: %s", + "translation": "Couldn't find any source strings: %s", + "modified": false + }, + { + "id": "the code", + "translation": "the code", + "modified": false + } +] diff --git a/i18n4go/i18n/resources/common.go.en.json b/i18n4go/i18n/resources/common.go.en.json new file mode 100644 index 0000000..642c596 --- /dev/null +++ b/i18n4go/i18n/resources/common.go.en.json @@ -0,0 +1,47 @@ +[ + { + "id": "Saving extracted i18n strings to file:", + "translation": "Saving extracted i18n strings to file:", + "modified": false + }, + { + "id": "i18n4go: Error compiling interpolated string Regexp: %s\n", + "translation": "i18n4go: Error compiling interpolated string Regexp: %s\n", + "modified": false + }, + { + "id": "WARNING: fail to compile ignore-regexp:", + "translation": "WARNING: fail to compile ignore-regexp:", + "modified": false + }, + { + "id": "i18n4go: Non-regular source file %s (%s)\n", + "translation": "i18n4go: Non-regular source file %s (%s)\n", + "modified": false + }, + { + "id": "PWD", + "translation": "PWD", + "modified": false + }, + { + "id": "Creating and saving i18n strings to .po file:", + "translation": "Creating and saving i18n strings to .po file:", + "modified": false + }, + { + "id": "i18n4go: creating and saving i18n strings to .po file:", + "translation": "i18n4go: creating and saving i18n strings to .po file:", + "modified": false + }, + { + "id": "i18n4go: Error compiling templated string Regexp: %s\n", + "translation": "i18n4go: Error compiling templated string Regexp: %s\n", + "modified": false + }, + { + "id": "Duplicated key found: ", + "translation": "Duplicated key found: ", + "modified": false + } +] diff --git a/i18n4go/i18n/resources/create_translations.go.en.json b/i18n4go/i18n/resources/create_translations.go.en.json new file mode 100644 index 0000000..7ff6855 --- /dev/null +++ b/i18n4go/i18n/resources/create_translations.go.en.json @@ -0,0 +1,152 @@ +[ + { + "id": "i18n4go: created default translation file:", + "translation": "i18n4go: created default translation file:", + "modified": false + }, + { + "id": "i18n4go: attempting to use Google Translate to translate source strings in: ", + "translation": "i18n4go: attempting to use Google Translate to translate source strings in: ", + "modified": false + }, + { + "id": "create-translations", + "translation": "create-translations", + "modified": false + }, + { + "id": "google-translate-api-key", + "translation": "google-translate-api-key", + "modified": false + }, + { + "id": "en", + "translation": "en", + "modified": false + }, + { + "id": "the source translation file", + "translation": "the source translation file", + "modified": false + }, + { + "id": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", + "translation": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", + "modified": false + }, + { + "id": "languages", + "translation": "languages", + "modified": false + }, + { + "id": "i18n4go: could not create output directory: %s", + "translation": "i18n4go: could not create output directory: %s", + "modified": false + }, + { + "id": "i18n4go: ERROR invoking Google Translate: ", + "translation": "i18n4go: ERROR invoking Google Translate: ", + "modified": false + }, + { + "id": "i18n4go: ERROR parsing Google Translate response body", + "translation": "i18n4go: ERROR parsing Google Translate response body", + "modified": false + }, + { + "id": "source-language", + "translation": "source-language", + "modified": false + }, + { + "id": "the output directory where the newly created translation files will be placed", + "translation": "the output directory where the newly created translation files will be placed", + "modified": false + }, + { + "id": "i18n4go: could not create translation file for language: %s with Google Translate", + "translation": "i18n4go: could not create translation file for language: %s with Google Translate", + "modified": false + }, + { + "id": "i18n4go: error invoking Google Translate for string:", + "translation": "i18n4go: error invoking Google Translate for string:", + "modified": false + }, + { + "id": "i18n4go: could not load i18n strings from file: %s", + "translation": "i18n4go: could not load i18n strings from file: %s", + "modified": false + }, + { + "id": "Creates the transation files", + "translation": "Creates the transation files", + "modified": false + }, + { + "id": "i18n4go: creating translation file copy for language:", + "translation": "i18n4go: creating translation file copy for language:", + "modified": false + }, + { + "id": "i18n4go: input file: %s is empty", + "translation": "i18n4go: input file: %s is empty", + "modified": false + }, + { + "id": "i18n4go: creating translation file:", + "translation": "i18n4go: creating translation file:", + "modified": false + }, + { + "id": "i18n4go: could not create default translation file for language: %s\nerr:%s", + "translation": "i18n4go: could not create default translation file for language: %s\nerr:%s", + "modified": false + }, + { + "id": "i18n4go: could not save Google Translate i18n strings to file: %s", + "translation": "i18n4go: could not save Google Translate i18n strings to file: %s", + "modified": false + }, + { + "id": "i18n4go: could not save PO file: %s", + "translation": "i18n4go: could not save PO file: %s", + "modified": false + }, + { + "id": "&target=", + "translation": "&target=", + "modified": false + }, + { + "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "modified": false + }, + { + "id": "file", + "translation": "file", + "modified": false + }, + { + "id": "output", + "translation": "output", + "modified": false + }, + { + "id": "i18n4go: creating translation files for:", + "translation": "i18n4go: creating translation files for:", + "modified": false + }, + { + "id": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", + "translation": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", + "modified": false + }, + { + "id": "i18n4go: created translation file with Google Translate:", + "translation": "i18n4go: created translation file with Google Translate:", + "modified": false + } +] diff --git a/i18n4go/i18n/resources/en.all.json b/i18n4go/i18n/resources/en.all.json new file mode 100644 index 0000000..3f8d586 --- /dev/null +++ b/i18n4go/i18n/resources/en.all.json @@ -0,0 +1,1227 @@ +[ + { + "id": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", + "translation": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", + "modified": false + }, + { + "id": "\nusage: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -f \n or: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -d [-r] [--ignore-regexp ]\n\nusage: i18n4go -c rewrite-package [-v] [-r] -d [--i18n-strings-filename | --i18n-strings-dirname ] [--init-code-snippet-filename ] [--ignore-regexp ]\n or: i18n4go -c rewrite-package [-v] [-r] -f --i18n-strings-filename [--init-code-snippet-filename ] [--ignore-regexp ]\n\nusage: i18n4go -c create-translations [-v] [--google-translate-api-key ] [--source-language ] -f --languages -o \n\nusage: i18n4go -c merge-strings [-v] [-r] [--source-language ] -d \n\nusage: i18n4go -c verify-strings [-v] [--source-language ] -f --language-files [-o ]\n or: i18n4go -c verify-strings [-v] [--source-language ] -f --languages [-o ]\n\nusage: i18n4go -c show-missing-strings [-v] -d --i18n-strings-filename \n\nusage: i18n4go -c checkup\n\n -h | --help prints the usage\n -v verbose\n\n EXTRACT-STRINGS:\n\n -c extract-strings the extract strings command\n\n --po to generate standard .po files for translation\n -e [optional] the JSON file with strings to be excluded, defaults to excluded.json if present\n\t-s\t\t\t\t\t\t\t\t\t\t\t\t [optional] the JSON file with regexp that specify a capturing group to be extracted instead of the full string matching the regexp\n --meta [optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file\n --dry-run [optional] prevents any output files from being created\n\n\n --output-flat generated files are created in the specified output directory (default)\n --output-match-package generated files are created in directory to match the package name\n -o the output directory where the translation files will be placed\n\n -f the go file name to extract strings\n\n -d the directory containing the go files to extract strings\n\n -r [optional] recursesively extract strings from all subdirectories\n --ignore-regexp [optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n REWRITE-PACKAGE:\n\n -c rewrite-package the rewrite package command\n -f the source go file to be rewritten\n -d the directory containing the go files to rewrite\n\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n --i18n-strings-dirname a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name\n --root-path the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified\n\n --init-code-snippet-filename [optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization\"\n -o [optional] output diretory for rewritten file. If not specified, the original file will be overwritten\n\n --ignore-regexp\t\t[optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n MERGE STRINGS:\n\n -c merge-strings the merge strings command which merges multiple .go..json files into a .all.json\n\n -r [optional] recursesively combine files from all subdirectories\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \"en_US\" (default to 'en')\n\n -d the directory containing the json files to combine\n\n CREATE-TRANSLATIONS:\n\n -c create-translations the create translations command\n\n --google-translate-api-key [optional] your public Google Translate API key which is used to generate translations (charge is applicable)\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \\\"en_US\\\"\n\n -f the source translation file\n --languages a comma separated list of valid languages with optional territory, e.g., \\\"en, en_US, fr_FR, es\\\"\n -o the output directory where the newly created translation files will be placed\n\n VERIFY-STRINGS:\n\n -c verify-strings the verify strings command\n\n --source-language [optional] the source language of the source translation file (default to 'en')\n\n -f the source translation file\n\n --language-files a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\"\n if not specified then the languages flag is used to find target files in same directory as source\n --languages a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"\n\n -o the output directory where the missing translation keys will be placed\n\n SHOW-MISSING-STRINGS:\n\n -c show-missing-strings the missing strings command\n\n -d the directory containing the go files to validate\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n\n CHECKUP:\n\n -c checkup the checkup command which ensures that the strings in code match strings in resource files and vice versa\n -q the qualifier to use when calling the T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for T(...) function\n\n FIXUP:\n\n -c fixup the fixup command which interactively lets users add, update, or remove translations keys from code and resource files.\n", + "translation": "\nusage: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -f \n or: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -d [-r] [--ignore-regexp ]\n\nusage: i18n4go -c rewrite-package [-v] [-r] -d [--i18n-strings-filename | --i18n-strings-dirname ] [--init-code-snippet-filename ] [--ignore-regexp ]\n or: i18n4go -c rewrite-package [-v] [-r] -f --i18n-strings-filename [--init-code-snippet-filename ] [--ignore-regexp ]\n\nusage: i18n4go -c create-translations [-v] [--google-translate-api-key ] [--source-language ] -f --languages -o \n\nusage: i18n4go -c merge-strings [-v] [-r] [--source-language ] -d \n\nusage: i18n4go -c verify-strings [-v] [--source-language ] -f --language-files [-o ]\n or: i18n4go -c verify-strings [-v] [--source-language ] -f --languages [-o ]\n\nusage: i18n4go -c show-missing-strings [-v] -d --i18n-strings-filename \n\nusage: i18n4go -c checkup\n\n -h | --help prints the usage\n -v verbose\n\n EXTRACT-STRINGS:\n\n -c extract-strings the extract strings command\n\n --po to generate standard .po files for translation\n -e [optional] the JSON file with strings to be excluded, defaults to excluded.json if present\n\t-s\t\t\t\t\t\t\t\t\t\t\t\t [optional] the JSON file with regexp that specify a capturing group to be extracted instead of the full string matching the regexp\n --meta [optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file\n --dry-run [optional] prevents any output files from being created\n\n\n --output-flat generated files are created in the specified output directory (default)\n --output-match-package generated files are created in directory to match the package name\n -o the output directory where the translation files will be placed\n\n -f the go file name to extract strings\n\n -d the directory containing the go files to extract strings\n\n -r [optional] recursesively extract strings from all subdirectories\n --ignore-regexp [optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n REWRITE-PACKAGE:\n\n -c rewrite-package the rewrite package command\n -f the source go file to be rewritten\n -d the directory containing the go files to rewrite\n\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n --i18n-strings-dirname a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name\n --root-path the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified\n\n --init-code-snippet-filename [optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization\"\n -o [optional] output diretory for rewritten file. If not specified, the original file will be overwritten\n\n --ignore-regexp\t\t[optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n MERGE STRINGS:\n\n -c merge-strings the merge strings command which merges multiple .go..json files into a .all.json\n\n -r [optional] recursesively combine files from all subdirectories\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \"en_US\" (default to 'en')\n\n -d the directory containing the json files to combine\n\n CREATE-TRANSLATIONS:\n\n -c create-translations the create translations command\n\n --google-translate-api-key [optional] your public Google Translate API key which is used to generate translations (charge is applicable)\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \\\"en_US\\\"\n\n -f the source translation file\n --languages a comma separated list of valid languages with optional territory, e.g., \\\"en, en_US, fr_FR, es\\\"\n -o the output directory where the newly created translation files will be placed\n\n VERIFY-STRINGS:\n\n -c verify-strings the verify strings command\n\n --source-language [optional] the source language of the source translation file (default to 'en')\n\n -f the source translation file\n\n --language-files a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\"\n if not specified then the languages flag is used to find target files in same directory as source\n --languages a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"\n\n -o the output directory where the missing translation keys will be placed\n\n SHOW-MISSING-STRINGS:\n\n -c show-missing-strings the missing strings command\n\n -d the directory containing the go files to validate\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n\n CHECKUP:\n\n -c checkup the checkup command which ensures that the strings in code match strings in resource files and vice versa\n -q the qualifier to use when calling the T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for T(...) function\n\n FIXUP:\n\n -c fixup the fixup command which interactively lets users add, update, or remove translations keys from code and resource files.\n", + "modified": false + }, + { + "id": " to output dir:", + "translation": " to output dir:", + "modified": false + }, + { + "id": "\"%s\" exists in %s, but not in %s\n", + "translation": "\"%s\" exists in %s, but not in %s\n", + "modified": false + }, + { + "id": "%s\nVersion %s", + "translation": "%s\nVersion %s", + "modified": false + }, + { + "id": "&target=", + "translation": "&target=", + "modified": false + }, + { + "id": ".*test.*", + "translation": ".*test.*", + "modified": false + }, + { + "id": ".all.json", + "translation": ".all.json", + "modified": false + }, + { + "id": ".en.po", + "translation": ".en.po", + "modified": false + }, + { + "id": ".missing.diff.json", + "translation": ".missing.diff.json", + "modified": false + }, + { + "id": "Add, update, or remove translation keys from source files and resources files", + "translation": "Add, update, or remove translation keys from source files and resources files", + "modified": false + }, + { + "id": "Adding these strings to the %s translation file:\n", + "translation": "Adding these strings to the %s translation file:\n", + "modified": false + }, + { + "id": "Adding to translated strings:", + "translation": "Adding to translated strings:", + "modified": false + }, + { + "id": "Additional Strings!", + "translation": "Additional Strings!", + "modified": false + }, + { + "id": "Additional:", + "translation": "Additional:", + "modified": false + }, + { + "id": "An unexpected type of error", + "translation": "An unexpected type of error", + "modified": false + }, + { + "id": "Build Date: %s\n", + "translation": "Build Date: %s\n", + "modified": false + }, + { + "id": "Canceling fixup", + "translation": "Canceling fixup", + "modified": false + }, + { + "id": "Capturing substrings in file:", + "translation": "Capturing substrings in file:", + "modified": false + }, + { + "id": "Checks the transated files", + "translation": "Checks the transated files", + "modified": false + }, + { + "id": "Could not find an i18n file for locale: en_US", + "translation": "Could not find an i18n file for locale: en_US", + "modified": false + }, + { + "id": "Could not find imports for root node:\n\t%#v\n", + "translation": "Could not find imports for root node:\n\t%#v\n", + "modified": false + }, + { + "id": "Could not find:", + "translation": "Could not find:", + "modified": false + }, + { + "id": "Could not load en_US language files. God save the queen. ", + "translation": "Could not load en_US language files. God save the queen. ", + "modified": false + }, + { + "id": "Could not load i18n asset: %v", + "translation": "Could not load i18n asset: %v", + "modified": false + }, + { + "id": "Couldn't find any source strings: %s", + "translation": "Couldn't find any source strings: %s", + "modified": false + }, + { + "id": "Couldn't find the english strings: %s", + "translation": "Couldn't find the english strings: %s", + "modified": false + }, + { + "id": "Couldn't get the strings from %s: %s", + "translation": "Couldn't get the strings from %s: %s", + "modified": false + }, + { + "id": "Creates the transation files", + "translation": "Creates the transation files", + "modified": false + }, + { + "id": "Creating and saving i18n strings to .po file:", + "translation": "Creating and saving i18n strings to .po file:", + "modified": false + }, + { + "id": "Duplicated key found: ", + "translation": "Duplicated key found: ", + "modified": false + }, + { + "id": "ERROR opening file", + "translation": "ERROR opening file", + "modified": false + }, + { + "id": "Error when inspecting go file: ", + "translation": "Error when inspecting go file: ", + "modified": false + }, + { + "id": "Excluding regexps in file:", + "translation": "Excluding regexps in file:", + "modified": false + }, + { + "id": "Excluding strings in file:", + "translation": "Excluding strings in file:", + "modified": false + }, + { + "id": "Extract the translation strings from go source files", + "translation": "Extract the translation strings from go source files", + "modified": false + }, + { + "id": "Extracted %d strings from file: %s\n", + "translation": "Extracted %d strings from file: %s\n", + "modified": false + }, + { + "id": "Extracted total of %d strings\n\n", + "translation": "Extracted total of %d strings\n\n", + "modified": false + }, + { + "id": "Extracting strings in package:", + "translation": "Extracting strings in package:", + "modified": false + }, + { + "id": "File has duplicated key: %s\n%s", + "translation": "File has duplicated key: %s\n%s", + "modified": false + }, + { + "id": "Fixup the transation files", + "translation": "Fixup the transation files", + "modified": false + }, + { + "id": "Found", + "translation": "Found", + "modified": false + }, + { + "id": "General purpose tool for i18n", + "translation": "General purpose tool for i18n", + "modified": false + }, + { + "id": "Git Revision: %s\n", + "translation": "Git Revision: %s\n", + "modified": false + }, + { + "id": "Invalid response.", + "translation": "Invalid response.", + "modified": false + }, + { + "id": "Is the string \"%s\" a new or updated string? [new/upd]\n", + "translation": "Is the string \"%s\" a new or updated string? [new/upd]\n", + "modified": false + }, + { + "id": "Loaded %d excluded regexps", + "translation": "Loaded %d excluded regexps", + "modified": false + }, + { + "id": "Loaded %d excluded strings", + "translation": "Loaded %d excluded strings", + "modified": false + }, + { + "id": "Loaded %d substring regexps", + "translation": "Loaded %d substring regexps", + "modified": false + }, + { + "id": "Merge translation strings", + "translation": "Merge translation strings", + "modified": false + }, + { + "id": "Missing Strings!", + "translation": "Missing Strings!", + "modified": false + }, + { + "id": "Missing:", + "translation": "Missing:", + "modified": false + }, + { + "id": "No match for ignore-regexp:", + "translation": "No match for ignore-regexp:", + "modified": false + }, + { + "id": "OK", + "translation": "OK", + "modified": false + }, + { + "id": "PWD", + "translation": "PWD", + "modified": false + }, + { + "id": "Removing these strings from the %s translation file:\n", + "translation": "Removing these strings from the %s translation file:\n", + "modified": false + }, + { + "id": "Rewrite translated packages from go source files", + "translation": "Rewrite translated packages from go source files", + "modified": false + }, + { + "id": "Saving extracted i18n strings to file:", + "translation": "Saving extracted i18n strings to file:", + "modified": false + }, + { + "id": "Saving extracted strings to file:", + "translation": "Saving extracted strings to file:", + "modified": false + }, + { + "id": "Select the number for the previous translation:", + "translation": "Select the number for the previous translation:", + "modified": false + }, + { + "id": "Show the version of the i18n client", + "translation": "Show the version of the i18n client", + "modified": false + }, + { + "id": "Shows missing strings in translations", + "translation": "Shows missing strings in translations", + "modified": false + }, + { + "id": "Strings don't match", + "translation": "Strings don't match", + "modified": false + }, + { + "id": "Total extracted strings:", + "translation": "Total extracted strings:", + "modified": false + }, + { + "id": "Total files parsed:", + "translation": "Total files parsed:", + "modified": false + }, + { + "id": "Total rewritten strings:", + "translation": "Total rewritten strings:", + "modified": false + }, + { + "id": "Total time:", + "translation": "Total time:", + "modified": false + }, + { + "id": "UNDER", + "translation": "UNDER", + "modified": false + }, + { + "id": "Unable to find english translation files", + "translation": "Unable to find english translation files", + "modified": false + }, + { + "id": "Updating the following strings from the %s translation file:\n", + "translation": "Updating the following strings from the %s translation file:\n", + "modified": false + }, + { + "id": "Using ignore-regexp:", + "translation": "Using ignore-regexp:", + "modified": false + }, + { + "id": "Verify strings in translations", + "translation": "Verify strings in translations", + "modified": false + }, + { + "id": "Version: %s\n", + "translation": "Version: %s\n", + "modified": false + }, + { + "id": "WARNING No capturing group found in %s", + "translation": "WARNING No capturing group found in %s", + "modified": false + }, + { + "id": "WARNING compiling ignore-regexp:", + "translation": "WARNING compiling ignore-regexp:", + "modified": false + }, + { + "id": "WARNING error compiling regexp:", + "translation": "WARNING error compiling regexp:", + "modified": false + }, + { + "id": "WARNING ignoring file:", + "translation": "WARNING ignoring file:", + "modified": false + }, + { + "id": "WARNING running in -dry-run mode", + "translation": "WARNING running in -dry-run mode", + "modified": false + }, + { + "id": "WARNING: fail to compile ignore-regexp:", + "translation": "WARNING: fail to compile ignore-regexp:", + "modified": false + }, + { + "id": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "translation": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "modified": false + }, + { + "id": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", + "translation": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", + "modified": false + }, + { + "id": "[optional] the excluded JSON file name, all strings there will be excluded", + "translation": "[optional] the excluded JSON file name, all strings there will be excluded", + "modified": false + }, + { + "id": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", + "translation": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", + "modified": false + }, + { + "id": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)", + "translation": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)", + "modified": false + }, + { + "id": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "translation": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "modified": false + }, + { + "id": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", + "translation": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", + "modified": false + }, + { + "id": "_test.go", + "translation": "_test.go", + "modified": false + }, + { + "id": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", + "translation": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", + "modified": false + }, + { + "id": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", + "translation": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", + "modified": false + }, + { + "id": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "translation": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "modified": false + }, + { + "id": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", + "translation": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", + "modified": false + }, + { + "id": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", + "translation": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", + "modified": false + }, + { + "id": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", + "translation": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", + "modified": false + }, + { + "id": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", + "translation": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", + "modified": false + }, + { + "id": "capturing_group.json", + "translation": "capturing_group.json", + "modified": false + }, + { + "id": "cf", + "translation": "cf", + "modified": false + }, + { + "id": "checkup", + "translation": "checkup", + "modified": false + }, + { + "id": "cowardly refusing to translate the strings in test file:", + "translation": "cowardly refusing to translate the strings in test file:", + "modified": false + }, + { + "id": "create-translations", + "translation": "create-translations", + "modified": false + }, + { + "id": "de_DE", + "translation": "de_DE", + "modified": false + }, + { + "id": "directory", + "translation": "directory", + "modified": false + }, + { + "id": "dry-run", + "translation": "dry-run", + "modified": false + }, + { + "id": "en", + "translation": "en", + "modified": false + }, + { + "id": "en_US", + "translation": "en_US", + "modified": false + }, + { + "id": "es_ES", + "translation": "es_ES", + "modified": false + }, + { + "id": "exclude", + "translation": "exclude", + "modified": false + }, + { + "id": "excluded|json|all", + "translation": "excluded|json|all", + "modified": false + }, + { + "id": "exit", + "translation": "exit", + "modified": false + }, + { + "id": "extract-strings", + "translation": "extract-strings", + "modified": false + }, + { + "id": "extracted_strings.json", + "translation": "extracted_strings.json", + "modified": false + }, + { + "id": "file", + "translation": "file", + "modified": false + }, + { + "id": "filepath.Join(", + "translation": "filepath.Join(", + "modified": false + }, + { + "id": "fixup", + "translation": "fixup", + "modified": false + }, + { + "id": "fr_FR", + "translation": "fr_FR", + "modified": false + }, + { + "id": "generate standard .po file for translation", + "translation": "generate standard .po file for translation", + "modified": false + }, + { + "id": "generated files are created in directory to match the package name", + "translation": "generated files are created in directory to match the package name", + "modified": false + }, + { + "id": "generated files are created in the specified output directory", + "translation": "generated files are created in the specified output directory", + "modified": false + }, + { + "id": "google-translate-api-key", + "translation": "google-translate-api-key", + "modified": false + }, + { + "id": "i18n-strings-dirname", + "translation": "i18n-strings-dirname", + "modified": false + }, + { + "id": "i18n-strings-filename", + "translation": "i18n-strings-filename", + "modified": false + }, + { + "id": "i18n4go: Could not checkup, err:", + "translation": "i18n4go: Could not checkup, err:", + "modified": false + }, + { + "id": "i18n4go: Could not create translation files, err:", + "translation": "i18n4go: Could not create translation files, err:", + "modified": false + }, + { + "id": "i18n4go: Could not extract strings, err:", + "translation": "i18n4go: Could not extract strings, err:", + "modified": false + }, + { + "id": "i18n4go: Could not fixup, err:", + "translation": "i18n4go: Could not fixup, err:", + "modified": false + }, + { + "id": "i18n4go: Could not merge strings, err:", + "translation": "i18n4go: Could not merge strings, err:", + "modified": false + }, + { + "id": "i18n4go: Could not show missing strings, err:", + "translation": "i18n4go: Could not show missing strings, err:", + "modified": false + }, + { + "id": "i18n4go: Could not successfully rewrite package, err:", + "translation": "i18n4go: Could not successfully rewrite package, err:", + "modified": false + }, + { + "id": "i18n4go: Could not verify strings for input filename, err:", + "translation": "i18n4go: Could not verify strings for input filename, err:", + "modified": false + }, + { + "id": "i18n4go: ERROR could not create the diff file:", + "translation": "i18n4go: ERROR could not create the diff file:", + "modified": false + }, + { + "id": "i18n4go: ERROR input file does not match target file:", + "translation": "i18n4go: ERROR input file does not match target file:", + "modified": false + }, + { + "id": "i18n4go: ERROR invoking Google Translate: ", + "translation": "i18n4go: ERROR invoking Google Translate: ", + "modified": false + }, + { + "id": "i18n4go: ERROR parsing Google Translate response body", + "translation": "i18n4go: ERROR parsing Google Translate response body", + "modified": false + }, + { + "id": "i18n4go: Error checking input filename: ", + "translation": "i18n4go: Error checking input filename: ", + "modified": false + }, + { + "id": "i18n4go: Error compiling interpolated string Regexp: %s\n", + "translation": "i18n4go: Error compiling interpolated string Regexp: %s\n", + "modified": false + }, + { + "id": "i18n4go: Error compiling templated string Regexp: %s\n", + "translation": "i18n4go: Error compiling templated string Regexp: %s\n", + "modified": false + }, + { + "id": "i18n4go: Error input file: %s is empty", + "translation": "i18n4go: Error input file: %s is empty", + "modified": false + }, + { + "id": "i18n4go: Error loading the i18n strings from input filename:", + "translation": "i18n4go: Error loading the i18n strings from input filename:", + "modified": false + }, + { + "id": "i18n4go: Error loading the i18n strings from target filename:", + "translation": "i18n4go: Error loading the i18n strings from target filename:", + "modified": false + }, + { + "id": "i18n4go: Error verifying target filename: ", + "translation": "i18n4go: Error verifying target filename: ", + "modified": false + }, + { + "id": "i18n4go: Non-regular source file %s (%s)\n", + "translation": "i18n4go: Non-regular source file %s (%s)\n", + "modified": false + }, + { + "id": "i18n4go: WARNING could not find JSON file:", + "translation": "i18n4go: WARNING could not find JSON file:", + "modified": false + }, + { + "id": "i18n4go: WARNING target file contains total of extra keys:", + "translation": "i18n4go: WARNING target file contains total of extra keys:", + "modified": false + }, + { + "id": "i18n4go: WARNING target file contains total of invalid translations:", + "translation": "i18n4go: WARNING target file contains total of invalid translations:", + "modified": false + }, + { + "id": "i18n4go: WARNING target file has extra key with ID: ", + "translation": "i18n4go: WARNING target file has extra key with ID: ", + "modified": false + }, + { + "id": "i18n4go: WARNING target file has invalid templated translations with key ID: ", + "translation": "i18n4go: WARNING target file has invalid templated translations with key ID: ", + "modified": false + }, + { + "id": "i18n4go: adding init func to package:", + "translation": "i18n4go: adding init func to package:", + "modified": false + }, + { + "id": "i18n4go: attempting to use Google Translate to translate source strings in: ", + "translation": "i18n4go: attempting to use Google Translate to translate source strings in: ", + "modified": false + }, + { + "id": "i18n4go: could not create default translation file for language: %s\nerr:%s", + "translation": "i18n4go: could not create default translation file for language: %s\nerr:%s", + "modified": false + }, + { + "id": "i18n4go: could not create output directory: %s", + "translation": "i18n4go: could not create output directory: %s", + "modified": false + }, + { + "id": "i18n4go: could not create translation file for language: %s with Google Translate", + "translation": "i18n4go: could not create translation file for language: %s with Google Translate", + "modified": false + }, + { + "id": "i18n4go: could not extract strings from directory:", + "translation": "i18n4go: could not extract strings from directory:", + "modified": false + }, + { + "id": "i18n4go: could not load i18n strings from file: %s", + "translation": "i18n4go: could not load i18n strings from file: %s", + "modified": false + }, + { + "id": "i18n4go: could not save Google Translate i18n strings to file: %s", + "translation": "i18n4go: could not save Google Translate i18n strings to file: %s", + "modified": false + }, + { + "id": "i18n4go: could not save PO file: %s", + "translation": "i18n4go: could not save PO file: %s", + "modified": false + }, + { + "id": "i18n4go: created default translation file:", + "translation": "i18n4go: created default translation file:", + "modified": false + }, + { + "id": "i18n4go: created translation file with Google Translate:", + "translation": "i18n4go: created translation file with Google Translate:", + "modified": false + }, + { + "id": "i18n4go: creating and saving i18n strings to .po file:", + "translation": "i18n4go: creating and saving i18n strings to .po file:", + "modified": false + }, + { + "id": "i18n4go: creating translation file copy for language:", + "translation": "i18n4go: creating translation file copy for language:", + "modified": false + }, + { + "id": "i18n4go: creating translation file:", + "translation": "i18n4go: creating translation file:", + "modified": false + }, + { + "id": "i18n4go: creating translation files for:", + "translation": "i18n4go: creating translation files for:", + "modified": false + }, + { + "id": "i18n4go: determining import path using root path:", + "translation": "i18n4go: determining import path using root path:", + "modified": false + }, + { + "id": "i18n4go: error adding init() func to package:", + "translation": "i18n4go: error adding init() func to package:", + "modified": false + }, + { + "id": "i18n4go: error appending T() to AST file:", + "translation": "i18n4go: error appending T() to AST file:", + "modified": false + }, + { + "id": "i18n4go: error determining the import path:", + "translation": "i18n4go: error determining the import path:", + "modified": false + }, + { + "id": "i18n4go: error getting root path import:", + "translation": "i18n4go: error getting root path import:", + "modified": false + }, + { + "id": "i18n4go: error invoking Google Translate for string:", + "translation": "i18n4go: error invoking Google Translate for string:", + "modified": false + }, + { + "id": "i18n4go: error reading content of init code snippet file: %s\n, using default", + "translation": "i18n4go: error reading content of init code snippet file: %s\n, using default", + "modified": false + }, + { + "id": "i18n4go: error saving AST file:", + "translation": "i18n4go: error saving AST file:", + "modified": false + }, + { + "id": "i18n4go: error saving updated i18n strings file:", + "translation": "i18n4go: error saving updated i18n strings file:", + "modified": false + }, + { + "id": "i18n4go: extracting strings from file:", + "translation": "i18n4go: extracting strings from file:", + "modified": false + }, + { + "id": "i18n4go: generated diff file:", + "translation": "i18n4go: generated diff file:", + "modified": false + }, + { + "id": "i18n4go: got a local import %s so using %s instead for pkg", + "translation": "i18n4go: got a local import %s so using %s instead for pkg", + "modified": false + }, + { + "id": "i18n4go: got a local import %s so using %s instead for root pkg", + "translation": "i18n4go: got a local import %s so using %s instead for root pkg", + "modified": false + }, + { + "id": "i18n4go: got a pkg with import:", + "translation": "i18n4go: got a pkg with import:", + "modified": false + }, + { + "id": "i18n4go: got a root pkg with import path:", + "translation": "i18n4go: got a root pkg with import path:", + "modified": false + }, + { + "id": "i18n4go: input file: %s is empty", + "translation": "i18n4go: input file: %s is empty", + "modified": false + }, + { + "id": "i18n4go: inserting T() calls for strings that need to be translated", + "translation": "i18n4go: inserting T() calls for strings that need to be translated", + "modified": false + }, + { + "id": "i18n4go: inspecting dir %s, recursive: %t\n", + "translation": "i18n4go: inspecting dir %s, recursive: %t\n", + "modified": false + }, + { + "id": "i18n4go: loading JSON strings from file: %s\n", + "translation": "i18n4go: loading JSON strings from file: %s\n", + "modified": false + }, + { + "id": "i18n4go: rewriting strings for source file:", + "translation": "i18n4go: rewriting strings for source file:", + "modified": false + }, + { + "id": "i18n4go: rewriting strings in dir %s, recursive: %t\n", + "translation": "i18n4go: rewriting strings in dir %s, recursive: %t\n", + "modified": false + }, + { + "id": "i18n4go: saving combined language file: ", + "translation": "i18n4go: saving combined language file: ", + "modified": false + }, + { + "id": "i18n4go: scanning file: ", + "translation": "i18n4go: scanning file: ", + "modified": false + }, + { + "id": "i18n4go: target file has extra i18n strings with IDs: %s", + "translation": "i18n4go: target file has extra i18n strings with IDs: %s", + "modified": false + }, + { + "id": "i18n4go: target file has invalid i18n strings with IDs: %s", + "translation": "i18n4go: target file has invalid i18n strings with IDs: %s", + "modified": false + }, + { + "id": "i18n4go: target file is missing i18n strings with IDs: %s", + "translation": "i18n4go: target file is missing i18n strings with IDs: %s", + "modified": false + }, + { + "id": "i18n4go: templated string is invalid, missing args in translation:", + "translation": "i18n4go: templated string is invalid, missing args in translation:", + "modified": false + }, + { + "id": "i18n4go: using import path as:", + "translation": "i18n4go: using import path as:", + "modified": false + }, + { + "id": "i18n4go: using the PWD as the rootPath:", + "translation": "i18n4go: using the PWD as the rootPath:", + "modified": false + }, + { + "id": "i18n4go_res", + "translation": "i18n4go_res", + "modified": false + }, + { + "id": "i18n_init.go", + "translation": "i18n_init.go", + "modified": false + }, + { + "id": "ignore-regexp", + "translation": "ignore-regexp", + "modified": false + }, + { + "id": "init-code-snippet-filename", + "translation": "init-code-snippet-filename", + "modified": false + }, + { + "id": "it_IT", + "translation": "it_IT", + "modified": false + }, + { + "id": "ja_JA", + "translation": "ja_JA", + "modified": false + }, + { + "id": "ko_KO", + "translation": "ko_KO", + "modified": false + }, + { + "id": "language-files", + "translation": "language-files", + "modified": false + }, + { + "id": "languages", + "translation": "languages", + "modified": false + }, + { + "id": "merge-strings", + "translation": "merge-strings", + "modified": false + }, + { + "id": "meta", + "translation": "meta", + "modified": false + }, + { + "id": "new", + "translation": "new", + "modified": false + }, + { + "id": "output", + "translation": "output", + "modified": false + }, + { + "id": "output directory where the translation files will be placed", + "translation": "output directory where the translation files will be placed", + "modified": false + }, + { + "id": "output-flat", + "translation": "output-flat", + "modified": false + }, + { + "id": "output-match-package", + "translation": "output-match-package", + "modified": false + }, + { + "id": "package __PACKAGE__NAME__\n\nimport (\n\t\"path/filepath\"\n\n\ti18n \"github.com/maximilien/i18n4go/i18n\"\n)\n\nvar T i18n.TranslateFunc\n\nfunc init() {\n\tT = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath())\n}", + "translation": "package __PACKAGE__NAME__\n\nimport (\n\t\"path/filepath\"\n\n\ti18n \"github.com/maximilien/i18n4go/i18n\"\n)\n\nvar T i18n.TranslateFunc\n\nfunc init() {\n\tT = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath())\n}", + "modified": false + }, + { + "id": "po", + "translation": "po", + "modified": false + }, + { + "id": "prevents any output files from being created", + "translation": "prevents any output files from being created", + "modified": false + }, + { + "id": "prints the usage", + "translation": "prints the usage", + "modified": false + }, + { + "id": "pt_BR", + "translation": "pt_BR", + "modified": false + }, + { + "id": "qualifier", + "translation": "qualifier", + "modified": false + }, + { + "id": "recursive", + "translation": "recursive", + "modified": false + }, + { + "id": "recursively extract strings from all files in the same directory as filename or dirName", + "translation": "recursively extract strings from all files in the same directory as filename or dirName", + "modified": false + }, + { + "id": "recursively rewrite packages from all files in the same directory as filename or dirName", + "translation": "recursively rewrite packages from all files in the same directory as filename or dirName", + "modified": false + }, + { + "id": "resources", + "translation": "resources", + "modified": false + }, + { + "id": "rewrite-package", + "translation": "rewrite-package", + "modified": false + }, + { + "id": "root-path", + "translation": "root-path", + "modified": false + }, + { + "id": "ru_RU", + "translation": "ru_RU", + "modified": false + }, + { + "id": "saving file to path", + "translation": "saving file to path", + "modified": false + }, + { + "id": "show-missing-strings", + "translation": "show-missing-strings", + "modified": false + }, + { + "id": "source-language", + "translation": "source-language", + "modified": false + }, + { + "id": "src", + "translation": "src", + "modified": false + }, + { + "id": "string", + "translation": "string", + "modified": false + }, + { + "id": "substring-file", + "translation": "substring-file", + "modified": false + }, + { + "id": "targetFilenames:", + "translation": "targetFilenames:", + "modified": false + }, + { + "id": "the JSON file with strings to be excluded, defaults to excluded.json if present", + "translation": "the JSON file with strings to be excluded, defaults to excluded.json if present", + "modified": false + }, + { + "id": "the code", + "translation": "the code", + "modified": false + }, + { + "id": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", + "translation": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", + "modified": false + }, + { + "id": "the dir name for which all .go files will have their strings extracted", + "translation": "the dir name for which all .go files will have their strings extracted", + "modified": false + }, + { + "id": "the directory containing the go files to validate", + "translation": "the directory containing the go files to validate", + "modified": false + }, + { + "id": "the file name for which strings are extracted", + "translation": "the file name for which strings are extracted", + "modified": false + }, + { + "id": "the output directory where the missing translation keys will be placed", + "translation": "the output directory where the missing translation keys will be placed", + "modified": false + }, + { + "id": "the output directory where the newly created translation files will be placed", + "translation": "the output directory where the newly created translation files will be placed", + "modified": false + }, + { + "id": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", + "translation": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", + "modified": false + }, + { + "id": "the source go file to be rewritten", + "translation": "the source go file to be rewritten", + "modified": false + }, + { + "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "modified": false + }, + { + "id": "the source translation file", + "translation": "the source translation file", + "modified": false + }, + { + "id": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "translation": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "modified": false + }, + { + "id": "upd", + "translation": "upd", + "modified": false + }, + { + "id": "v1.4.0", + "translation": "v1.4.0", + "modified": false + }, + { + "id": "verbose", + "translation": "verbose", + "modified": false + }, + { + "id": "verbose mode where lots of output is generated during execution", + "translation": "verbose mode where lots of output is generated during execution", + "modified": false + }, + { + "id": "verify-strings", + "translation": "verify-strings", + "modified": false + }, + { + "id": "version", + "translation": "version", + "modified": false + }, + { + "id": "zh_CN", + "translation": "zh_CN", + "modified": false + } +] \ No newline at end of file diff --git a/i18n4go/i18n/resources/extract_strings.go.en.json b/i18n4go/i18n/resources/extract_strings.go.en.json new file mode 100644 index 0000000..63f21cb --- /dev/null +++ b/i18n4go/i18n/resources/extract_strings.go.en.json @@ -0,0 +1,272 @@ +[ + { + "id": "extract-strings", + "translation": "extract-strings", + "modified": false + }, + { + "id": "output-flat", + "translation": "output-flat", + "modified": false + }, + { + "id": "Using ignore-regexp:", + "translation": "Using ignore-regexp:", + "modified": false + }, + { + "id": "Saving extracted strings to file:", + "translation": "Saving extracted strings to file:", + "modified": false + }, + { + "id": "Excluding strings in file:", + "translation": "Excluding strings in file:", + "modified": false + }, + { + "id": "generated files are created in the specified output directory", + "translation": "generated files are created in the specified output directory", + "modified": false + }, + { + "id": "the dir name for which all .go files will have their strings extracted", + "translation": "the dir name for which all .go files will have their strings extracted", + "modified": false + }, + { + "id": "recursively extract strings from all files in the same directory as filename or dirName", + "translation": "recursively extract strings from all files in the same directory as filename or dirName", + "modified": false + }, + { + "id": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "translation": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "modified": false + }, + { + "id": "meta", + "translation": "meta", + "modified": false + }, + { + "id": "i18n4go: extracting strings from file:", + "translation": "i18n4go: extracting strings from file:", + "modified": false + }, + { + "id": "generate standard .po file for translation", + "translation": "generate standard .po file for translation", + "modified": false + }, + { + "id": "WARNING running in -dry-run mode", + "translation": "WARNING running in -dry-run mode", + "modified": false + }, + { + "id": "Total files parsed:", + "translation": "Total files parsed:", + "modified": false + }, + { + "id": "directory", + "translation": "directory", + "modified": false + }, + { + "id": "ERROR opening file", + "translation": "ERROR opening file", + "modified": false + }, + { + "id": "Could not find:", + "translation": "Could not find:", + "modified": false + }, + { + "id": "capturing_group.json", + "translation": "capturing_group.json", + "modified": false + }, + { + "id": "Excluding regexps in file:", + "translation": "Excluding regexps in file:", + "modified": false + }, + { + "id": "dry-run", + "translation": "dry-run", + "modified": false + }, + { + "id": "ignore-regexp", + "translation": "ignore-regexp", + "modified": false + }, + { + "id": "WARNING ignoring file:", + "translation": "WARNING ignoring file:", + "modified": false + }, + { + "id": "Loaded %d excluded regexps", + "translation": "Loaded %d excluded regexps", + "modified": false + }, + { + "id": "Extracted total of %d strings\n\n", + "translation": "Extracted total of %d strings\n\n", + "modified": false + }, + { + "id": "Extract the translation strings from go source files", + "translation": "Extract the translation strings from go source files", + "modified": false + }, + { + "id": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", + "translation": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", + "modified": false + }, + { + "id": "output", + "translation": "output", + "modified": false + }, + { + "id": "Total extracted strings:", + "translation": "Total extracted strings:", + "modified": false + }, + { + "id": "Extracting strings in package:", + "translation": "Extracting strings in package:", + "modified": false + }, + { + "id": "src", + "translation": "src", + "modified": false + }, + { + "id": ".*test.*", + "translation": ".*test.*", + "modified": false + }, + { + "id": "Loaded %d substring regexps", + "translation": "Loaded %d substring regexps", + "modified": false + }, + { + "id": "output-match-package", + "translation": "output-match-package", + "modified": false + }, + { + "id": "Capturing substrings in file:", + "translation": "Capturing substrings in file:", + "modified": false + }, + { + "id": "Extracted %d strings from file: %s\n", + "translation": "Extracted %d strings from file: %s\n", + "modified": false + }, + { + "id": "the file name for which strings are extracted", + "translation": "the file name for which strings are extracted", + "modified": false + }, + { + "id": "exclude", + "translation": "exclude", + "modified": false + }, + { + "id": "generated files are created in directory to match the package name", + "translation": "generated files are created in directory to match the package name", + "modified": false + }, + { + "id": "output directory where the translation files will be placed", + "translation": "output directory where the translation files will be placed", + "modified": false + }, + { + "id": "i18n4go: could not extract strings from directory:", + "translation": "i18n4go: could not extract strings from directory:", + "modified": false + }, + { + "id": "WARNING No capturing group found in %s", + "translation": "WARNING No capturing group found in %s", + "modified": false + }, + { + "id": "extracted_strings.json", + "translation": "extracted_strings.json", + "modified": false + }, + { + "id": "po", + "translation": "po", + "modified": false + }, + { + "id": "file", + "translation": "file", + "modified": false + }, + { + "id": "Loaded %d excluded strings", + "translation": "Loaded %d excluded strings", + "modified": false + }, + { + "id": "WARNING error compiling regexp:", + "translation": "WARNING error compiling regexp:", + "modified": false + }, + { + "id": "the JSON file with strings to be excluded, defaults to excluded.json if present", + "translation": "the JSON file with strings to be excluded, defaults to excluded.json if present", + "modified": false + }, + { + "id": "substring-file", + "translation": "substring-file", + "modified": false + }, + { + "id": "prevents any output files from being created", + "translation": "prevents any output files from being created", + "modified": false + }, + { + "id": "i18n4go: inspecting dir %s, recursive: %t\n", + "translation": "i18n4go: inspecting dir %s, recursive: %t\n", + "modified": false + }, + { + "id": ".en.po", + "translation": ".en.po", + "modified": false + }, + { + "id": "recursive", + "translation": "recursive", + "modified": false + }, + { + "id": "PWD", + "translation": "PWD", + "modified": false + }, + { + "id": "No match for ignore-regexp:", + "translation": "No match for ignore-regexp:", + "modified": false + } +] diff --git a/i18n4go/i18n/resources/fixup.go.en.json b/i18n4go/i18n/resources/fixup.go.en.json new file mode 100644 index 0000000..266b7a6 --- /dev/null +++ b/i18n4go/i18n/resources/fixup.go.en.json @@ -0,0 +1,117 @@ +[ + { + "id": "en_US", + "translation": "en_US", + "modified": false + }, + { + "id": "Invalid response.", + "translation": "Invalid response.", + "modified": false + }, + { + "id": "fixup", + "translation": "fixup", + "modified": false + }, + { + "id": "Fixup the transation files", + "translation": "Fixup the transation files", + "modified": false + }, + { + "id": "recursively extract strings from all files in the same directory as filename or dirName", + "translation": "recursively extract strings from all files in the same directory as filename or dirName", + "modified": false + }, + { + "id": "Could not find an i18n file for locale: en_US", + "translation": "Could not find an i18n file for locale: en_US", + "modified": false + }, + { + "id": "Is the string \"%s\" a new or updated string? [new/upd]\n", + "translation": "Is the string \"%s\" a new or updated string? [new/upd]\n", + "modified": false + }, + { + "id": "Error when inspecting go file: ", + "translation": "Error when inspecting go file: ", + "modified": false + }, + { + "id": "Canceling fixup", + "translation": "Canceling fixup", + "modified": false + }, + { + "id": "Adding these strings to the %s translation file:\n", + "translation": "Adding these strings to the %s translation file:\n", + "modified": false + }, + { + "id": "Add, update, or remove translation keys from source files and resources files", + "translation": "Add, update, or remove translation keys from source files and resources files", + "modified": false + }, + { + "id": "Couldn't find any source strings: %s", + "translation": "Couldn't find any source strings: %s", + "modified": false + }, + { + "id": "Unable to find english translation files", + "translation": "Unable to find english translation files", + "modified": false + }, + { + "id": "Removing these strings from the %s translation file:\n", + "translation": "Removing these strings from the %s translation file:\n", + "modified": false + }, + { + "id": "ignore-regexp", + "translation": "ignore-regexp", + "modified": false + }, + { + "id": "Couldn't find the english strings: %s", + "translation": "Couldn't find the english strings: %s", + "modified": false + }, + { + "id": "new", + "translation": "new", + "modified": false + }, + { + "id": "upd", + "translation": "upd", + "modified": false + }, + { + "id": "OK", + "translation": "OK", + "modified": false + }, + { + "id": "exit", + "translation": "exit", + "modified": false + }, + { + "id": "Select the number for the previous translation:", + "translation": "Select the number for the previous translation:", + "modified": false + }, + { + "id": "Couldn't get the strings from %s: %s", + "translation": "Couldn't get the strings from %s: %s", + "modified": false + }, + { + "id": "Updating the following strings from the %s translation file:\n", + "translation": "Updating the following strings from the %s translation file:\n", + "modified": false + } +] diff --git a/i18n4go/i18n/resources/i18n4go.go.en.json b/i18n4go/i18n/resources/i18n4go.go.en.json new file mode 100644 index 0000000..46c59d3 --- /dev/null +++ b/i18n4go/i18n/resources/i18n4go.go.en.json @@ -0,0 +1,327 @@ +[ + { + "id": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", + "translation": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", + "modified": false + }, + { + "id": "[optional] the excluded JSON file name, all strings there will be excluded", + "translation": "[optional] the excluded JSON file name, all strings there will be excluded", + "modified": false + }, + { + "id": "output-flat", + "translation": "output-flat", + "modified": false + }, + { + "id": "i18n4go: Could not extract strings, err:", + "translation": "i18n4go: Could not extract strings, err:", + "modified": false + }, + { + "id": "\nusage: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -f \n or: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -d [-r] [--ignore-regexp ]\n\nusage: i18n4go -c rewrite-package [-v] [-r] -d [--i18n-strings-filename | --i18n-strings-dirname ] [--init-code-snippet-filename ] [--ignore-regexp ]\n or: i18n4go -c rewrite-package [-v] [-r] -f --i18n-strings-filename [--init-code-snippet-filename ] [--ignore-regexp ]\n\nusage: i18n4go -c create-translations [-v] [--google-translate-api-key ] [--source-language ] -f --languages -o \n\nusage: i18n4go -c merge-strings [-v] [-r] [--source-language ] -d \n\nusage: i18n4go -c verify-strings [-v] [--source-language ] -f --language-files [-o ]\n or: i18n4go -c verify-strings [-v] [--source-language ] -f --languages [-o ]\n\nusage: i18n4go -c show-missing-strings [-v] -d --i18n-strings-filename \n\nusage: i18n4go -c checkup\n\n -h | --help prints the usage\n -v verbose\n\n EXTRACT-STRINGS:\n\n -c extract-strings the extract strings command\n\n --po to generate standard .po files for translation\n -e [optional] the JSON file with strings to be excluded, defaults to excluded.json if present\n\t-s\t\t\t\t\t\t\t\t\t\t\t\t [optional] the JSON file with regexp that specify a capturing group to be extracted instead of the full string matching the regexp\n --meta [optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file\n --dry-run [optional] prevents any output files from being created\n\n\n --output-flat generated files are created in the specified output directory (default)\n --output-match-package generated files are created in directory to match the package name\n -o the output directory where the translation files will be placed\n\n -f the go file name to extract strings\n\n -d the directory containing the go files to extract strings\n\n -r [optional] recursesively extract strings from all subdirectories\n --ignore-regexp [optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n REWRITE-PACKAGE:\n\n -c rewrite-package the rewrite package command\n -f the source go file to be rewritten\n -d the directory containing the go files to rewrite\n\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n --i18n-strings-dirname a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name\n --root-path the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified\n\n --init-code-snippet-filename [optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization\"\n -o [optional] output diretory for rewritten file. If not specified, the original file will be overwritten\n\n --ignore-regexp\t\t[optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n MERGE STRINGS:\n\n -c merge-strings the merge strings command which merges multiple .go..json files into a .all.json\n\n -r [optional] recursesively combine files from all subdirectories\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \"en_US\" (default to 'en')\n\n -d the directory containing the json files to combine\n\n CREATE-TRANSLATIONS:\n\n -c create-translations the create translations command\n\n --google-translate-api-key [optional] your public Google Translate API key which is used to generate translations (charge is applicable)\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \\\"en_US\\\"\n\n -f the source translation file\n --languages a comma separated list of valid languages with optional territory, e.g., \\\"en, en_US, fr_FR, es\\\"\n -o the output directory where the newly created translation files will be placed\n\n VERIFY-STRINGS:\n\n -c verify-strings the verify strings command\n\n --source-language [optional] the source language of the source translation file (default to 'en')\n\n -f the source translation file\n\n --language-files a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\"\n if not specified then the languages flag is used to find target files in same directory as source\n --languages a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"\n\n -o the output directory where the missing translation keys will be placed\n\n SHOW-MISSING-STRINGS:\n\n -c show-missing-strings the missing strings command\n\n -d the directory containing the go files to validate\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n\n CHECKUP:\n\n -c checkup the checkup command which ensures that the strings in code match strings in resource files and vice versa\n -q the qualifier to use when calling the T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for T(...) function\n\n FIXUP:\n\n -c fixup the fixup command which interactively lets users add, update, or remove translations keys from code and resource files.\n", + "translation": "\nusage: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -f \n or: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -d [-r] [--ignore-regexp ]\n\nusage: i18n4go -c rewrite-package [-v] [-r] -d [--i18n-strings-filename | --i18n-strings-dirname ] [--init-code-snippet-filename ] [--ignore-regexp ]\n or: i18n4go -c rewrite-package [-v] [-r] -f --i18n-strings-filename [--init-code-snippet-filename ] [--ignore-regexp ]\n\nusage: i18n4go -c create-translations [-v] [--google-translate-api-key ] [--source-language ] -f --languages -o \n\nusage: i18n4go -c merge-strings [-v] [-r] [--source-language ] -d \n\nusage: i18n4go -c verify-strings [-v] [--source-language ] -f --language-files [-o ]\n or: i18n4go -c verify-strings [-v] [--source-language ] -f --languages [-o ]\n\nusage: i18n4go -c show-missing-strings [-v] -d --i18n-strings-filename \n\nusage: i18n4go -c checkup\n\n -h | --help prints the usage\n -v verbose\n\n EXTRACT-STRINGS:\n\n -c extract-strings the extract strings command\n\n --po to generate standard .po files for translation\n -e [optional] the JSON file with strings to be excluded, defaults to excluded.json if present\n\t-s\t\t\t\t\t\t\t\t\t\t\t\t [optional] the JSON file with regexp that specify a capturing group to be extracted instead of the full string matching the regexp\n --meta [optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file\n --dry-run [optional] prevents any output files from being created\n\n\n --output-flat generated files are created in the specified output directory (default)\n --output-match-package generated files are created in directory to match the package name\n -o the output directory where the translation files will be placed\n\n -f the go file name to extract strings\n\n -d the directory containing the go files to extract strings\n\n -r [optional] recursesively extract strings from all subdirectories\n --ignore-regexp [optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n REWRITE-PACKAGE:\n\n -c rewrite-package the rewrite package command\n -f the source go file to be rewritten\n -d the directory containing the go files to rewrite\n\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n --i18n-strings-dirname a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name\n --root-path the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified\n\n --init-code-snippet-filename [optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization\"\n -o [optional] output diretory for rewritten file. If not specified, the original file will be overwritten\n\n --ignore-regexp\t\t[optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n MERGE STRINGS:\n\n -c merge-strings the merge strings command which merges multiple .go..json files into a .all.json\n\n -r [optional] recursesively combine files from all subdirectories\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \"en_US\" (default to 'en')\n\n -d the directory containing the json files to combine\n\n CREATE-TRANSLATIONS:\n\n -c create-translations the create translations command\n\n --google-translate-api-key [optional] your public Google Translate API key which is used to generate translations (charge is applicable)\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \\\"en_US\\\"\n\n -f the source translation file\n --languages a comma separated list of valid languages with optional territory, e.g., \\\"en, en_US, fr_FR, es\\\"\n -o the output directory where the newly created translation files will be placed\n\n VERIFY-STRINGS:\n\n -c verify-strings the verify strings command\n\n --source-language [optional] the source language of the source translation file (default to 'en')\n\n -f the source translation file\n\n --language-files a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\"\n if not specified then the languages flag is used to find target files in same directory as source\n --languages a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"\n\n -o the output directory where the missing translation keys will be placed\n\n SHOW-MISSING-STRINGS:\n\n -c show-missing-strings the missing strings command\n\n -d the directory containing the go files to validate\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n\n CHECKUP:\n\n -c checkup the checkup command which ensures that the strings in code match strings in resource files and vice versa\n -q the qualifier to use when calling the T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for T(...) function\n\n FIXUP:\n\n -c fixup the fixup command which interactively lets users add, update, or remove translations keys from code and resource files.\n", + "modified": false + }, + { + "id": "po", + "translation": "po", + "modified": false + }, + { + "id": "output-match-package", + "translation": "output-match-package", + "modified": false + }, + { + "id": "i18n4go: Could not verify strings for input filename, err:", + "translation": "i18n4go: Could not verify strings for input filename, err:", + "modified": false + }, + { + "id": "i18n4go: Could not successfully rewrite package, err:", + "translation": "i18n4go: Could not successfully rewrite package, err:", + "modified": false + }, + { + "id": "en", + "translation": "en", + "modified": false + }, + { + "id": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", + "translation": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", + "modified": false + }, + { + "id": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "translation": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "modified": false + }, + { + "id": "the dir name for which all .go files will have their strings extracted", + "translation": "the dir name for which all .go files will have their strings extracted", + "modified": false + }, + { + "id": "extract-strings", + "translation": "extract-strings", + "modified": false + }, + { + "id": "merge-strings", + "translation": "merge-strings", + "modified": false + }, + { + "id": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)", + "translation": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)", + "modified": false + }, + { + "id": "i18n-strings-dirname", + "translation": "i18n-strings-dirname", + "modified": false + }, + { + "id": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", + "translation": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", + "modified": false + }, + { + "id": ".*test.*", + "translation": ".*test.*", + "modified": false + }, + { + "id": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", + "translation": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", + "modified": false + }, + { + "id": "fixup", + "translation": "fixup", + "modified": false + }, + { + "id": "output directory where the translation files will be placed", + "translation": "output directory where the translation files will be placed", + "modified": false + }, + { + "id": "generated files are created in the specified output directory", + "translation": "generated files are created in the specified output directory", + "modified": false + }, + { + "id": "language-files", + "translation": "language-files", + "modified": false + }, + { + "id": "verify-strings", + "translation": "verify-strings", + "modified": false + }, + { + "id": "show-missing-strings", + "translation": "show-missing-strings", + "modified": false + }, + { + "id": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", + "translation": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", + "modified": false + }, + { + "id": "the file name for which strings are extracted", + "translation": "the file name for which strings are extracted", + "modified": false + }, + { + "id": "v1.4.0", + "translation": "v1.4.0", + "modified": false + }, + { + "id": "Total time:", + "translation": "Total time:", + "modified": false + }, + { + "id": "prints the usage", + "translation": "prints the usage", + "modified": false + }, + { + "id": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "translation": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "modified": false + }, + { + "id": "verbose", + "translation": "verbose", + "modified": false + }, + { + "id": "i18n4go: Could not show missing strings, err:", + "translation": "i18n4go: Could not show missing strings, err:", + "modified": false + }, + { + "id": "source-language", + "translation": "source-language", + "modified": false + }, + { + "id": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", + "translation": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", + "modified": false + }, + { + "id": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", + "translation": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", + "modified": false + }, + { + "id": "An unexpected type of error", + "translation": "An unexpected type of error", + "modified": false + }, + { + "id": "create-translations", + "translation": "create-translations", + "modified": false + }, + { + "id": "rewrite-package", + "translation": "rewrite-package", + "modified": false + }, + { + "id": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", + "translation": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", + "modified": false + }, + { + "id": "prevents any output files from being created", + "translation": "prevents any output files from being created", + "modified": false + }, + { + "id": "capturing_group.json", + "translation": "capturing_group.json", + "modified": false + }, + { + "id": "init-code-snippet-filename", + "translation": "init-code-snippet-filename", + "modified": false + }, + { + "id": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", + "translation": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", + "modified": false + }, + { + "id": "i18n-strings-filename", + "translation": "i18n-strings-filename", + "modified": false + }, + { + "id": "meta", + "translation": "meta", + "modified": false + }, + { + "id": "recursively extract strings from all files in the same directory as filename or dirName", + "translation": "recursively extract strings from all files in the same directory as filename or dirName", + "modified": false + }, + { + "id": "checkup", + "translation": "checkup", + "modified": false + }, + { + "id": "i18n4go: Could not create translation files, err:", + "translation": "i18n4go: Could not create translation files, err:", + "modified": false + }, + { + "id": "ignore-regexp", + "translation": "ignore-regexp", + "modified": false + }, + { + "id": "%s\nVersion %s", + "translation": "%s\nVersion %s", + "modified": false + }, + { + "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "modified": false + }, + { + "id": "generated files are created in directory to match the package name", + "translation": "generated files are created in directory to match the package name", + "modified": false + }, + { + "id": "generate standard .po file for translation", + "translation": "generate standard .po file for translation", + "modified": false + }, + { + "id": "dry-run", + "translation": "dry-run", + "modified": false + }, + { + "id": "root-path", + "translation": "root-path", + "modified": false + }, + { + "id": "General purpose tool for i18n", + "translation": "General purpose tool for i18n", + "modified": false + }, + { + "id": "i18n4go: Could not checkup, err:", + "translation": "i18n4go: Could not checkup, err:", + "modified": false + }, + { + "id": "google-translate-api-key", + "translation": "google-translate-api-key", + "modified": false + }, + { + "id": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", + "translation": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", + "modified": false + }, + { + "id": "i18n4go: Could not fixup, err:", + "translation": "i18n4go: Could not fixup, err:", + "modified": false + }, + { + "id": "languages", + "translation": "languages", + "modified": false + }, + { + "id": "verbose mode where lots of output is generated during execution", + "translation": "verbose mode where lots of output is generated during execution", + "modified": false + }, + { + "id": "i18n4go: Could not merge strings, err:", + "translation": "i18n4go: Could not merge strings, err:", + "modified": false + } +] diff --git a/i18n4go/i18n/resources/init.go.en.json b/i18n4go/i18n/resources/init.go.en.json new file mode 100644 index 0000000..637235d --- /dev/null +++ b/i18n4go/i18n/resources/init.go.en.json @@ -0,0 +1,87 @@ +[ + { + "id": "fr_FR", + "translation": "fr_FR", + "modified": false + }, + { + "id": "pt_BR", + "translation": "pt_BR", + "modified": false + }, + { + "id": "i18n4go_res", + "translation": "i18n4go_res", + "modified": false + }, + { + "id": "resources", + "translation": "resources", + "modified": false + }, + { + "id": ".all.json", + "translation": ".all.json", + "modified": false + }, + { + "id": "en_US", + "translation": "en_US", + "modified": false + }, + { + "id": "en", + "translation": "en", + "modified": false + }, + { + "id": "zh_CN", + "translation": "zh_CN", + "modified": false + }, + { + "id": "cf", + "translation": "cf", + "modified": false + }, + { + "id": "de_DE", + "translation": "de_DE", + "modified": false + }, + { + "id": "Could not load i18n asset: %v", + "translation": "Could not load i18n asset: %v", + "modified": false + }, + { + "id": "ru_RU", + "translation": "ru_RU", + "modified": false + }, + { + "id": "Could not load en_US language files. God save the queen. ", + "translation": "Could not load en_US language files. God save the queen. ", + "modified": false + }, + { + "id": "es_ES", + "translation": "es_ES", + "modified": false + }, + { + "id": "it_IT", + "translation": "it_IT", + "modified": false + }, + { + "id": "ja_JA", + "translation": "ja_JA", + "modified": false + }, + { + "id": "ko_KO", + "translation": "ko_KO", + "modified": false + } +] diff --git a/i18n4go/i18n/resources/merge_string.go.en.json b/i18n4go/i18n/resources/merge_string.go.en.json new file mode 100644 index 0000000..e029790 --- /dev/null +++ b/i18n4go/i18n/resources/merge_string.go.en.json @@ -0,0 +1,57 @@ +[ + { + "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "modified": false + }, + { + "id": "directory", + "translation": "directory", + "modified": false + }, + { + "id": "i18n4go: scanning file: ", + "translation": "i18n4go: scanning file: ", + "modified": false + }, + { + "id": "recursive", + "translation": "recursive", + "modified": false + }, + { + "id": "recursively extract strings from all files in the same directory as filename or dirName", + "translation": "recursively extract strings from all files in the same directory as filename or dirName", + "modified": false + }, + { + "id": "en", + "translation": "en", + "modified": false + }, + { + "id": "the dir name for which all .go files will have their strings extracted", + "translation": "the dir name for which all .go files will have their strings extracted", + "modified": false + }, + { + "id": "i18n4go: saving combined language file: ", + "translation": "i18n4go: saving combined language file: ", + "modified": false + }, + { + "id": "merge-strings", + "translation": "merge-strings", + "modified": false + }, + { + "id": "Merge translation strings", + "translation": "Merge translation strings", + "modified": false + }, + { + "id": "source-language", + "translation": "source-language", + "modified": false + } +] diff --git a/i18n4go/i18n/resources/rewrite_package.go.en.json b/i18n4go/i18n/resources/rewrite_package.go.en.json new file mode 100644 index 0000000..136b1c2 --- /dev/null +++ b/i18n4go/i18n/resources/rewrite_package.go.en.json @@ -0,0 +1,262 @@ +[ + { + "id": "i18n4go: error determining the import path:", + "translation": "i18n4go: error determining the import path:", + "modified": false + }, + { + "id": "i18n4go: got a pkg with import:", + "translation": "i18n4go: got a pkg with import:", + "modified": false + }, + { + "id": " to output dir:", + "translation": " to output dir:", + "modified": false + }, + { + "id": "i18n4go: loading JSON strings from file: %s\n", + "translation": "i18n4go: loading JSON strings from file: %s\n", + "modified": false + }, + { + "id": "the dir name for which all .go files will have their strings extracted", + "translation": "the dir name for which all .go files will have their strings extracted", + "modified": false + }, + { + "id": "i18n4go: inserting T() calls for strings that need to be translated", + "translation": "i18n4go: inserting T() calls for strings that need to be translated", + "modified": false + }, + { + "id": "i18n-strings-filename", + "translation": "i18n-strings-filename", + "modified": false + }, + { + "id": "recursive", + "translation": "recursive", + "modified": false + }, + { + "id": "filepath.Join(", + "translation": "filepath.Join(", + "modified": false + }, + { + "id": "generate standard .po file for translation", + "translation": "generate standard .po file for translation", + "modified": false + }, + { + "id": "i18n4go: got a root pkg with import path:", + "translation": "i18n4go: got a root pkg with import path:", + "modified": false + }, + { + "id": "i18n4go: error reading content of init code snippet file: %s\n, using default", + "translation": "i18n4go: error reading content of init code snippet file: %s\n, using default", + "modified": false + }, + { + "id": "PWD", + "translation": "PWD", + "modified": false + }, + { + "id": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", + "translation": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", + "modified": false + }, + { + "id": "i18n4go: using the PWD as the rootPath:", + "translation": "i18n4go: using the PWD as the rootPath:", + "modified": false + }, + { + "id": "i18n4go: using import path as:", + "translation": "i18n4go: using import path as:", + "modified": false + }, + { + "id": "rewrite-package", + "translation": "rewrite-package", + "modified": false + }, + { + "id": "i18n4go: got a local import %s so using %s instead for pkg", + "translation": "i18n4go: got a local import %s so using %s instead for pkg", + "modified": false + }, + { + "id": "recursively rewrite packages from all files in the same directory as filename or dirName", + "translation": "recursively rewrite packages from all files in the same directory as filename or dirName", + "modified": false + }, + { + "id": "i18n4go: error saving updated i18n strings file:", + "translation": "i18n4go: error saving updated i18n strings file:", + "modified": false + }, + { + "id": "i18n4go: error getting root path import:", + "translation": "i18n4go: error getting root path import:", + "modified": false + }, + { + "id": "i18n4go: adding init func to package:", + "translation": "i18n4go: adding init func to package:", + "modified": false + }, + { + "id": "saving file to path", + "translation": "saving file to path", + "modified": false + }, + { + "id": "Rewrite translated packages from go source files", + "translation": "Rewrite translated packages from go source files", + "modified": false + }, + { + "id": "root-path", + "translation": "root-path", + "modified": false + }, + { + "id": "ignore-regexp", + "translation": "ignore-regexp", + "modified": false + }, + { + "id": "Total rewritten strings:", + "translation": "Total rewritten strings:", + "modified": false + }, + { + "id": "i18n4go: error saving AST file:", + "translation": "i18n4go: error saving AST file:", + "modified": false + }, + { + "id": "init-code-snippet-filename", + "translation": "init-code-snippet-filename", + "modified": false + }, + { + "id": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", + "translation": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", + "modified": false + }, + { + "id": "Total files parsed:", + "translation": "Total files parsed:", + "modified": false + }, + { + "id": "cowardly refusing to translate the strings in test file:", + "translation": "cowardly refusing to translate the strings in test file:", + "modified": false + }, + { + "id": "output", + "translation": "output", + "modified": false + }, + { + "id": "i18n4go: WARNING could not find JSON file:", + "translation": "i18n4go: WARNING could not find JSON file:", + "modified": false + }, + { + "id": "i18n4go: error adding init() func to package:", + "translation": "i18n4go: error adding init() func to package:", + "modified": false + }, + { + "id": "i18n4go: determining import path using root path:", + "translation": "i18n4go: determining import path using root path:", + "modified": false + }, + { + "id": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", + "translation": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", + "modified": false + }, + { + "id": "i18n4go: error appending T() to AST file:", + "translation": "i18n4go: error appending T() to AST file:", + "modified": false + }, + { + "id": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", + "translation": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", + "modified": false + }, + { + "id": "output directory where the translation files will be placed", + "translation": "output directory where the translation files will be placed", + "modified": false + }, + { + "id": "package __PACKAGE__NAME__\n\nimport (\n\t\"path/filepath\"\n\n\ti18n \"github.com/maximilien/i18n4go/i18n\"\n)\n\nvar T i18n.TranslateFunc\n\nfunc init() {\n\tT = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath())\n}", + "translation": "package __PACKAGE__NAME__\n\nimport (\n\t\"path/filepath\"\n\n\ti18n \"github.com/maximilien/i18n4go/i18n\"\n)\n\nvar T i18n.TranslateFunc\n\nfunc init() {\n\tT = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath())\n}", + "modified": false + }, + { + "id": "i18n-strings-dirname", + "translation": "i18n-strings-dirname", + "modified": false + }, + { + "id": "i18n_init.go", + "translation": "i18n_init.go", + "modified": false + }, + { + "id": "directory", + "translation": "directory", + "modified": false + }, + { + "id": "file", + "translation": "file", + "modified": false + }, + { + "id": "the source go file to be rewritten", + "translation": "the source go file to be rewritten", + "modified": false + }, + { + "id": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", + "translation": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", + "modified": false + }, + { + "id": "i18n4go: rewriting strings in dir %s, recursive: %t\n", + "translation": "i18n4go: rewriting strings in dir %s, recursive: %t\n", + "modified": false + }, + { + "id": "i18n4go: rewriting strings for source file:", + "translation": "i18n4go: rewriting strings for source file:", + "modified": false + }, + { + "id": "i18n4go: got a local import %s so using %s instead for root pkg", + "translation": "i18n4go: got a local import %s so using %s instead for root pkg", + "modified": false + }, + { + "id": "string", + "translation": "string", + "modified": false + }, + { + "id": "WARNING compiling ignore-regexp:", + "translation": "WARNING compiling ignore-regexp:", + "modified": false + } +] diff --git a/i18n4go/i18n/resources/show_missing_strings.go.en.json b/i18n4go/i18n/resources/show_missing_strings.go.en.json new file mode 100644 index 0000000..6388221 --- /dev/null +++ b/i18n4go/i18n/resources/show_missing_strings.go.en.json @@ -0,0 +1,77 @@ +[ + { + "id": "directory", + "translation": "directory", + "modified": false + }, + { + "id": "PWD", + "translation": "PWD", + "modified": false + }, + { + "id": "Additional:", + "translation": "Additional:", + "modified": false + }, + { + "id": "show-missing-strings", + "translation": "show-missing-strings", + "modified": false + }, + { + "id": "Missing Strings!", + "translation": "Missing Strings!", + "modified": false + }, + { + "id": "Found", + "translation": "Found", + "modified": false + }, + { + "id": "Additional Strings!", + "translation": "Additional Strings!", + "modified": false + }, + { + "id": "WARNING ignoring file:", + "translation": "WARNING ignoring file:", + "modified": false + }, + { + "id": "the directory containing the go files to validate", + "translation": "the directory containing the go files to validate", + "modified": false + }, + { + "id": "Missing:", + "translation": "Missing:", + "modified": false + }, + { + "id": "UNDER", + "translation": "UNDER", + "modified": false + }, + { + "id": "Shows missing strings in translations", + "translation": "Shows missing strings in translations", + "modified": false + }, + { + "id": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", + "translation": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", + "modified": false + }, + { + "id": "Adding to translated strings:", + "translation": "Adding to translated strings:", + "modified": false + }, + { + "id": "i18n-strings-filename", + "translation": "i18n-strings-filename", + "modified": false + } +] diff --git a/i18n4go/i18n/resources/verify_strings.go.en.json b/i18n4go/i18n/resources/verify_strings.go.en.json new file mode 100644 index 0000000..b1fc970 --- /dev/null +++ b/i18n4go/i18n/resources/verify_strings.go.en.json @@ -0,0 +1,162 @@ +[ + { + "id": "the source translation file", + "translation": "the source translation file", + "modified": false + }, + { + "id": "i18n4go: ERROR input file does not match target file:", + "translation": "i18n4go: ERROR input file does not match target file:", + "modified": false + }, + { + "id": "File has duplicated key: %s\n%s", + "translation": "File has duplicated key: %s\n%s", + "modified": false + }, + { + "id": "i18n4go: WARNING target file has extra key with ID: ", + "translation": "i18n4go: WARNING target file has extra key with ID: ", + "modified": false + }, + { + "id": "i18n4go: target file has extra i18n strings with IDs: %s", + "translation": "i18n4go: target file has extra i18n strings with IDs: %s", + "modified": false + }, + { + "id": "verify-strings", + "translation": "verify-strings", + "modified": false + }, + { + "id": "Verify strings in translations", + "translation": "Verify strings in translations", + "modified": false + }, + { + "id": "languages", + "translation": "languages", + "modified": false + }, + { + "id": "the output directory where the missing translation keys will be placed", + "translation": "the output directory where the missing translation keys will be placed", + "modified": false + }, + { + "id": "file", + "translation": "file", + "modified": false + }, + { + "id": "i18n4go: Error checking input filename: ", + "translation": "i18n4go: Error checking input filename: ", + "modified": false + }, + { + "id": "i18n4go: target file is missing i18n strings with IDs: %s", + "translation": "i18n4go: target file is missing i18n strings with IDs: %s", + "modified": false + }, + { + "id": "source-language", + "translation": "source-language", + "modified": false + }, + { + "id": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", + "translation": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", + "modified": false + }, + { + "id": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "translation": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "modified": false + }, + { + "id": "targetFilenames:", + "translation": "targetFilenames:", + "modified": false + }, + { + "id": "i18n4go: Error input file: %s is empty", + "translation": "i18n4go: Error input file: %s is empty", + "modified": false + }, + { + "id": "i18n4go: WARNING target file contains total of extra keys:", + "translation": "i18n4go: WARNING target file contains total of extra keys:", + "modified": false + }, + { + "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "modified": false + }, + { + "id": "language-files", + "translation": "language-files", + "modified": false + }, + { + "id": "i18n4go: WARNING target file has invalid templated translations with key ID: ", + "translation": "i18n4go: WARNING target file has invalid templated translations with key ID: ", + "modified": false + }, + { + "id": "i18n4go: ERROR could not create the diff file:", + "translation": "i18n4go: ERROR could not create the diff file:", + "modified": false + }, + { + "id": "i18n4go: generated diff file:", + "translation": "i18n4go: generated diff file:", + "modified": false + }, + { + "id": "i18n4go: target file has invalid i18n strings with IDs: %s", + "translation": "i18n4go: target file has invalid i18n strings with IDs: %s", + "modified": false + }, + { + "id": "en", + "translation": "en", + "modified": false + }, + { + "id": "i18n4go: Error loading the i18n strings from input filename:", + "translation": "i18n4go: Error loading the i18n strings from input filename:", + "modified": false + }, + { + "id": "i18n4go: WARNING target file contains total of invalid translations:", + "translation": "i18n4go: WARNING target file contains total of invalid translations:", + "modified": false + }, + { + "id": ".missing.diff.json", + "translation": ".missing.diff.json", + "modified": false + }, + { + "id": "output", + "translation": "output", + "modified": false + }, + { + "id": "i18n4go: Error verifying target filename: ", + "translation": "i18n4go: Error verifying target filename: ", + "modified": false + }, + { + "id": "i18n4go: Error loading the i18n strings from target filename:", + "translation": "i18n4go: Error loading the i18n strings from target filename:", + "modified": false + }, + { + "id": "i18n4go: templated string is invalid, missing args in translation:", + "translation": "i18n4go: templated string is invalid, missing args in translation:", + "modified": false + } +] diff --git a/i18n4go/i18n/resources/version.go.en.json b/i18n4go/i18n/resources/version.go.en.json new file mode 100644 index 0000000..bdbe9c9 --- /dev/null +++ b/i18n4go/i18n/resources/version.go.en.json @@ -0,0 +1,27 @@ +[ + { + "id": "Build Date: %s\n", + "translation": "Build Date: %s\n", + "modified": false + }, + { + "id": "Git Revision: %s\n", + "translation": "Git Revision: %s\n", + "modified": false + }, + { + "id": "version", + "translation": "version", + "modified": false + }, + { + "id": "Show the version of the i18n client", + "translation": "Show the version of the i18n client", + "modified": false + }, + { + "id": "Version: %s\n", + "translation": "Version: %s\n", + "modified": false + } +] \ No newline at end of file From ac78ac5c97a565342f6c2e8743f424320290abb2 Mon Sep 17 00:00:00 2001 From: Aerex Date: Mon, 13 Nov 2023 21:18:14 -0600 Subject: [PATCH 02/13] chore: reduce translation into a single file --- bin/build | 2 +- go.mod | 1 + go.sum | 2 + i18n4go/cmds/checkup.go | 64 +- i18n4go/cmds/i18n_init.go | 11 + i18n4go/i18n/i18n_init.go.template | 2 +- i18n4go/i18n/init.go | 18 +- .../resources/{en.all.json => all.en_US.json} | 2 +- i18n4go/i18n/resources/ast.go.en.json | 7 - i18n4go/i18n/resources/checkup.go.en.json | 92 -- i18n4go/i18n/resources/common.go.en.json | 47 - .../resources/create_translations.go.en.json | 152 -- .../i18n/resources/extract_strings.go.en.json | 272 --- i18n4go/i18n/resources/fixup.go.en.json | 117 -- i18n4go/i18n/resources/i18n4go.go.en.json | 327 ---- i18n4go/i18n/resources/init.go.en.json | 87 - .../i18n/resources/merge_string.go.en.json | 57 - .../i18n/resources/rewrite_package.go.en.json | 262 --- .../resources/show_missing_strings.go.en.json | 77 - .../i18n/resources/verify_strings.go.en.json | 162 -- i18n4go/i18n/resources/version.go.en.json | 27 - i18n4go/resources/i18n_resources.go | 1455 +++++++++++++++++ 22 files changed, 1513 insertions(+), 1730 deletions(-) create mode 100644 i18n4go/cmds/i18n_init.go rename i18n4go/i18n/resources/{en.all.json => all.en_US.json} (99%) delete mode 100644 i18n4go/i18n/resources/ast.go.en.json delete mode 100644 i18n4go/i18n/resources/checkup.go.en.json delete mode 100644 i18n4go/i18n/resources/common.go.en.json delete mode 100644 i18n4go/i18n/resources/create_translations.go.en.json delete mode 100644 i18n4go/i18n/resources/extract_strings.go.en.json delete mode 100644 i18n4go/i18n/resources/fixup.go.en.json delete mode 100644 i18n4go/i18n/resources/i18n4go.go.en.json delete mode 100644 i18n4go/i18n/resources/init.go.en.json delete mode 100644 i18n4go/i18n/resources/merge_string.go.en.json delete mode 100644 i18n4go/i18n/resources/rewrite_package.go.en.json delete mode 100644 i18n4go/i18n/resources/show_missing_strings.go.en.json delete mode 100644 i18n4go/i18n/resources/verify_strings.go.en.json delete mode 100644 i18n4go/i18n/resources/version.go.en.json create mode 100644 i18n4go/resources/i18n_resources.go diff --git a/bin/build b/bin/build index 0f9d85e..a9ea41f 100755 --- a/bin/build +++ b/bin/build @@ -20,4 +20,4 @@ echo -e "\n Formatting packages..." go fmt ./... echo -e "\nGenerating Binary..." -go build -o $(dirname $0)/../out/i18n4go ./i18n4go/i18n4go.go +go build -o $(dirname $0)/../out/i18n4go ./i18n4go.go diff --git a/go.mod b/go.mod index 7f9458b..bf584da 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( github.com/BurntSushi/toml v1.2.1 // indirect github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/go-bindata/go-bindata v3.1.2+incompatible // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/nxadm/tail v1.4.8 // indirect diff --git a/go.sum b/go.sum index f59013a..4194b8e 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/go-bindata/go-bindata v3.1.2+incompatible h1:5vjJMVhowQdPzjE1LdxyFF7YFTXg5IgGVW4gBr5IbvE= +github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= diff --git a/i18n4go/cmds/checkup.go b/i18n4go/cmds/checkup.go index f191955..6bb5527 100644 --- a/i18n4go/cmds/checkup.go +++ b/i18n4go/cmds/checkup.go @@ -50,16 +50,16 @@ func NewCheckup(options *common.Options) *Checkup { // NewCheckupCommand implements 'i18n4go checkup' command func NewCheckupCommand(options *common.Options) *cobra.Command { checkupCmd := &cobra.Command{ - Use: "checkup", - Short: "Checks the transated files", + Use: T("checkup"), + Short: T("Checks the transated files"), RunE: func(cmd *cobra.Command, args []string) error { return NewCheckup(options).Run() }, } - checkupCmd.Flags().StringVarP(&options.QualifierFlag, "qualifier", "q", "", "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)") + checkupCmd.Flags().StringVarP(&options.QualifierFlag, T("qualifier"), T("q"), T(""), T("[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)")) // TODO: Optional flags shouldn't have set defaults. We should look into removing the default - checkupCmd.Flags().StringVar(&options.IgnoreRegexpFlag, "ignore-regexp", ".*test.*", "recursively extract strings from all files in the same directory as filename or dirName") + checkupCmd.Flags().StringVar(&options.IgnoreRegexpFlag, T("ignore-regexp"), T(".*test.*"), T("recursively extract strings from all files in the same directory as filename or dirName")) return checkupCmd } @@ -88,44 +88,44 @@ func (cu *Checkup) Run() error { sourceStrings, err := cu.findSourceStrings() if err != nil { - cu.Println(fmt.Sprintf("Couldn't find any source strings: %s", err.Error())) + cu.Println(fmt.Sprintf(T("Couldn't find any source strings: {{.Arg0}}", map[string]interface{}{"Arg0": err.Error()}))) return err } - locales := findTranslationFiles(".", cu.IgnoreRegexp, false) + locales := findTranslationFiles(T("."), cu.IgnoreRegexp, false) - englishFiles := locales["en_US"] + englishFiles := locales[T("en_US")] if englishFiles == nil { - cu.Println("Could not find an i18n file for locale: en_US") - return errors.New("Could not find an i18n file for locale: en_US") + cu.Println(T("Could not find an i18n file for locale: en_US")) + return errors.New(T("Could not find an i18n file for locale: en_US")) } englishStrings, err := cu.findI18nStrings(englishFiles) if err != nil { - cu.Println(fmt.Sprintf("Couldn't find the english strings: %s", err.Error())) + cu.Println(fmt.Sprintf(T("Couldn't find the english strings: {{.Arg0}}", map[string]interface{}{"Arg0": err.Error()}))) return err } - err = cu.diffStrings("the code", "en_US", sourceStrings, englishStrings) + err = cu.diffStrings(T("the code"), T("en_US"), sourceStrings, englishStrings) for locale, i18nFiles := range locales { - if locale == "en_US" { + if locale == T("en_US") { continue } translatedStrings, err := cu.findI18nStrings(i18nFiles) if err != nil { - cu.Println(fmt.Sprintf("Couldn't get the strings from %s: %s", locale, err.Error())) + cu.Println(fmt.Sprintf(T("Couldn't get the strings from {{.Arg0}}: {{.Arg1}}", map[string]interface{}{"Arg0": locale, "Arg1": err.Error()}))) return err } - err = cu.diffStrings("en_US", locale, englishStrings, translatedStrings) + err = cu.diffStrings(T("en_US"), locale, englishStrings, translatedStrings) } if err == nil { - cu.Printf("OK") + cu.Printf(T("OK")) } return err @@ -138,7 +138,7 @@ func getGoFiles(dir string) (files []string) { if !fileInfo.IsDir() { name := fileInfo.Name() - if strings.HasSuffix(name, ".go") && !strings.HasSuffix(name, "_test.go") { + if strings.HasSuffix(name, T(".go")) && !strings.HasSuffix(name, T("_test.go")) { files = append(files, filepath.Join(dir, fileInfo.Name())) } } else { @@ -212,7 +212,7 @@ func (cu *Checkup) inspectCallExpr(translatedStrings []string, stmtMap map[strin case *ast.Ident: funName := node.Fun.(*ast.Ident).Name // inspect any T() or t() method calls - if funName == "T" || funName == "t" { + if funName == T("T") || funName == T("t") { translatedStrings = cu.inspectTFunc(translatedStrings, stmtMap, *node) } @@ -221,7 +221,7 @@ func (cu *Checkup) inspectCallExpr(translatedStrings []string, stmtMap map[strin if ident, ok := expr.X.(*ast.Ident); ok { funName := expr.Sel.Name // inspect any .T() or .t() method calls (eg. i18n.T()) - if ident.Name == cu.options.QualifierFlag && (funName == "T" || funName == "t") { + if ident.Name == cu.options.QualifierFlag && (funName == T("T") || funName == T("t")) { translatedStrings = cu.inspectTFunc(translatedStrings, stmtMap, *node) } } @@ -264,12 +264,12 @@ func (cu *Checkup) inspectFile(file string) (translatedStrings []string, err err func (cu *Checkup) findSourceStrings() (sourceStrings map[string]string, err error) { sourceStrings = make(map[string]string) - files := getGoFiles(".") + files := getGoFiles(T(".")) for _, file := range files { fileStrings, err := cu.inspectFile(file) if err != nil { - cu.Println("Error when inspecting go file: ", file) + cu.Println(T("Error when inspecting go file: "), file) return sourceStrings, err } @@ -293,14 +293,14 @@ func getI18nFile(locale, dir string) (filePath string) { name := fileInfo.Name() // assume the file path is a json file and the path contains the locale - if strings.HasSuffix(name, ".json") && strings.Contains(name, fmt.Sprintf("%s.", locale)) { + if strings.HasSuffix(name, T(".json")) && strings.Contains(name, fmt.Sprintf(T("{{.Arg0}}.", map[string]interface{}{"Arg0": locale}))) { filePath = filepath.Join(dir, fileInfo.Name()) break } } else { filePath = getI18nFile(locale, filepath.Join(dir, fileInfo.Name())) - if filePath != "" { + if filePath != T("") { break } } @@ -317,19 +317,19 @@ func findTranslationFiles(dir string, ignoreRegexp *regexp.Regexp, verbose bool) if !fileInfo.IsDir() { name := fileInfo.Name() - if strings.HasSuffix(name, ".json") { - parts := strings.Split(name, ".") + if strings.HasSuffix(name, T(".json")) { + parts := strings.Split(name, T(".")) var locale string for _, part := range parts { - invalidLangRegexp, _ := regexp.Compile("excluded|json|all") + invalidLangRegexp, _ := regexp.Compile(T("excluded|json|all")) if !invalidLangRegexp.MatchString(part) { locale = part } } // No locale found so skipping - if locale == "" { + if locale == T("") { continue } @@ -378,16 +378,16 @@ func (cu *Checkup) findI18nStrings(i18nFiles []string) (i18nStrings map[string]s func (cu *Checkup) diffStrings(sourceNameOne, sourceNameTwo string, stringsOne, stringsTwo map[string]string) (err error) { for key, _ := range stringsOne { - if stringsTwo[key] == "" { - cu.Printf("\"%s\" exists in %s, but not in %s\n", key, sourceNameOne, sourceNameTwo) - err = errors.New("Strings don't match") + if stringsTwo[key] == T("") { + cu.Printf(T("\"{{.Arg0}}\" exists in {{.Arg1}}, but not in {{.Arg2}}\n", map[string]interface{}{"Arg0": key, "Arg1": sourceNameOne, "Arg2": sourceNameTwo})) + err = errors.New(T("Strings don't match")) } } for key, _ := range stringsTwo { - if stringsOne[key] == "" { - cu.Printf("\"%s\" exists in %s, but not in %s\n", key, sourceNameTwo, sourceNameOne) - err = errors.New("Strings don't match") + if stringsOne[key] == T("") { + cu.Printf(T("\"{{.Arg0}}\" exists in {{.Arg1}}, but not in {{.Arg2}}\n", map[string]interface{}{"Arg0": key, "Arg1": sourceNameTwo, "Arg2": sourceNameOne})) + err = errors.New(T("Strings don't match")) } } diff --git a/i18n4go/cmds/i18n_init.go b/i18n4go/cmds/i18n_init.go new file mode 100644 index 0000000..8dda60d --- /dev/null +++ b/i18n4go/cmds/i18n_init.go @@ -0,0 +1,11 @@ +package cmds + +import ( + i18n "github.com/maximilien/i18n4go/i18n4go/i18n" +) + +var T i18n.TranslateFunc + +func init() { + T = i18n.Init("", "./i18n4go/i18n/"+i18n.GetResourcesPath()) +} diff --git a/i18n4go/i18n/i18n_init.go.template b/i18n4go/i18n/i18n_init.go.template index 4e32fa4..2c91a19 100644 --- a/i18n4go/i18n/i18n_init.go.template +++ b/i18n4go/i18n/i18n_init.go.template @@ -3,7 +3,7 @@ package __PACKAGE__NAME__ import ( "path/filepath" - i18n "github.com/maximilien/i18n4go/i18n" + i18n "github.com/maximilien/i18n4go/i18n4go/i18n" ) var T goi18n.TranslateFunc diff --git a/i18n4go/i18n/init.go b/i18n4go/i18n/init.go index 8c93ab2..81ce075 100644 --- a/i18n4go/i18n/init.go +++ b/i18n4go/i18n/init.go @@ -23,6 +23,7 @@ import ( "path/filepath" "strings" + "github.com/maximilien/i18n4go/i18n4go/resources" "github.com/pivotal-cf-experimental/jibber_jabber" go_i18n "github.com/nicksnyder/go-i18n/v2/i18n" @@ -49,22 +50,19 @@ var SUPPORTED_LOCALES = map[string]string{ "zh": "zh_CN", } var ( - RESOUCES_PATH = filepath.Join("cf", "i18n", "resources") - bundle *go_i18n.Bundle + RESOURCES_PATH = "./resources" + bundle *go_i18n.Bundle ) func GetResourcesPath() string { - return RESOUCES_PATH + return RESOURCES_PATH } -func init() { +func Init(packageName string, i18nDirname string) TranslateFunc { if bundle == nil { bundle = go_i18n.NewBundle(language.AmericanEnglish) bundle.RegisterUnmarshalFunc("json", json.Unmarshal) } -} - -func Init(packageName string, i18nDirname string) TranslateFunc { userLocale, err := initWithUserLocale(packageName, i18nDirname) if err != nil { userLocale = mustLoadDefaultLocale(packageName, i18nDirname) @@ -111,8 +109,10 @@ func mustLoadDefaultLocale(packageName, i18nDirname string) string { } func loadFromAsset(packageName, assetPath, locale, language string) error { - assetName := locale + ".all.json" - assetKey := filepath.Join(assetPath, language, packageName, assetName) + assetName := "all." + locale + ".json" + assetKey := filepath.Join(assetPath, packageName, assetName) + // REMOVEME: Do not commit + fmt.Printf("\nassetKey: %s\n", assetKey) byteArray, err := resources.Asset(assetKey) if err != nil { diff --git a/i18n4go/i18n/resources/en.all.json b/i18n4go/i18n/resources/all.en_US.json similarity index 99% rename from i18n4go/i18n/resources/en.all.json rename to i18n4go/i18n/resources/all.en_US.json index 3f8d586..2ab7001 100644 --- a/i18n4go/i18n/resources/en.all.json +++ b/i18n4go/i18n/resources/all.en_US.json @@ -1224,4 +1224,4 @@ "translation": "zh_CN", "modified": false } -] \ No newline at end of file +] diff --git a/i18n4go/i18n/resources/ast.go.en.json b/i18n4go/i18n/resources/ast.go.en.json deleted file mode 100644 index efb07e6..0000000 --- a/i18n4go/i18n/resources/ast.go.en.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "id": "Could not find imports for root node:\n\t%#v\n", - "translation": "Could not find imports for root node:\n\t%#v\n", - "modified": false - } -] diff --git a/i18n4go/i18n/resources/checkup.go.en.json b/i18n4go/i18n/resources/checkup.go.en.json deleted file mode 100644 index 8d7be12..0000000 --- a/i18n4go/i18n/resources/checkup.go.en.json +++ /dev/null @@ -1,92 +0,0 @@ -[ - { - "id": "excluded|json|all", - "translation": "excluded|json|all", - "modified": false - }, - { - "id": "checkup", - "translation": "checkup", - "modified": false - }, - { - "id": "Checks the transated files", - "translation": "Checks the transated files", - "modified": false - }, - { - "id": "Couldn't find the english strings: %s", - "translation": "Couldn't find the english strings: %s", - "modified": false - }, - { - "id": "Could not find an i18n file for locale: en_US", - "translation": "Could not find an i18n file for locale: en_US", - "modified": false - }, - { - "id": "OK", - "translation": "OK", - "modified": false - }, - { - "id": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)", - "translation": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)", - "modified": false - }, - { - "id": ".*test.*", - "translation": ".*test.*", - "modified": false - }, - { - "id": "recursively extract strings from all files in the same directory as filename or dirName", - "translation": "recursively extract strings from all files in the same directory as filename or dirName", - "modified": false - }, - { - "id": "qualifier", - "translation": "qualifier", - "modified": false - }, - { - "id": "_test.go", - "translation": "_test.go", - "modified": false - }, - { - "id": "Error when inspecting go file: ", - "translation": "Error when inspecting go file: ", - "modified": false - }, - { - "id": "Couldn't get the strings from %s: %s", - "translation": "Couldn't get the strings from %s: %s", - "modified": false - }, - { - "id": "\"%s\" exists in %s, but not in %s\n", - "translation": "\"%s\" exists in %s, but not in %s\n", - "modified": false - }, - { - "id": "Strings don't match", - "translation": "Strings don't match", - "modified": false - }, - { - "id": "ignore-regexp", - "translation": "ignore-regexp", - "modified": false - }, - { - "id": "Couldn't find any source strings: %s", - "translation": "Couldn't find any source strings: %s", - "modified": false - }, - { - "id": "the code", - "translation": "the code", - "modified": false - } -] diff --git a/i18n4go/i18n/resources/common.go.en.json b/i18n4go/i18n/resources/common.go.en.json deleted file mode 100644 index 642c596..0000000 --- a/i18n4go/i18n/resources/common.go.en.json +++ /dev/null @@ -1,47 +0,0 @@ -[ - { - "id": "Saving extracted i18n strings to file:", - "translation": "Saving extracted i18n strings to file:", - "modified": false - }, - { - "id": "i18n4go: Error compiling interpolated string Regexp: %s\n", - "translation": "i18n4go: Error compiling interpolated string Regexp: %s\n", - "modified": false - }, - { - "id": "WARNING: fail to compile ignore-regexp:", - "translation": "WARNING: fail to compile ignore-regexp:", - "modified": false - }, - { - "id": "i18n4go: Non-regular source file %s (%s)\n", - "translation": "i18n4go: Non-regular source file %s (%s)\n", - "modified": false - }, - { - "id": "PWD", - "translation": "PWD", - "modified": false - }, - { - "id": "Creating and saving i18n strings to .po file:", - "translation": "Creating and saving i18n strings to .po file:", - "modified": false - }, - { - "id": "i18n4go: creating and saving i18n strings to .po file:", - "translation": "i18n4go: creating and saving i18n strings to .po file:", - "modified": false - }, - { - "id": "i18n4go: Error compiling templated string Regexp: %s\n", - "translation": "i18n4go: Error compiling templated string Regexp: %s\n", - "modified": false - }, - { - "id": "Duplicated key found: ", - "translation": "Duplicated key found: ", - "modified": false - } -] diff --git a/i18n4go/i18n/resources/create_translations.go.en.json b/i18n4go/i18n/resources/create_translations.go.en.json deleted file mode 100644 index 7ff6855..0000000 --- a/i18n4go/i18n/resources/create_translations.go.en.json +++ /dev/null @@ -1,152 +0,0 @@ -[ - { - "id": "i18n4go: created default translation file:", - "translation": "i18n4go: created default translation file:", - "modified": false - }, - { - "id": "i18n4go: attempting to use Google Translate to translate source strings in: ", - "translation": "i18n4go: attempting to use Google Translate to translate source strings in: ", - "modified": false - }, - { - "id": "create-translations", - "translation": "create-translations", - "modified": false - }, - { - "id": "google-translate-api-key", - "translation": "google-translate-api-key", - "modified": false - }, - { - "id": "en", - "translation": "en", - "modified": false - }, - { - "id": "the source translation file", - "translation": "the source translation file", - "modified": false - }, - { - "id": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", - "translation": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", - "modified": false - }, - { - "id": "languages", - "translation": "languages", - "modified": false - }, - { - "id": "i18n4go: could not create output directory: %s", - "translation": "i18n4go: could not create output directory: %s", - "modified": false - }, - { - "id": "i18n4go: ERROR invoking Google Translate: ", - "translation": "i18n4go: ERROR invoking Google Translate: ", - "modified": false - }, - { - "id": "i18n4go: ERROR parsing Google Translate response body", - "translation": "i18n4go: ERROR parsing Google Translate response body", - "modified": false - }, - { - "id": "source-language", - "translation": "source-language", - "modified": false - }, - { - "id": "the output directory where the newly created translation files will be placed", - "translation": "the output directory where the newly created translation files will be placed", - "modified": false - }, - { - "id": "i18n4go: could not create translation file for language: %s with Google Translate", - "translation": "i18n4go: could not create translation file for language: %s with Google Translate", - "modified": false - }, - { - "id": "i18n4go: error invoking Google Translate for string:", - "translation": "i18n4go: error invoking Google Translate for string:", - "modified": false - }, - { - "id": "i18n4go: could not load i18n strings from file: %s", - "translation": "i18n4go: could not load i18n strings from file: %s", - "modified": false - }, - { - "id": "Creates the transation files", - "translation": "Creates the transation files", - "modified": false - }, - { - "id": "i18n4go: creating translation file copy for language:", - "translation": "i18n4go: creating translation file copy for language:", - "modified": false - }, - { - "id": "i18n4go: input file: %s is empty", - "translation": "i18n4go: input file: %s is empty", - "modified": false - }, - { - "id": "i18n4go: creating translation file:", - "translation": "i18n4go: creating translation file:", - "modified": false - }, - { - "id": "i18n4go: could not create default translation file for language: %s\nerr:%s", - "translation": "i18n4go: could not create default translation file for language: %s\nerr:%s", - "modified": false - }, - { - "id": "i18n4go: could not save Google Translate i18n strings to file: %s", - "translation": "i18n4go: could not save Google Translate i18n strings to file: %s", - "modified": false - }, - { - "id": "i18n4go: could not save PO file: %s", - "translation": "i18n4go: could not save PO file: %s", - "modified": false - }, - { - "id": "&target=", - "translation": "&target=", - "modified": false - }, - { - "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", - "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", - "modified": false - }, - { - "id": "file", - "translation": "file", - "modified": false - }, - { - "id": "output", - "translation": "output", - "modified": false - }, - { - "id": "i18n4go: creating translation files for:", - "translation": "i18n4go: creating translation files for:", - "modified": false - }, - { - "id": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", - "translation": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", - "modified": false - }, - { - "id": "i18n4go: created translation file with Google Translate:", - "translation": "i18n4go: created translation file with Google Translate:", - "modified": false - } -] diff --git a/i18n4go/i18n/resources/extract_strings.go.en.json b/i18n4go/i18n/resources/extract_strings.go.en.json deleted file mode 100644 index 63f21cb..0000000 --- a/i18n4go/i18n/resources/extract_strings.go.en.json +++ /dev/null @@ -1,272 +0,0 @@ -[ - { - "id": "extract-strings", - "translation": "extract-strings", - "modified": false - }, - { - "id": "output-flat", - "translation": "output-flat", - "modified": false - }, - { - "id": "Using ignore-regexp:", - "translation": "Using ignore-regexp:", - "modified": false - }, - { - "id": "Saving extracted strings to file:", - "translation": "Saving extracted strings to file:", - "modified": false - }, - { - "id": "Excluding strings in file:", - "translation": "Excluding strings in file:", - "modified": false - }, - { - "id": "generated files are created in the specified output directory", - "translation": "generated files are created in the specified output directory", - "modified": false - }, - { - "id": "the dir name for which all .go files will have their strings extracted", - "translation": "the dir name for which all .go files will have their strings extracted", - "modified": false - }, - { - "id": "recursively extract strings from all files in the same directory as filename or dirName", - "translation": "recursively extract strings from all files in the same directory as filename or dirName", - "modified": false - }, - { - "id": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", - "translation": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", - "modified": false - }, - { - "id": "meta", - "translation": "meta", - "modified": false - }, - { - "id": "i18n4go: extracting strings from file:", - "translation": "i18n4go: extracting strings from file:", - "modified": false - }, - { - "id": "generate standard .po file for translation", - "translation": "generate standard .po file for translation", - "modified": false - }, - { - "id": "WARNING running in -dry-run mode", - "translation": "WARNING running in -dry-run mode", - "modified": false - }, - { - "id": "Total files parsed:", - "translation": "Total files parsed:", - "modified": false - }, - { - "id": "directory", - "translation": "directory", - "modified": false - }, - { - "id": "ERROR opening file", - "translation": "ERROR opening file", - "modified": false - }, - { - "id": "Could not find:", - "translation": "Could not find:", - "modified": false - }, - { - "id": "capturing_group.json", - "translation": "capturing_group.json", - "modified": false - }, - { - "id": "Excluding regexps in file:", - "translation": "Excluding regexps in file:", - "modified": false - }, - { - "id": "dry-run", - "translation": "dry-run", - "modified": false - }, - { - "id": "ignore-regexp", - "translation": "ignore-regexp", - "modified": false - }, - { - "id": "WARNING ignoring file:", - "translation": "WARNING ignoring file:", - "modified": false - }, - { - "id": "Loaded %d excluded regexps", - "translation": "Loaded %d excluded regexps", - "modified": false - }, - { - "id": "Extracted total of %d strings\n\n", - "translation": "Extracted total of %d strings\n\n", - "modified": false - }, - { - "id": "Extract the translation strings from go source files", - "translation": "Extract the translation strings from go source files", - "modified": false - }, - { - "id": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", - "translation": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", - "modified": false - }, - { - "id": "output", - "translation": "output", - "modified": false - }, - { - "id": "Total extracted strings:", - "translation": "Total extracted strings:", - "modified": false - }, - { - "id": "Extracting strings in package:", - "translation": "Extracting strings in package:", - "modified": false - }, - { - "id": "src", - "translation": "src", - "modified": false - }, - { - "id": ".*test.*", - "translation": ".*test.*", - "modified": false - }, - { - "id": "Loaded %d substring regexps", - "translation": "Loaded %d substring regexps", - "modified": false - }, - { - "id": "output-match-package", - "translation": "output-match-package", - "modified": false - }, - { - "id": "Capturing substrings in file:", - "translation": "Capturing substrings in file:", - "modified": false - }, - { - "id": "Extracted %d strings from file: %s\n", - "translation": "Extracted %d strings from file: %s\n", - "modified": false - }, - { - "id": "the file name for which strings are extracted", - "translation": "the file name for which strings are extracted", - "modified": false - }, - { - "id": "exclude", - "translation": "exclude", - "modified": false - }, - { - "id": "generated files are created in directory to match the package name", - "translation": "generated files are created in directory to match the package name", - "modified": false - }, - { - "id": "output directory where the translation files will be placed", - "translation": "output directory where the translation files will be placed", - "modified": false - }, - { - "id": "i18n4go: could not extract strings from directory:", - "translation": "i18n4go: could not extract strings from directory:", - "modified": false - }, - { - "id": "WARNING No capturing group found in %s", - "translation": "WARNING No capturing group found in %s", - "modified": false - }, - { - "id": "extracted_strings.json", - "translation": "extracted_strings.json", - "modified": false - }, - { - "id": "po", - "translation": "po", - "modified": false - }, - { - "id": "file", - "translation": "file", - "modified": false - }, - { - "id": "Loaded %d excluded strings", - "translation": "Loaded %d excluded strings", - "modified": false - }, - { - "id": "WARNING error compiling regexp:", - "translation": "WARNING error compiling regexp:", - "modified": false - }, - { - "id": "the JSON file with strings to be excluded, defaults to excluded.json if present", - "translation": "the JSON file with strings to be excluded, defaults to excluded.json if present", - "modified": false - }, - { - "id": "substring-file", - "translation": "substring-file", - "modified": false - }, - { - "id": "prevents any output files from being created", - "translation": "prevents any output files from being created", - "modified": false - }, - { - "id": "i18n4go: inspecting dir %s, recursive: %t\n", - "translation": "i18n4go: inspecting dir %s, recursive: %t\n", - "modified": false - }, - { - "id": ".en.po", - "translation": ".en.po", - "modified": false - }, - { - "id": "recursive", - "translation": "recursive", - "modified": false - }, - { - "id": "PWD", - "translation": "PWD", - "modified": false - }, - { - "id": "No match for ignore-regexp:", - "translation": "No match for ignore-regexp:", - "modified": false - } -] diff --git a/i18n4go/i18n/resources/fixup.go.en.json b/i18n4go/i18n/resources/fixup.go.en.json deleted file mode 100644 index 266b7a6..0000000 --- a/i18n4go/i18n/resources/fixup.go.en.json +++ /dev/null @@ -1,117 +0,0 @@ -[ - { - "id": "en_US", - "translation": "en_US", - "modified": false - }, - { - "id": "Invalid response.", - "translation": "Invalid response.", - "modified": false - }, - { - "id": "fixup", - "translation": "fixup", - "modified": false - }, - { - "id": "Fixup the transation files", - "translation": "Fixup the transation files", - "modified": false - }, - { - "id": "recursively extract strings from all files in the same directory as filename or dirName", - "translation": "recursively extract strings from all files in the same directory as filename or dirName", - "modified": false - }, - { - "id": "Could not find an i18n file for locale: en_US", - "translation": "Could not find an i18n file for locale: en_US", - "modified": false - }, - { - "id": "Is the string \"%s\" a new or updated string? [new/upd]\n", - "translation": "Is the string \"%s\" a new or updated string? [new/upd]\n", - "modified": false - }, - { - "id": "Error when inspecting go file: ", - "translation": "Error when inspecting go file: ", - "modified": false - }, - { - "id": "Canceling fixup", - "translation": "Canceling fixup", - "modified": false - }, - { - "id": "Adding these strings to the %s translation file:\n", - "translation": "Adding these strings to the %s translation file:\n", - "modified": false - }, - { - "id": "Add, update, or remove translation keys from source files and resources files", - "translation": "Add, update, or remove translation keys from source files and resources files", - "modified": false - }, - { - "id": "Couldn't find any source strings: %s", - "translation": "Couldn't find any source strings: %s", - "modified": false - }, - { - "id": "Unable to find english translation files", - "translation": "Unable to find english translation files", - "modified": false - }, - { - "id": "Removing these strings from the %s translation file:\n", - "translation": "Removing these strings from the %s translation file:\n", - "modified": false - }, - { - "id": "ignore-regexp", - "translation": "ignore-regexp", - "modified": false - }, - { - "id": "Couldn't find the english strings: %s", - "translation": "Couldn't find the english strings: %s", - "modified": false - }, - { - "id": "new", - "translation": "new", - "modified": false - }, - { - "id": "upd", - "translation": "upd", - "modified": false - }, - { - "id": "OK", - "translation": "OK", - "modified": false - }, - { - "id": "exit", - "translation": "exit", - "modified": false - }, - { - "id": "Select the number for the previous translation:", - "translation": "Select the number for the previous translation:", - "modified": false - }, - { - "id": "Couldn't get the strings from %s: %s", - "translation": "Couldn't get the strings from %s: %s", - "modified": false - }, - { - "id": "Updating the following strings from the %s translation file:\n", - "translation": "Updating the following strings from the %s translation file:\n", - "modified": false - } -] diff --git a/i18n4go/i18n/resources/i18n4go.go.en.json b/i18n4go/i18n/resources/i18n4go.go.en.json deleted file mode 100644 index 46c59d3..0000000 --- a/i18n4go/i18n/resources/i18n4go.go.en.json +++ /dev/null @@ -1,327 +0,0 @@ -[ - { - "id": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", - "translation": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", - "modified": false - }, - { - "id": "[optional] the excluded JSON file name, all strings there will be excluded", - "translation": "[optional] the excluded JSON file name, all strings there will be excluded", - "modified": false - }, - { - "id": "output-flat", - "translation": "output-flat", - "modified": false - }, - { - "id": "i18n4go: Could not extract strings, err:", - "translation": "i18n4go: Could not extract strings, err:", - "modified": false - }, - { - "id": "\nusage: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -f \n or: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -d [-r] [--ignore-regexp ]\n\nusage: i18n4go -c rewrite-package [-v] [-r] -d [--i18n-strings-filename | --i18n-strings-dirname ] [--init-code-snippet-filename ] [--ignore-regexp ]\n or: i18n4go -c rewrite-package [-v] [-r] -f --i18n-strings-filename [--init-code-snippet-filename ] [--ignore-regexp ]\n\nusage: i18n4go -c create-translations [-v] [--google-translate-api-key ] [--source-language ] -f --languages -o \n\nusage: i18n4go -c merge-strings [-v] [-r] [--source-language ] -d \n\nusage: i18n4go -c verify-strings [-v] [--source-language ] -f --language-files [-o ]\n or: i18n4go -c verify-strings [-v] [--source-language ] -f --languages [-o ]\n\nusage: i18n4go -c show-missing-strings [-v] -d --i18n-strings-filename \n\nusage: i18n4go -c checkup\n\n -h | --help prints the usage\n -v verbose\n\n EXTRACT-STRINGS:\n\n -c extract-strings the extract strings command\n\n --po to generate standard .po files for translation\n -e [optional] the JSON file with strings to be excluded, defaults to excluded.json if present\n\t-s\t\t\t\t\t\t\t\t\t\t\t\t [optional] the JSON file with regexp that specify a capturing group to be extracted instead of the full string matching the regexp\n --meta [optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file\n --dry-run [optional] prevents any output files from being created\n\n\n --output-flat generated files are created in the specified output directory (default)\n --output-match-package generated files are created in directory to match the package name\n -o the output directory where the translation files will be placed\n\n -f the go file name to extract strings\n\n -d the directory containing the go files to extract strings\n\n -r [optional] recursesively extract strings from all subdirectories\n --ignore-regexp [optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n REWRITE-PACKAGE:\n\n -c rewrite-package the rewrite package command\n -f the source go file to be rewritten\n -d the directory containing the go files to rewrite\n\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n --i18n-strings-dirname a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name\n --root-path the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified\n\n --init-code-snippet-filename [optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization\"\n -o [optional] output diretory for rewritten file. If not specified, the original file will be overwritten\n\n --ignore-regexp\t\t[optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n MERGE STRINGS:\n\n -c merge-strings the merge strings command which merges multiple .go..json files into a .all.json\n\n -r [optional] recursesively combine files from all subdirectories\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \"en_US\" (default to 'en')\n\n -d the directory containing the json files to combine\n\n CREATE-TRANSLATIONS:\n\n -c create-translations the create translations command\n\n --google-translate-api-key [optional] your public Google Translate API key which is used to generate translations (charge is applicable)\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \\\"en_US\\\"\n\n -f the source translation file\n --languages a comma separated list of valid languages with optional territory, e.g., \\\"en, en_US, fr_FR, es\\\"\n -o the output directory where the newly created translation files will be placed\n\n VERIFY-STRINGS:\n\n -c verify-strings the verify strings command\n\n --source-language [optional] the source language of the source translation file (default to 'en')\n\n -f the source translation file\n\n --language-files a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\"\n if not specified then the languages flag is used to find target files in same directory as source\n --languages a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"\n\n -o the output directory where the missing translation keys will be placed\n\n SHOW-MISSING-STRINGS:\n\n -c show-missing-strings the missing strings command\n\n -d the directory containing the go files to validate\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n\n CHECKUP:\n\n -c checkup the checkup command which ensures that the strings in code match strings in resource files and vice versa\n -q the qualifier to use when calling the T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for T(...) function\n\n FIXUP:\n\n -c fixup the fixup command which interactively lets users add, update, or remove translations keys from code and resource files.\n", - "translation": "\nusage: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -f \n or: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -d [-r] [--ignore-regexp ]\n\nusage: i18n4go -c rewrite-package [-v] [-r] -d [--i18n-strings-filename | --i18n-strings-dirname ] [--init-code-snippet-filename ] [--ignore-regexp ]\n or: i18n4go -c rewrite-package [-v] [-r] -f --i18n-strings-filename [--init-code-snippet-filename ] [--ignore-regexp ]\n\nusage: i18n4go -c create-translations [-v] [--google-translate-api-key ] [--source-language ] -f --languages -o \n\nusage: i18n4go -c merge-strings [-v] [-r] [--source-language ] -d \n\nusage: i18n4go -c verify-strings [-v] [--source-language ] -f --language-files [-o ]\n or: i18n4go -c verify-strings [-v] [--source-language ] -f --languages [-o ]\n\nusage: i18n4go -c show-missing-strings [-v] -d --i18n-strings-filename \n\nusage: i18n4go -c checkup\n\n -h | --help prints the usage\n -v verbose\n\n EXTRACT-STRINGS:\n\n -c extract-strings the extract strings command\n\n --po to generate standard .po files for translation\n -e [optional] the JSON file with strings to be excluded, defaults to excluded.json if present\n\t-s\t\t\t\t\t\t\t\t\t\t\t\t [optional] the JSON file with regexp that specify a capturing group to be extracted instead of the full string matching the regexp\n --meta [optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file\n --dry-run [optional] prevents any output files from being created\n\n\n --output-flat generated files are created in the specified output directory (default)\n --output-match-package generated files are created in directory to match the package name\n -o the output directory where the translation files will be placed\n\n -f the go file name to extract strings\n\n -d the directory containing the go files to extract strings\n\n -r [optional] recursesively extract strings from all subdirectories\n --ignore-regexp [optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n REWRITE-PACKAGE:\n\n -c rewrite-package the rewrite package command\n -f the source go file to be rewritten\n -d the directory containing the go files to rewrite\n\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n --i18n-strings-dirname a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name\n --root-path the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified\n\n --init-code-snippet-filename [optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization\"\n -o [optional] output diretory for rewritten file. If not specified, the original file will be overwritten\n\n --ignore-regexp\t\t[optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n MERGE STRINGS:\n\n -c merge-strings the merge strings command which merges multiple .go..json files into a .all.json\n\n -r [optional] recursesively combine files from all subdirectories\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \"en_US\" (default to 'en')\n\n -d the directory containing the json files to combine\n\n CREATE-TRANSLATIONS:\n\n -c create-translations the create translations command\n\n --google-translate-api-key [optional] your public Google Translate API key which is used to generate translations (charge is applicable)\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \\\"en_US\\\"\n\n -f the source translation file\n --languages a comma separated list of valid languages with optional territory, e.g., \\\"en, en_US, fr_FR, es\\\"\n -o the output directory where the newly created translation files will be placed\n\n VERIFY-STRINGS:\n\n -c verify-strings the verify strings command\n\n --source-language [optional] the source language of the source translation file (default to 'en')\n\n -f the source translation file\n\n --language-files a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\"\n if not specified then the languages flag is used to find target files in same directory as source\n --languages a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"\n\n -o the output directory where the missing translation keys will be placed\n\n SHOW-MISSING-STRINGS:\n\n -c show-missing-strings the missing strings command\n\n -d the directory containing the go files to validate\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n\n CHECKUP:\n\n -c checkup the checkup command which ensures that the strings in code match strings in resource files and vice versa\n -q the qualifier to use when calling the T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for T(...) function\n\n FIXUP:\n\n -c fixup the fixup command which interactively lets users add, update, or remove translations keys from code and resource files.\n", - "modified": false - }, - { - "id": "po", - "translation": "po", - "modified": false - }, - { - "id": "output-match-package", - "translation": "output-match-package", - "modified": false - }, - { - "id": "i18n4go: Could not verify strings for input filename, err:", - "translation": "i18n4go: Could not verify strings for input filename, err:", - "modified": false - }, - { - "id": "i18n4go: Could not successfully rewrite package, err:", - "translation": "i18n4go: Could not successfully rewrite package, err:", - "modified": false - }, - { - "id": "en", - "translation": "en", - "modified": false - }, - { - "id": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", - "translation": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", - "modified": false - }, - { - "id": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", - "translation": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", - "modified": false - }, - { - "id": "the dir name for which all .go files will have their strings extracted", - "translation": "the dir name for which all .go files will have their strings extracted", - "modified": false - }, - { - "id": "extract-strings", - "translation": "extract-strings", - "modified": false - }, - { - "id": "merge-strings", - "translation": "merge-strings", - "modified": false - }, - { - "id": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)", - "translation": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)", - "modified": false - }, - { - "id": "i18n-strings-dirname", - "translation": "i18n-strings-dirname", - "modified": false - }, - { - "id": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", - "translation": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", - "modified": false - }, - { - "id": ".*test.*", - "translation": ".*test.*", - "modified": false - }, - { - "id": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", - "translation": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", - "modified": false - }, - { - "id": "fixup", - "translation": "fixup", - "modified": false - }, - { - "id": "output directory where the translation files will be placed", - "translation": "output directory where the translation files will be placed", - "modified": false - }, - { - "id": "generated files are created in the specified output directory", - "translation": "generated files are created in the specified output directory", - "modified": false - }, - { - "id": "language-files", - "translation": "language-files", - "modified": false - }, - { - "id": "verify-strings", - "translation": "verify-strings", - "modified": false - }, - { - "id": "show-missing-strings", - "translation": "show-missing-strings", - "modified": false - }, - { - "id": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", - "translation": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", - "modified": false - }, - { - "id": "the file name for which strings are extracted", - "translation": "the file name for which strings are extracted", - "modified": false - }, - { - "id": "v1.4.0", - "translation": "v1.4.0", - "modified": false - }, - { - "id": "Total time:", - "translation": "Total time:", - "modified": false - }, - { - "id": "prints the usage", - "translation": "prints the usage", - "modified": false - }, - { - "id": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", - "translation": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", - "modified": false - }, - { - "id": "verbose", - "translation": "verbose", - "modified": false - }, - { - "id": "i18n4go: Could not show missing strings, err:", - "translation": "i18n4go: Could not show missing strings, err:", - "modified": false - }, - { - "id": "source-language", - "translation": "source-language", - "modified": false - }, - { - "id": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", - "translation": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", - "modified": false - }, - { - "id": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", - "translation": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", - "modified": false - }, - { - "id": "An unexpected type of error", - "translation": "An unexpected type of error", - "modified": false - }, - { - "id": "create-translations", - "translation": "create-translations", - "modified": false - }, - { - "id": "rewrite-package", - "translation": "rewrite-package", - "modified": false - }, - { - "id": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", - "translation": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", - "modified": false - }, - { - "id": "prevents any output files from being created", - "translation": "prevents any output files from being created", - "modified": false - }, - { - "id": "capturing_group.json", - "translation": "capturing_group.json", - "modified": false - }, - { - "id": "init-code-snippet-filename", - "translation": "init-code-snippet-filename", - "modified": false - }, - { - "id": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", - "translation": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", - "modified": false - }, - { - "id": "i18n-strings-filename", - "translation": "i18n-strings-filename", - "modified": false - }, - { - "id": "meta", - "translation": "meta", - "modified": false - }, - { - "id": "recursively extract strings from all files in the same directory as filename or dirName", - "translation": "recursively extract strings from all files in the same directory as filename or dirName", - "modified": false - }, - { - "id": "checkup", - "translation": "checkup", - "modified": false - }, - { - "id": "i18n4go: Could not create translation files, err:", - "translation": "i18n4go: Could not create translation files, err:", - "modified": false - }, - { - "id": "ignore-regexp", - "translation": "ignore-regexp", - "modified": false - }, - { - "id": "%s\nVersion %s", - "translation": "%s\nVersion %s", - "modified": false - }, - { - "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", - "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", - "modified": false - }, - { - "id": "generated files are created in directory to match the package name", - "translation": "generated files are created in directory to match the package name", - "modified": false - }, - { - "id": "generate standard .po file for translation", - "translation": "generate standard .po file for translation", - "modified": false - }, - { - "id": "dry-run", - "translation": "dry-run", - "modified": false - }, - { - "id": "root-path", - "translation": "root-path", - "modified": false - }, - { - "id": "General purpose tool for i18n", - "translation": "General purpose tool for i18n", - "modified": false - }, - { - "id": "i18n4go: Could not checkup, err:", - "translation": "i18n4go: Could not checkup, err:", - "modified": false - }, - { - "id": "google-translate-api-key", - "translation": "google-translate-api-key", - "modified": false - }, - { - "id": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", - "translation": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", - "modified": false - }, - { - "id": "i18n4go: Could not fixup, err:", - "translation": "i18n4go: Could not fixup, err:", - "modified": false - }, - { - "id": "languages", - "translation": "languages", - "modified": false - }, - { - "id": "verbose mode where lots of output is generated during execution", - "translation": "verbose mode where lots of output is generated during execution", - "modified": false - }, - { - "id": "i18n4go: Could not merge strings, err:", - "translation": "i18n4go: Could not merge strings, err:", - "modified": false - } -] diff --git a/i18n4go/i18n/resources/init.go.en.json b/i18n4go/i18n/resources/init.go.en.json deleted file mode 100644 index 637235d..0000000 --- a/i18n4go/i18n/resources/init.go.en.json +++ /dev/null @@ -1,87 +0,0 @@ -[ - { - "id": "fr_FR", - "translation": "fr_FR", - "modified": false - }, - { - "id": "pt_BR", - "translation": "pt_BR", - "modified": false - }, - { - "id": "i18n4go_res", - "translation": "i18n4go_res", - "modified": false - }, - { - "id": "resources", - "translation": "resources", - "modified": false - }, - { - "id": ".all.json", - "translation": ".all.json", - "modified": false - }, - { - "id": "en_US", - "translation": "en_US", - "modified": false - }, - { - "id": "en", - "translation": "en", - "modified": false - }, - { - "id": "zh_CN", - "translation": "zh_CN", - "modified": false - }, - { - "id": "cf", - "translation": "cf", - "modified": false - }, - { - "id": "de_DE", - "translation": "de_DE", - "modified": false - }, - { - "id": "Could not load i18n asset: %v", - "translation": "Could not load i18n asset: %v", - "modified": false - }, - { - "id": "ru_RU", - "translation": "ru_RU", - "modified": false - }, - { - "id": "Could not load en_US language files. God save the queen. ", - "translation": "Could not load en_US language files. God save the queen. ", - "modified": false - }, - { - "id": "es_ES", - "translation": "es_ES", - "modified": false - }, - { - "id": "it_IT", - "translation": "it_IT", - "modified": false - }, - { - "id": "ja_JA", - "translation": "ja_JA", - "modified": false - }, - { - "id": "ko_KO", - "translation": "ko_KO", - "modified": false - } -] diff --git a/i18n4go/i18n/resources/merge_string.go.en.json b/i18n4go/i18n/resources/merge_string.go.en.json deleted file mode 100644 index e029790..0000000 --- a/i18n4go/i18n/resources/merge_string.go.en.json +++ /dev/null @@ -1,57 +0,0 @@ -[ - { - "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", - "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", - "modified": false - }, - { - "id": "directory", - "translation": "directory", - "modified": false - }, - { - "id": "i18n4go: scanning file: ", - "translation": "i18n4go: scanning file: ", - "modified": false - }, - { - "id": "recursive", - "translation": "recursive", - "modified": false - }, - { - "id": "recursively extract strings from all files in the same directory as filename or dirName", - "translation": "recursively extract strings from all files in the same directory as filename or dirName", - "modified": false - }, - { - "id": "en", - "translation": "en", - "modified": false - }, - { - "id": "the dir name for which all .go files will have their strings extracted", - "translation": "the dir name for which all .go files will have their strings extracted", - "modified": false - }, - { - "id": "i18n4go: saving combined language file: ", - "translation": "i18n4go: saving combined language file: ", - "modified": false - }, - { - "id": "merge-strings", - "translation": "merge-strings", - "modified": false - }, - { - "id": "Merge translation strings", - "translation": "Merge translation strings", - "modified": false - }, - { - "id": "source-language", - "translation": "source-language", - "modified": false - } -] diff --git a/i18n4go/i18n/resources/rewrite_package.go.en.json b/i18n4go/i18n/resources/rewrite_package.go.en.json deleted file mode 100644 index 136b1c2..0000000 --- a/i18n4go/i18n/resources/rewrite_package.go.en.json +++ /dev/null @@ -1,262 +0,0 @@ -[ - { - "id": "i18n4go: error determining the import path:", - "translation": "i18n4go: error determining the import path:", - "modified": false - }, - { - "id": "i18n4go: got a pkg with import:", - "translation": "i18n4go: got a pkg with import:", - "modified": false - }, - { - "id": " to output dir:", - "translation": " to output dir:", - "modified": false - }, - { - "id": "i18n4go: loading JSON strings from file: %s\n", - "translation": "i18n4go: loading JSON strings from file: %s\n", - "modified": false - }, - { - "id": "the dir name for which all .go files will have their strings extracted", - "translation": "the dir name for which all .go files will have their strings extracted", - "modified": false - }, - { - "id": "i18n4go: inserting T() calls for strings that need to be translated", - "translation": "i18n4go: inserting T() calls for strings that need to be translated", - "modified": false - }, - { - "id": "i18n-strings-filename", - "translation": "i18n-strings-filename", - "modified": false - }, - { - "id": "recursive", - "translation": "recursive", - "modified": false - }, - { - "id": "filepath.Join(", - "translation": "filepath.Join(", - "modified": false - }, - { - "id": "generate standard .po file for translation", - "translation": "generate standard .po file for translation", - "modified": false - }, - { - "id": "i18n4go: got a root pkg with import path:", - "translation": "i18n4go: got a root pkg with import path:", - "modified": false - }, - { - "id": "i18n4go: error reading content of init code snippet file: %s\n, using default", - "translation": "i18n4go: error reading content of init code snippet file: %s\n, using default", - "modified": false - }, - { - "id": "PWD", - "translation": "PWD", - "modified": false - }, - { - "id": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", - "translation": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", - "modified": false - }, - { - "id": "i18n4go: using the PWD as the rootPath:", - "translation": "i18n4go: using the PWD as the rootPath:", - "modified": false - }, - { - "id": "i18n4go: using import path as:", - "translation": "i18n4go: using import path as:", - "modified": false - }, - { - "id": "rewrite-package", - "translation": "rewrite-package", - "modified": false - }, - { - "id": "i18n4go: got a local import %s so using %s instead for pkg", - "translation": "i18n4go: got a local import %s so using %s instead for pkg", - "modified": false - }, - { - "id": "recursively rewrite packages from all files in the same directory as filename or dirName", - "translation": "recursively rewrite packages from all files in the same directory as filename or dirName", - "modified": false - }, - { - "id": "i18n4go: error saving updated i18n strings file:", - "translation": "i18n4go: error saving updated i18n strings file:", - "modified": false - }, - { - "id": "i18n4go: error getting root path import:", - "translation": "i18n4go: error getting root path import:", - "modified": false - }, - { - "id": "i18n4go: adding init func to package:", - "translation": "i18n4go: adding init func to package:", - "modified": false - }, - { - "id": "saving file to path", - "translation": "saving file to path", - "modified": false - }, - { - "id": "Rewrite translated packages from go source files", - "translation": "Rewrite translated packages from go source files", - "modified": false - }, - { - "id": "root-path", - "translation": "root-path", - "modified": false - }, - { - "id": "ignore-regexp", - "translation": "ignore-regexp", - "modified": false - }, - { - "id": "Total rewritten strings:", - "translation": "Total rewritten strings:", - "modified": false - }, - { - "id": "i18n4go: error saving AST file:", - "translation": "i18n4go: error saving AST file:", - "modified": false - }, - { - "id": "init-code-snippet-filename", - "translation": "init-code-snippet-filename", - "modified": false - }, - { - "id": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", - "translation": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", - "modified": false - }, - { - "id": "Total files parsed:", - "translation": "Total files parsed:", - "modified": false - }, - { - "id": "cowardly refusing to translate the strings in test file:", - "translation": "cowardly refusing to translate the strings in test file:", - "modified": false - }, - { - "id": "output", - "translation": "output", - "modified": false - }, - { - "id": "i18n4go: WARNING could not find JSON file:", - "translation": "i18n4go: WARNING could not find JSON file:", - "modified": false - }, - { - "id": "i18n4go: error adding init() func to package:", - "translation": "i18n4go: error adding init() func to package:", - "modified": false - }, - { - "id": "i18n4go: determining import path using root path:", - "translation": "i18n4go: determining import path using root path:", - "modified": false - }, - { - "id": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", - "translation": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", - "modified": false - }, - { - "id": "i18n4go: error appending T() to AST file:", - "translation": "i18n4go: error appending T() to AST file:", - "modified": false - }, - { - "id": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", - "translation": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", - "modified": false - }, - { - "id": "output directory where the translation files will be placed", - "translation": "output directory where the translation files will be placed", - "modified": false - }, - { - "id": "package __PACKAGE__NAME__\n\nimport (\n\t\"path/filepath\"\n\n\ti18n \"github.com/maximilien/i18n4go/i18n\"\n)\n\nvar T i18n.TranslateFunc\n\nfunc init() {\n\tT = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath())\n}", - "translation": "package __PACKAGE__NAME__\n\nimport (\n\t\"path/filepath\"\n\n\ti18n \"github.com/maximilien/i18n4go/i18n\"\n)\n\nvar T i18n.TranslateFunc\n\nfunc init() {\n\tT = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath())\n}", - "modified": false - }, - { - "id": "i18n-strings-dirname", - "translation": "i18n-strings-dirname", - "modified": false - }, - { - "id": "i18n_init.go", - "translation": "i18n_init.go", - "modified": false - }, - { - "id": "directory", - "translation": "directory", - "modified": false - }, - { - "id": "file", - "translation": "file", - "modified": false - }, - { - "id": "the source go file to be rewritten", - "translation": "the source go file to be rewritten", - "modified": false - }, - { - "id": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", - "translation": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", - "modified": false - }, - { - "id": "i18n4go: rewriting strings in dir %s, recursive: %t\n", - "translation": "i18n4go: rewriting strings in dir %s, recursive: %t\n", - "modified": false - }, - { - "id": "i18n4go: rewriting strings for source file:", - "translation": "i18n4go: rewriting strings for source file:", - "modified": false - }, - { - "id": "i18n4go: got a local import %s so using %s instead for root pkg", - "translation": "i18n4go: got a local import %s so using %s instead for root pkg", - "modified": false - }, - { - "id": "string", - "translation": "string", - "modified": false - }, - { - "id": "WARNING compiling ignore-regexp:", - "translation": "WARNING compiling ignore-regexp:", - "modified": false - } -] diff --git a/i18n4go/i18n/resources/show_missing_strings.go.en.json b/i18n4go/i18n/resources/show_missing_strings.go.en.json deleted file mode 100644 index 6388221..0000000 --- a/i18n4go/i18n/resources/show_missing_strings.go.en.json +++ /dev/null @@ -1,77 +0,0 @@ -[ - { - "id": "directory", - "translation": "directory", - "modified": false - }, - { - "id": "PWD", - "translation": "PWD", - "modified": false - }, - { - "id": "Additional:", - "translation": "Additional:", - "modified": false - }, - { - "id": "show-missing-strings", - "translation": "show-missing-strings", - "modified": false - }, - { - "id": "Missing Strings!", - "translation": "Missing Strings!", - "modified": false - }, - { - "id": "Found", - "translation": "Found", - "modified": false - }, - { - "id": "Additional Strings!", - "translation": "Additional Strings!", - "modified": false - }, - { - "id": "WARNING ignoring file:", - "translation": "WARNING ignoring file:", - "modified": false - }, - { - "id": "the directory containing the go files to validate", - "translation": "the directory containing the go files to validate", - "modified": false - }, - { - "id": "Missing:", - "translation": "Missing:", - "modified": false - }, - { - "id": "UNDER", - "translation": "UNDER", - "modified": false - }, - { - "id": "Shows missing strings in translations", - "translation": "Shows missing strings in translations", - "modified": false - }, - { - "id": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", - "translation": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", - "modified": false - }, - { - "id": "Adding to translated strings:", - "translation": "Adding to translated strings:", - "modified": false - }, - { - "id": "i18n-strings-filename", - "translation": "i18n-strings-filename", - "modified": false - } -] diff --git a/i18n4go/i18n/resources/verify_strings.go.en.json b/i18n4go/i18n/resources/verify_strings.go.en.json deleted file mode 100644 index b1fc970..0000000 --- a/i18n4go/i18n/resources/verify_strings.go.en.json +++ /dev/null @@ -1,162 +0,0 @@ -[ - { - "id": "the source translation file", - "translation": "the source translation file", - "modified": false - }, - { - "id": "i18n4go: ERROR input file does not match target file:", - "translation": "i18n4go: ERROR input file does not match target file:", - "modified": false - }, - { - "id": "File has duplicated key: %s\n%s", - "translation": "File has duplicated key: %s\n%s", - "modified": false - }, - { - "id": "i18n4go: WARNING target file has extra key with ID: ", - "translation": "i18n4go: WARNING target file has extra key with ID: ", - "modified": false - }, - { - "id": "i18n4go: target file has extra i18n strings with IDs: %s", - "translation": "i18n4go: target file has extra i18n strings with IDs: %s", - "modified": false - }, - { - "id": "verify-strings", - "translation": "verify-strings", - "modified": false - }, - { - "id": "Verify strings in translations", - "translation": "Verify strings in translations", - "modified": false - }, - { - "id": "languages", - "translation": "languages", - "modified": false - }, - { - "id": "the output directory where the missing translation keys will be placed", - "translation": "the output directory where the missing translation keys will be placed", - "modified": false - }, - { - "id": "file", - "translation": "file", - "modified": false - }, - { - "id": "i18n4go: Error checking input filename: ", - "translation": "i18n4go: Error checking input filename: ", - "modified": false - }, - { - "id": "i18n4go: target file is missing i18n strings with IDs: %s", - "translation": "i18n4go: target file is missing i18n strings with IDs: %s", - "modified": false - }, - { - "id": "source-language", - "translation": "source-language", - "modified": false - }, - { - "id": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", - "translation": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", - "modified": false - }, - { - "id": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", - "translation": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", - "modified": false - }, - { - "id": "targetFilenames:", - "translation": "targetFilenames:", - "modified": false - }, - { - "id": "i18n4go: Error input file: %s is empty", - "translation": "i18n4go: Error input file: %s is empty", - "modified": false - }, - { - "id": "i18n4go: WARNING target file contains total of extra keys:", - "translation": "i18n4go: WARNING target file contains total of extra keys:", - "modified": false - }, - { - "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", - "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", - "modified": false - }, - { - "id": "language-files", - "translation": "language-files", - "modified": false - }, - { - "id": "i18n4go: WARNING target file has invalid templated translations with key ID: ", - "translation": "i18n4go: WARNING target file has invalid templated translations with key ID: ", - "modified": false - }, - { - "id": "i18n4go: ERROR could not create the diff file:", - "translation": "i18n4go: ERROR could not create the diff file:", - "modified": false - }, - { - "id": "i18n4go: generated diff file:", - "translation": "i18n4go: generated diff file:", - "modified": false - }, - { - "id": "i18n4go: target file has invalid i18n strings with IDs: %s", - "translation": "i18n4go: target file has invalid i18n strings with IDs: %s", - "modified": false - }, - { - "id": "en", - "translation": "en", - "modified": false - }, - { - "id": "i18n4go: Error loading the i18n strings from input filename:", - "translation": "i18n4go: Error loading the i18n strings from input filename:", - "modified": false - }, - { - "id": "i18n4go: WARNING target file contains total of invalid translations:", - "translation": "i18n4go: WARNING target file contains total of invalid translations:", - "modified": false - }, - { - "id": ".missing.diff.json", - "translation": ".missing.diff.json", - "modified": false - }, - { - "id": "output", - "translation": "output", - "modified": false - }, - { - "id": "i18n4go: Error verifying target filename: ", - "translation": "i18n4go: Error verifying target filename: ", - "modified": false - }, - { - "id": "i18n4go: Error loading the i18n strings from target filename:", - "translation": "i18n4go: Error loading the i18n strings from target filename:", - "modified": false - }, - { - "id": "i18n4go: templated string is invalid, missing args in translation:", - "translation": "i18n4go: templated string is invalid, missing args in translation:", - "modified": false - } -] diff --git a/i18n4go/i18n/resources/version.go.en.json b/i18n4go/i18n/resources/version.go.en.json deleted file mode 100644 index bdbe9c9..0000000 --- a/i18n4go/i18n/resources/version.go.en.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "id": "Build Date: %s\n", - "translation": "Build Date: %s\n", - "modified": false - }, - { - "id": "Git Revision: %s\n", - "translation": "Git Revision: %s\n", - "modified": false - }, - { - "id": "version", - "translation": "version", - "modified": false - }, - { - "id": "Show the version of the i18n client", - "translation": "Show the version of the i18n client", - "modified": false - }, - { - "id": "Version: %s\n", - "translation": "Version: %s\n", - "modified": false - } -] \ No newline at end of file diff --git a/i18n4go/resources/i18n_resources.go b/i18n4go/resources/i18n_resources.go new file mode 100644 index 0000000..cf78768 --- /dev/null +++ b/i18n4go/resources/i18n_resources.go @@ -0,0 +1,1455 @@ +// Code generated by go-bindata. (@generated) DO NOT EDIT. + +// Package resources generated by go-bindata. +// sources: +// i18n4go/i18n/resources/all.en_US.json +package resources + +import ( + "fmt" + "io/ioutil" + "os" + "path/filepath" + "strings" + "time" +) + +type asset struct { + bytes []byte + info os.FileInfo +} + +type bindataFileInfo struct { + name string + size int64 + mode os.FileMode + modTime time.Time +} + +// Name return file name +func (fi bindataFileInfo) Name() string { + return fi.name +} + +// Size return file size +func (fi bindataFileInfo) Size() int64 { + return fi.size +} + +// Mode return file mode +func (fi bindataFileInfo) Mode() os.FileMode { + return fi.mode +} + +// ModTime return file modify time +func (fi bindataFileInfo) ModTime() time.Time { + return fi.modTime +} + +// IsDir return file whether a directory +func (fi bindataFileInfo) IsDir() bool { + return fi.mode&os.ModeDir != 0 +} + +// Sys return file is sys mode +func (fi bindataFileInfo) Sys() interface{} { + return nil +} + +var _i18n4goI18nResourcesAllEn_usJson = []byte(`[ + { + "id": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", + "translation": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", + "modified": false + }, + { + "id": "\nusage: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -f \n or: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -d [-r] [--ignore-regexp ]\n\nusage: i18n4go -c rewrite-package [-v] [-r] -d [--i18n-strings-filename | --i18n-strings-dirname ] [--init-code-snippet-filename ] [--ignore-regexp ]\n or: i18n4go -c rewrite-package [-v] [-r] -f --i18n-strings-filename [--init-code-snippet-filename ] [--ignore-regexp ]\n\nusage: i18n4go -c create-translations [-v] [--google-translate-api-key ] [--source-language ] -f --languages -o \n\nusage: i18n4go -c merge-strings [-v] [-r] [--source-language ] -d \n\nusage: i18n4go -c verify-strings [-v] [--source-language ] -f --language-files [-o ]\n or: i18n4go -c verify-strings [-v] [--source-language ] -f --languages [-o ]\n\nusage: i18n4go -c show-missing-strings [-v] -d --i18n-strings-filename \n\nusage: i18n4go -c checkup\n\n -h | --help prints the usage\n -v verbose\n\n EXTRACT-STRINGS:\n\n -c extract-strings the extract strings command\n\n --po to generate standard .po files for translation\n -e [optional] the JSON file with strings to be excluded, defaults to excluded.json if present\n\t-s\t\t\t\t\t\t\t\t\t\t\t\t [optional] the JSON file with regexp that specify a capturing group to be extracted instead of the full string matching the regexp\n --meta [optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file\n --dry-run [optional] prevents any output files from being created\n\n\n --output-flat generated files are created in the specified output directory (default)\n --output-match-package generated files are created in directory to match the package name\n -o the output directory where the translation files will be placed\n\n -f the go file name to extract strings\n\n -d the directory containing the go files to extract strings\n\n -r [optional] recursesively extract strings from all subdirectories\n --ignore-regexp [optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n REWRITE-PACKAGE:\n\n -c rewrite-package the rewrite package command\n -f the source go file to be rewritten\n -d the directory containing the go files to rewrite\n\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n --i18n-strings-dirname a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name\n --root-path the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified\n\n --init-code-snippet-filename [optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization\"\n -o [optional] output diretory for rewritten file. If not specified, the original file will be overwritten\n\n --ignore-regexp\t\t[optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n MERGE STRINGS:\n\n -c merge-strings the merge strings command which merges multiple .go..json files into a .all.json\n\n -r [optional] recursesively combine files from all subdirectories\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \"en_US\" (default to 'en')\n\n -d the directory containing the json files to combine\n\n CREATE-TRANSLATIONS:\n\n -c create-translations the create translations command\n\n --google-translate-api-key [optional] your public Google Translate API key which is used to generate translations (charge is applicable)\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \\\"en_US\\\"\n\n -f the source translation file\n --languages a comma separated list of valid languages with optional territory, e.g., \\\"en, en_US, fr_FR, es\\\"\n -o the output directory where the newly created translation files will be placed\n\n VERIFY-STRINGS:\n\n -c verify-strings the verify strings command\n\n --source-language [optional] the source language of the source translation file (default to 'en')\n\n -f the source translation file\n\n --language-files a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\"\n if not specified then the languages flag is used to find target files in same directory as source\n --languages a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"\n\n -o the output directory where the missing translation keys will be placed\n\n SHOW-MISSING-STRINGS:\n\n -c show-missing-strings the missing strings command\n\n -d the directory containing the go files to validate\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n\n CHECKUP:\n\n -c checkup the checkup command which ensures that the strings in code match strings in resource files and vice versa\n -q the qualifier to use when calling the T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for T(...) function\n\n FIXUP:\n\n -c fixup the fixup command which interactively lets users add, update, or remove translations keys from code and resource files.\n", + "translation": "\nusage: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -f \n or: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -d [-r] [--ignore-regexp ]\n\nusage: i18n4go -c rewrite-package [-v] [-r] -d [--i18n-strings-filename | --i18n-strings-dirname ] [--init-code-snippet-filename ] [--ignore-regexp ]\n or: i18n4go -c rewrite-package [-v] [-r] -f --i18n-strings-filename [--init-code-snippet-filename ] [--ignore-regexp ]\n\nusage: i18n4go -c create-translations [-v] [--google-translate-api-key ] [--source-language ] -f --languages -o \n\nusage: i18n4go -c merge-strings [-v] [-r] [--source-language ] -d \n\nusage: i18n4go -c verify-strings [-v] [--source-language ] -f --language-files [-o ]\n or: i18n4go -c verify-strings [-v] [--source-language ] -f --languages [-o ]\n\nusage: i18n4go -c show-missing-strings [-v] -d --i18n-strings-filename \n\nusage: i18n4go -c checkup\n\n -h | --help prints the usage\n -v verbose\n\n EXTRACT-STRINGS:\n\n -c extract-strings the extract strings command\n\n --po to generate standard .po files for translation\n -e [optional] the JSON file with strings to be excluded, defaults to excluded.json if present\n\t-s\t\t\t\t\t\t\t\t\t\t\t\t [optional] the JSON file with regexp that specify a capturing group to be extracted instead of the full string matching the regexp\n --meta [optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file\n --dry-run [optional] prevents any output files from being created\n\n\n --output-flat generated files are created in the specified output directory (default)\n --output-match-package generated files are created in directory to match the package name\n -o the output directory where the translation files will be placed\n\n -f the go file name to extract strings\n\n -d the directory containing the go files to extract strings\n\n -r [optional] recursesively extract strings from all subdirectories\n --ignore-regexp [optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n REWRITE-PACKAGE:\n\n -c rewrite-package the rewrite package command\n -f the source go file to be rewritten\n -d the directory containing the go files to rewrite\n\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n --i18n-strings-dirname a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name\n --root-path the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified\n\n --init-code-snippet-filename [optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization\"\n -o [optional] output diretory for rewritten file. If not specified, the original file will be overwritten\n\n --ignore-regexp\t\t[optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n MERGE STRINGS:\n\n -c merge-strings the merge strings command which merges multiple .go..json files into a .all.json\n\n -r [optional] recursesively combine files from all subdirectories\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \"en_US\" (default to 'en')\n\n -d the directory containing the json files to combine\n\n CREATE-TRANSLATIONS:\n\n -c create-translations the create translations command\n\n --google-translate-api-key [optional] your public Google Translate API key which is used to generate translations (charge is applicable)\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \\\"en_US\\\"\n\n -f the source translation file\n --languages a comma separated list of valid languages with optional territory, e.g., \\\"en, en_US, fr_FR, es\\\"\n -o the output directory where the newly created translation files will be placed\n\n VERIFY-STRINGS:\n\n -c verify-strings the verify strings command\n\n --source-language [optional] the source language of the source translation file (default to 'en')\n\n -f the source translation file\n\n --language-files a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\"\n if not specified then the languages flag is used to find target files in same directory as source\n --languages a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"\n\n -o the output directory where the missing translation keys will be placed\n\n SHOW-MISSING-STRINGS:\n\n -c show-missing-strings the missing strings command\n\n -d the directory containing the go files to validate\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n\n CHECKUP:\n\n -c checkup the checkup command which ensures that the strings in code match strings in resource files and vice versa\n -q the qualifier to use when calling the T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for T(...) function\n\n FIXUP:\n\n -c fixup the fixup command which interactively lets users add, update, or remove translations keys from code and resource files.\n", + "modified": false + }, + { + "id": " to output dir:", + "translation": " to output dir:", + "modified": false + }, + { + "id": "\"%s\" exists in %s, but not in %s\n", + "translation": "\"%s\" exists in %s, but not in %s\n", + "modified": false + }, + { + "id": "%s\nVersion %s", + "translation": "%s\nVersion %s", + "modified": false + }, + { + "id": "&target=", + "translation": "&target=", + "modified": false + }, + { + "id": ".*test.*", + "translation": ".*test.*", + "modified": false + }, + { + "id": ".all.json", + "translation": ".all.json", + "modified": false + }, + { + "id": ".en.po", + "translation": ".en.po", + "modified": false + }, + { + "id": ".missing.diff.json", + "translation": ".missing.diff.json", + "modified": false + }, + { + "id": "Add, update, or remove translation keys from source files and resources files", + "translation": "Add, update, or remove translation keys from source files and resources files", + "modified": false + }, + { + "id": "Adding these strings to the %s translation file:\n", + "translation": "Adding these strings to the %s translation file:\n", + "modified": false + }, + { + "id": "Adding to translated strings:", + "translation": "Adding to translated strings:", + "modified": false + }, + { + "id": "Additional Strings!", + "translation": "Additional Strings!", + "modified": false + }, + { + "id": "Additional:", + "translation": "Additional:", + "modified": false + }, + { + "id": "An unexpected type of error", + "translation": "An unexpected type of error", + "modified": false + }, + { + "id": "Build Date: %s\n", + "translation": "Build Date: %s\n", + "modified": false + }, + { + "id": "Canceling fixup", + "translation": "Canceling fixup", + "modified": false + }, + { + "id": "Capturing substrings in file:", + "translation": "Capturing substrings in file:", + "modified": false + }, + { + "id": "Checks the transated files", + "translation": "Checks the transated files", + "modified": false + }, + { + "id": "Could not find an i18n file for locale: en_US", + "translation": "Could not find an i18n file for locale: en_US", + "modified": false + }, + { + "id": "Could not find imports for root node:\n\t%#v\n", + "translation": "Could not find imports for root node:\n\t%#v\n", + "modified": false + }, + { + "id": "Could not find:", + "translation": "Could not find:", + "modified": false + }, + { + "id": "Could not load en_US language files. God save the queen. ", + "translation": "Could not load en_US language files. God save the queen. ", + "modified": false + }, + { + "id": "Could not load i18n asset: %v", + "translation": "Could not load i18n asset: %v", + "modified": false + }, + { + "id": "Couldn't find any source strings: %s", + "translation": "Couldn't find any source strings: %s", + "modified": false + }, + { + "id": "Couldn't find the english strings: %s", + "translation": "Couldn't find the english strings: %s", + "modified": false + }, + { + "id": "Couldn't get the strings from %s: %s", + "translation": "Couldn't get the strings from %s: %s", + "modified": false + }, + { + "id": "Creates the transation files", + "translation": "Creates the transation files", + "modified": false + }, + { + "id": "Creating and saving i18n strings to .po file:", + "translation": "Creating and saving i18n strings to .po file:", + "modified": false + }, + { + "id": "Duplicated key found: ", + "translation": "Duplicated key found: ", + "modified": false + }, + { + "id": "ERROR opening file", + "translation": "ERROR opening file", + "modified": false + }, + { + "id": "Error when inspecting go file: ", + "translation": "Error when inspecting go file: ", + "modified": false + }, + { + "id": "Excluding regexps in file:", + "translation": "Excluding regexps in file:", + "modified": false + }, + { + "id": "Excluding strings in file:", + "translation": "Excluding strings in file:", + "modified": false + }, + { + "id": "Extract the translation strings from go source files", + "translation": "Extract the translation strings from go source files", + "modified": false + }, + { + "id": "Extracted %d strings from file: %s\n", + "translation": "Extracted %d strings from file: %s\n", + "modified": false + }, + { + "id": "Extracted total of %d strings\n\n", + "translation": "Extracted total of %d strings\n\n", + "modified": false + }, + { + "id": "Extracting strings in package:", + "translation": "Extracting strings in package:", + "modified": false + }, + { + "id": "File has duplicated key: %s\n%s", + "translation": "File has duplicated key: %s\n%s", + "modified": false + }, + { + "id": "Fixup the transation files", + "translation": "Fixup the transation files", + "modified": false + }, + { + "id": "Found", + "translation": "Found", + "modified": false + }, + { + "id": "General purpose tool for i18n", + "translation": "General purpose tool for i18n", + "modified": false + }, + { + "id": "Git Revision: %s\n", + "translation": "Git Revision: %s\n", + "modified": false + }, + { + "id": "Invalid response.", + "translation": "Invalid response.", + "modified": false + }, + { + "id": "Is the string \"%s\" a new or updated string? [new/upd]\n", + "translation": "Is the string \"%s\" a new or updated string? [new/upd]\n", + "modified": false + }, + { + "id": "Loaded %d excluded regexps", + "translation": "Loaded %d excluded regexps", + "modified": false + }, + { + "id": "Loaded %d excluded strings", + "translation": "Loaded %d excluded strings", + "modified": false + }, + { + "id": "Loaded %d substring regexps", + "translation": "Loaded %d substring regexps", + "modified": false + }, + { + "id": "Merge translation strings", + "translation": "Merge translation strings", + "modified": false + }, + { + "id": "Missing Strings!", + "translation": "Missing Strings!", + "modified": false + }, + { + "id": "Missing:", + "translation": "Missing:", + "modified": false + }, + { + "id": "No match for ignore-regexp:", + "translation": "No match for ignore-regexp:", + "modified": false + }, + { + "id": "OK", + "translation": "OK", + "modified": false + }, + { + "id": "PWD", + "translation": "PWD", + "modified": false + }, + { + "id": "Removing these strings from the %s translation file:\n", + "translation": "Removing these strings from the %s translation file:\n", + "modified": false + }, + { + "id": "Rewrite translated packages from go source files", + "translation": "Rewrite translated packages from go source files", + "modified": false + }, + { + "id": "Saving extracted i18n strings to file:", + "translation": "Saving extracted i18n strings to file:", + "modified": false + }, + { + "id": "Saving extracted strings to file:", + "translation": "Saving extracted strings to file:", + "modified": false + }, + { + "id": "Select the number for the previous translation:", + "translation": "Select the number for the previous translation:", + "modified": false + }, + { + "id": "Show the version of the i18n client", + "translation": "Show the version of the i18n client", + "modified": false + }, + { + "id": "Shows missing strings in translations", + "translation": "Shows missing strings in translations", + "modified": false + }, + { + "id": "Strings don't match", + "translation": "Strings don't match", + "modified": false + }, + { + "id": "Total extracted strings:", + "translation": "Total extracted strings:", + "modified": false + }, + { + "id": "Total files parsed:", + "translation": "Total files parsed:", + "modified": false + }, + { + "id": "Total rewritten strings:", + "translation": "Total rewritten strings:", + "modified": false + }, + { + "id": "Total time:", + "translation": "Total time:", + "modified": false + }, + { + "id": "UNDER", + "translation": "UNDER", + "modified": false + }, + { + "id": "Unable to find english translation files", + "translation": "Unable to find english translation files", + "modified": false + }, + { + "id": "Updating the following strings from the %s translation file:\n", + "translation": "Updating the following strings from the %s translation file:\n", + "modified": false + }, + { + "id": "Using ignore-regexp:", + "translation": "Using ignore-regexp:", + "modified": false + }, + { + "id": "Verify strings in translations", + "translation": "Verify strings in translations", + "modified": false + }, + { + "id": "Version: %s\n", + "translation": "Version: %s\n", + "modified": false + }, + { + "id": "WARNING No capturing group found in %s", + "translation": "WARNING No capturing group found in %s", + "modified": false + }, + { + "id": "WARNING compiling ignore-regexp:", + "translation": "WARNING compiling ignore-regexp:", + "modified": false + }, + { + "id": "WARNING error compiling regexp:", + "translation": "WARNING error compiling regexp:", + "modified": false + }, + { + "id": "WARNING ignoring file:", + "translation": "WARNING ignoring file:", + "modified": false + }, + { + "id": "WARNING running in -dry-run mode", + "translation": "WARNING running in -dry-run mode", + "modified": false + }, + { + "id": "WARNING: fail to compile ignore-regexp:", + "translation": "WARNING: fail to compile ignore-regexp:", + "modified": false + }, + { + "id": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "translation": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "modified": false + }, + { + "id": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", + "translation": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", + "modified": false + }, + { + "id": "[optional] the excluded JSON file name, all strings there will be excluded", + "translation": "[optional] the excluded JSON file name, all strings there will be excluded", + "modified": false + }, + { + "id": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", + "translation": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", + "modified": false + }, + { + "id": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to ` + "`" + `i18n` + "`" + ` so that all calls would be: i18n.T(...)", + "translation": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to ` + "`" + `i18n` + "`" + ` so that all calls would be: i18n.T(...)", + "modified": false + }, + { + "id": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "translation": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "modified": false + }, + { + "id": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", + "translation": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", + "modified": false + }, + { + "id": "_test.go", + "translation": "_test.go", + "modified": false + }, + { + "id": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", + "translation": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", + "modified": false + }, + { + "id": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", + "translation": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", + "modified": false + }, + { + "id": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "translation": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "modified": false + }, + { + "id": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", + "translation": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", + "modified": false + }, + { + "id": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", + "translation": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", + "modified": false + }, + { + "id": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", + "translation": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", + "modified": false + }, + { + "id": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", + "translation": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", + "modified": false + }, + { + "id": "capturing_group.json", + "translation": "capturing_group.json", + "modified": false + }, + { + "id": "cf", + "translation": "cf", + "modified": false + }, + { + "id": "checkup", + "translation": "checkup", + "modified": false + }, + { + "id": "cowardly refusing to translate the strings in test file:", + "translation": "cowardly refusing to translate the strings in test file:", + "modified": false + }, + { + "id": "create-translations", + "translation": "create-translations", + "modified": false + }, + { + "id": "de_DE", + "translation": "de_DE", + "modified": false + }, + { + "id": "directory", + "translation": "directory", + "modified": false + }, + { + "id": "dry-run", + "translation": "dry-run", + "modified": false + }, + { + "id": "en", + "translation": "en", + "modified": false + }, + { + "id": "en_US", + "translation": "en_US", + "modified": false + }, + { + "id": "es_ES", + "translation": "es_ES", + "modified": false + }, + { + "id": "exclude", + "translation": "exclude", + "modified": false + }, + { + "id": "excluded|json|all", + "translation": "excluded|json|all", + "modified": false + }, + { + "id": "exit", + "translation": "exit", + "modified": false + }, + { + "id": "extract-strings", + "translation": "extract-strings", + "modified": false + }, + { + "id": "extracted_strings.json", + "translation": "extracted_strings.json", + "modified": false + }, + { + "id": "file", + "translation": "file", + "modified": false + }, + { + "id": "filepath.Join(", + "translation": "filepath.Join(", + "modified": false + }, + { + "id": "fixup", + "translation": "fixup", + "modified": false + }, + { + "id": "fr_FR", + "translation": "fr_FR", + "modified": false + }, + { + "id": "generate standard .po file for translation", + "translation": "generate standard .po file for translation", + "modified": false + }, + { + "id": "generated files are created in directory to match the package name", + "translation": "generated files are created in directory to match the package name", + "modified": false + }, + { + "id": "generated files are created in the specified output directory", + "translation": "generated files are created in the specified output directory", + "modified": false + }, + { + "id": "google-translate-api-key", + "translation": "google-translate-api-key", + "modified": false + }, + { + "id": "i18n-strings-dirname", + "translation": "i18n-strings-dirname", + "modified": false + }, + { + "id": "i18n-strings-filename", + "translation": "i18n-strings-filename", + "modified": false + }, + { + "id": "i18n4go: Could not checkup, err:", + "translation": "i18n4go: Could not checkup, err:", + "modified": false + }, + { + "id": "i18n4go: Could not create translation files, err:", + "translation": "i18n4go: Could not create translation files, err:", + "modified": false + }, + { + "id": "i18n4go: Could not extract strings, err:", + "translation": "i18n4go: Could not extract strings, err:", + "modified": false + }, + { + "id": "i18n4go: Could not fixup, err:", + "translation": "i18n4go: Could not fixup, err:", + "modified": false + }, + { + "id": "i18n4go: Could not merge strings, err:", + "translation": "i18n4go: Could not merge strings, err:", + "modified": false + }, + { + "id": "i18n4go: Could not show missing strings, err:", + "translation": "i18n4go: Could not show missing strings, err:", + "modified": false + }, + { + "id": "i18n4go: Could not successfully rewrite package, err:", + "translation": "i18n4go: Could not successfully rewrite package, err:", + "modified": false + }, + { + "id": "i18n4go: Could not verify strings for input filename, err:", + "translation": "i18n4go: Could not verify strings for input filename, err:", + "modified": false + }, + { + "id": "i18n4go: ERROR could not create the diff file:", + "translation": "i18n4go: ERROR could not create the diff file:", + "modified": false + }, + { + "id": "i18n4go: ERROR input file does not match target file:", + "translation": "i18n4go: ERROR input file does not match target file:", + "modified": false + }, + { + "id": "i18n4go: ERROR invoking Google Translate: ", + "translation": "i18n4go: ERROR invoking Google Translate: ", + "modified": false + }, + { + "id": "i18n4go: ERROR parsing Google Translate response body", + "translation": "i18n4go: ERROR parsing Google Translate response body", + "modified": false + }, + { + "id": "i18n4go: Error checking input filename: ", + "translation": "i18n4go: Error checking input filename: ", + "modified": false + }, + { + "id": "i18n4go: Error compiling interpolated string Regexp: %s\n", + "translation": "i18n4go: Error compiling interpolated string Regexp: %s\n", + "modified": false + }, + { + "id": "i18n4go: Error compiling templated string Regexp: %s\n", + "translation": "i18n4go: Error compiling templated string Regexp: %s\n", + "modified": false + }, + { + "id": "i18n4go: Error input file: %s is empty", + "translation": "i18n4go: Error input file: %s is empty", + "modified": false + }, + { + "id": "i18n4go: Error loading the i18n strings from input filename:", + "translation": "i18n4go: Error loading the i18n strings from input filename:", + "modified": false + }, + { + "id": "i18n4go: Error loading the i18n strings from target filename:", + "translation": "i18n4go: Error loading the i18n strings from target filename:", + "modified": false + }, + { + "id": "i18n4go: Error verifying target filename: ", + "translation": "i18n4go: Error verifying target filename: ", + "modified": false + }, + { + "id": "i18n4go: Non-regular source file %s (%s)\n", + "translation": "i18n4go: Non-regular source file %s (%s)\n", + "modified": false + }, + { + "id": "i18n4go: WARNING could not find JSON file:", + "translation": "i18n4go: WARNING could not find JSON file:", + "modified": false + }, + { + "id": "i18n4go: WARNING target file contains total of extra keys:", + "translation": "i18n4go: WARNING target file contains total of extra keys:", + "modified": false + }, + { + "id": "i18n4go: WARNING target file contains total of invalid translations:", + "translation": "i18n4go: WARNING target file contains total of invalid translations:", + "modified": false + }, + { + "id": "i18n4go: WARNING target file has extra key with ID: ", + "translation": "i18n4go: WARNING target file has extra key with ID: ", + "modified": false + }, + { + "id": "i18n4go: WARNING target file has invalid templated translations with key ID: ", + "translation": "i18n4go: WARNING target file has invalid templated translations with key ID: ", + "modified": false + }, + { + "id": "i18n4go: adding init func to package:", + "translation": "i18n4go: adding init func to package:", + "modified": false + }, + { + "id": "i18n4go: attempting to use Google Translate to translate source strings in: ", + "translation": "i18n4go: attempting to use Google Translate to translate source strings in: ", + "modified": false + }, + { + "id": "i18n4go: could not create default translation file for language: %s\nerr:%s", + "translation": "i18n4go: could not create default translation file for language: %s\nerr:%s", + "modified": false + }, + { + "id": "i18n4go: could not create output directory: %s", + "translation": "i18n4go: could not create output directory: %s", + "modified": false + }, + { + "id": "i18n4go: could not create translation file for language: %s with Google Translate", + "translation": "i18n4go: could not create translation file for language: %s with Google Translate", + "modified": false + }, + { + "id": "i18n4go: could not extract strings from directory:", + "translation": "i18n4go: could not extract strings from directory:", + "modified": false + }, + { + "id": "i18n4go: could not load i18n strings from file: %s", + "translation": "i18n4go: could not load i18n strings from file: %s", + "modified": false + }, + { + "id": "i18n4go: could not save Google Translate i18n strings to file: %s", + "translation": "i18n4go: could not save Google Translate i18n strings to file: %s", + "modified": false + }, + { + "id": "i18n4go: could not save PO file: %s", + "translation": "i18n4go: could not save PO file: %s", + "modified": false + }, + { + "id": "i18n4go: created default translation file:", + "translation": "i18n4go: created default translation file:", + "modified": false + }, + { + "id": "i18n4go: created translation file with Google Translate:", + "translation": "i18n4go: created translation file with Google Translate:", + "modified": false + }, + { + "id": "i18n4go: creating and saving i18n strings to .po file:", + "translation": "i18n4go: creating and saving i18n strings to .po file:", + "modified": false + }, + { + "id": "i18n4go: creating translation file copy for language:", + "translation": "i18n4go: creating translation file copy for language:", + "modified": false + }, + { + "id": "i18n4go: creating translation file:", + "translation": "i18n4go: creating translation file:", + "modified": false + }, + { + "id": "i18n4go: creating translation files for:", + "translation": "i18n4go: creating translation files for:", + "modified": false + }, + { + "id": "i18n4go: determining import path using root path:", + "translation": "i18n4go: determining import path using root path:", + "modified": false + }, + { + "id": "i18n4go: error adding init() func to package:", + "translation": "i18n4go: error adding init() func to package:", + "modified": false + }, + { + "id": "i18n4go: error appending T() to AST file:", + "translation": "i18n4go: error appending T() to AST file:", + "modified": false + }, + { + "id": "i18n4go: error determining the import path:", + "translation": "i18n4go: error determining the import path:", + "modified": false + }, + { + "id": "i18n4go: error getting root path import:", + "translation": "i18n4go: error getting root path import:", + "modified": false + }, + { + "id": "i18n4go: error invoking Google Translate for string:", + "translation": "i18n4go: error invoking Google Translate for string:", + "modified": false + }, + { + "id": "i18n4go: error reading content of init code snippet file: %s\n, using default", + "translation": "i18n4go: error reading content of init code snippet file: %s\n, using default", + "modified": false + }, + { + "id": "i18n4go: error saving AST file:", + "translation": "i18n4go: error saving AST file:", + "modified": false + }, + { + "id": "i18n4go: error saving updated i18n strings file:", + "translation": "i18n4go: error saving updated i18n strings file:", + "modified": false + }, + { + "id": "i18n4go: extracting strings from file:", + "translation": "i18n4go: extracting strings from file:", + "modified": false + }, + { + "id": "i18n4go: generated diff file:", + "translation": "i18n4go: generated diff file:", + "modified": false + }, + { + "id": "i18n4go: got a local import %s so using %s instead for pkg", + "translation": "i18n4go: got a local import %s so using %s instead for pkg", + "modified": false + }, + { + "id": "i18n4go: got a local import %s so using %s instead for root pkg", + "translation": "i18n4go: got a local import %s so using %s instead for root pkg", + "modified": false + }, + { + "id": "i18n4go: got a pkg with import:", + "translation": "i18n4go: got a pkg with import:", + "modified": false + }, + { + "id": "i18n4go: got a root pkg with import path:", + "translation": "i18n4go: got a root pkg with import path:", + "modified": false + }, + { + "id": "i18n4go: input file: %s is empty", + "translation": "i18n4go: input file: %s is empty", + "modified": false + }, + { + "id": "i18n4go: inserting T() calls for strings that need to be translated", + "translation": "i18n4go: inserting T() calls for strings that need to be translated", + "modified": false + }, + { + "id": "i18n4go: inspecting dir %s, recursive: %t\n", + "translation": "i18n4go: inspecting dir %s, recursive: %t\n", + "modified": false + }, + { + "id": "i18n4go: loading JSON strings from file: %s\n", + "translation": "i18n4go: loading JSON strings from file: %s\n", + "modified": false + }, + { + "id": "i18n4go: rewriting strings for source file:", + "translation": "i18n4go: rewriting strings for source file:", + "modified": false + }, + { + "id": "i18n4go: rewriting strings in dir %s, recursive: %t\n", + "translation": "i18n4go: rewriting strings in dir %s, recursive: %t\n", + "modified": false + }, + { + "id": "i18n4go: saving combined language file: ", + "translation": "i18n4go: saving combined language file: ", + "modified": false + }, + { + "id": "i18n4go: scanning file: ", + "translation": "i18n4go: scanning file: ", + "modified": false + }, + { + "id": "i18n4go: target file has extra i18n strings with IDs: %s", + "translation": "i18n4go: target file has extra i18n strings with IDs: %s", + "modified": false + }, + { + "id": "i18n4go: target file has invalid i18n strings with IDs: %s", + "translation": "i18n4go: target file has invalid i18n strings with IDs: %s", + "modified": false + }, + { + "id": "i18n4go: target file is missing i18n strings with IDs: %s", + "translation": "i18n4go: target file is missing i18n strings with IDs: %s", + "modified": false + }, + { + "id": "i18n4go: templated string is invalid, missing args in translation:", + "translation": "i18n4go: templated string is invalid, missing args in translation:", + "modified": false + }, + { + "id": "i18n4go: using import path as:", + "translation": "i18n4go: using import path as:", + "modified": false + }, + { + "id": "i18n4go: using the PWD as the rootPath:", + "translation": "i18n4go: using the PWD as the rootPath:", + "modified": false + }, + { + "id": "i18n4go_res", + "translation": "i18n4go_res", + "modified": false + }, + { + "id": "i18n_init.go", + "translation": "i18n_init.go", + "modified": false + }, + { + "id": "ignore-regexp", + "translation": "ignore-regexp", + "modified": false + }, + { + "id": "init-code-snippet-filename", + "translation": "init-code-snippet-filename", + "modified": false + }, + { + "id": "it_IT", + "translation": "it_IT", + "modified": false + }, + { + "id": "ja_JA", + "translation": "ja_JA", + "modified": false + }, + { + "id": "ko_KO", + "translation": "ko_KO", + "modified": false + }, + { + "id": "language-files", + "translation": "language-files", + "modified": false + }, + { + "id": "languages", + "translation": "languages", + "modified": false + }, + { + "id": "merge-strings", + "translation": "merge-strings", + "modified": false + }, + { + "id": "meta", + "translation": "meta", + "modified": false + }, + { + "id": "new", + "translation": "new", + "modified": false + }, + { + "id": "output", + "translation": "output", + "modified": false + }, + { + "id": "output directory where the translation files will be placed", + "translation": "output directory where the translation files will be placed", + "modified": false + }, + { + "id": "output-flat", + "translation": "output-flat", + "modified": false + }, + { + "id": "output-match-package", + "translation": "output-match-package", + "modified": false + }, + { + "id": "package __PACKAGE__NAME__\n\nimport (\n\t\"path/filepath\"\n\n\ti18n \"github.com/maximilien/i18n4go/i18n\"\n)\n\nvar T i18n.TranslateFunc\n\nfunc init() {\n\tT = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath())\n}", + "translation": "package __PACKAGE__NAME__\n\nimport (\n\t\"path/filepath\"\n\n\ti18n \"github.com/maximilien/i18n4go/i18n\"\n)\n\nvar T i18n.TranslateFunc\n\nfunc init() {\n\tT = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath())\n}", + "modified": false + }, + { + "id": "po", + "translation": "po", + "modified": false + }, + { + "id": "prevents any output files from being created", + "translation": "prevents any output files from being created", + "modified": false + }, + { + "id": "prints the usage", + "translation": "prints the usage", + "modified": false + }, + { + "id": "pt_BR", + "translation": "pt_BR", + "modified": false + }, + { + "id": "qualifier", + "translation": "qualifier", + "modified": false + }, + { + "id": "recursive", + "translation": "recursive", + "modified": false + }, + { + "id": "recursively extract strings from all files in the same directory as filename or dirName", + "translation": "recursively extract strings from all files in the same directory as filename or dirName", + "modified": false + }, + { + "id": "recursively rewrite packages from all files in the same directory as filename or dirName", + "translation": "recursively rewrite packages from all files in the same directory as filename or dirName", + "modified": false + }, + { + "id": "resources", + "translation": "resources", + "modified": false + }, + { + "id": "rewrite-package", + "translation": "rewrite-package", + "modified": false + }, + { + "id": "root-path", + "translation": "root-path", + "modified": false + }, + { + "id": "ru_RU", + "translation": "ru_RU", + "modified": false + }, + { + "id": "saving file to path", + "translation": "saving file to path", + "modified": false + }, + { + "id": "show-missing-strings", + "translation": "show-missing-strings", + "modified": false + }, + { + "id": "source-language", + "translation": "source-language", + "modified": false + }, + { + "id": "src", + "translation": "src", + "modified": false + }, + { + "id": "string", + "translation": "string", + "modified": false + }, + { + "id": "substring-file", + "translation": "substring-file", + "modified": false + }, + { + "id": "targetFilenames:", + "translation": "targetFilenames:", + "modified": false + }, + { + "id": "the JSON file with strings to be excluded, defaults to excluded.json if present", + "translation": "the JSON file with strings to be excluded, defaults to excluded.json if present", + "modified": false + }, + { + "id": "the code", + "translation": "the code", + "modified": false + }, + { + "id": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", + "translation": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", + "modified": false + }, + { + "id": "the dir name for which all .go files will have their strings extracted", + "translation": "the dir name for which all .go files will have their strings extracted", + "modified": false + }, + { + "id": "the directory containing the go files to validate", + "translation": "the directory containing the go files to validate", + "modified": false + }, + { + "id": "the file name for which strings are extracted", + "translation": "the file name for which strings are extracted", + "modified": false + }, + { + "id": "the output directory where the missing translation keys will be placed", + "translation": "the output directory where the missing translation keys will be placed", + "modified": false + }, + { + "id": "the output directory where the newly created translation files will be placed", + "translation": "the output directory where the newly created translation files will be placed", + "modified": false + }, + { + "id": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", + "translation": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", + "modified": false + }, + { + "id": "the source go file to be rewritten", + "translation": "the source go file to be rewritten", + "modified": false + }, + { + "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "modified": false + }, + { + "id": "the source translation file", + "translation": "the source translation file", + "modified": false + }, + { + "id": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "translation": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "modified": false + }, + { + "id": "upd", + "translation": "upd", + "modified": false + }, + { + "id": "v1.4.0", + "translation": "v1.4.0", + "modified": false + }, + { + "id": "verbose", + "translation": "verbose", + "modified": false + }, + { + "id": "verbose mode where lots of output is generated during execution", + "translation": "verbose mode where lots of output is generated during execution", + "modified": false + }, + { + "id": "verify-strings", + "translation": "verify-strings", + "modified": false + }, + { + "id": "version", + "translation": "version", + "modified": false + }, + { + "id": "zh_CN", + "translation": "zh_CN", + "modified": false + } +] +`) + +func i18n4goI18nResourcesAllEn_usJsonBytes() ([]byte, error) { + return _i18n4goI18nResourcesAllEn_usJson, nil +} + +func i18n4goI18nResourcesAllEn_usJson() (*asset, error) { + bytes, err := i18n4goI18nResourcesAllEn_usJsonBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "i18n4go/i18n/resources/all.en_US.json", size: 51925, mode: os.FileMode(420), modTime: time.Unix(1699928651, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +// Asset loads and returns the asset for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func Asset(name string) ([]byte, error) { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) + } + return a.bytes, nil + } + return nil, fmt.Errorf("Asset %s not found", name) +} + +// MustAsset is like Asset but panics when Asset would return an error. +// It simplifies safe initialization of global variables. +func MustAsset(name string) []byte { + a, err := Asset(name) + if err != nil { + panic("asset: Asset(" + name + "): " + err.Error()) + } + + return a +} + +// AssetInfo loads and returns the asset info for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func AssetInfo(name string) (os.FileInfo, error) { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) + } + return a.info, nil + } + return nil, fmt.Errorf("AssetInfo %s not found", name) +} + +// AssetNames returns the names of the assets. +func AssetNames() []string { + names := make([]string, 0, len(_bindata)) + for name := range _bindata { + names = append(names, name) + } + return names +} + +// _bindata is a table, holding each asset generator, mapped to its name. +var _bindata = map[string]func() (*asset, error){ + "i18n4go/i18n/resources/all.en_US.json": i18n4goI18nResourcesAllEn_usJson, +} + +// AssetDir returns the file names below a certain +// directory embedded in the file by go-bindata. +// For example if you run go-bindata on data/... and data contains the +// following hierarchy: +// +// data/ +// foo.txt +// img/ +// a.png +// b.png +// +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("nonexistent") would return an error +// AssetDir("") will return []string{"data"}. +func AssetDir(name string) ([]string, error) { + node := _bintree + if len(name) != 0 { + canonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(canonicalName, "/") + for _, p := range pathList { + node = node.Children[p] + if node == nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + } + } + if node.Func != nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + rv := make([]string, 0, len(node.Children)) + for childName := range node.Children { + rv = append(rv, childName) + } + return rv, nil +} + +type bintree struct { + Func func() (*asset, error) + Children map[string]*bintree +} + +var _bintree = &bintree{nil, map[string]*bintree{ + "i18n4go": &bintree{nil, map[string]*bintree{ + "i18n": &bintree{nil, map[string]*bintree{ + "resources": &bintree{nil, map[string]*bintree{ + "all.en_US.json": &bintree{i18n4goI18nResourcesAllEn_usJson, map[string]*bintree{}}, + }}, + }}, + }}, +}} + +// RestoreAsset restores an asset under the given directory +func RestoreAsset(dir, name string) error { + data, err := Asset(name) + if err != nil { + return err + } + info, err := AssetInfo(name) + if err != nil { + return err + } + err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) + if err != nil { + return err + } + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + if err != nil { + return err + } + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil +} + +// RestoreAssets restores an asset under the given directory recursively +func RestoreAssets(dir, name string) error { + children, err := AssetDir(name) + // File + if err != nil { + return RestoreAsset(dir, name) + } + // Dir + for _, child := range children { + err = RestoreAssets(dir, filepath.Join(name, child)) + if err != nil { + return err + } + } + return nil +} + +func _filePath(dir, name string) string { + canonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) +} From 479abc889250ef5a662736530c870b00a8dc53f3 Mon Sep 17 00:00:00 2001 From: Aerex Date: Thu, 16 Nov 2023 21:30:12 -0600 Subject: [PATCH 03/13] build: added ci check for valiating translation messages --- .github/workflows/go.yml | 3 +++ bin/validate | 46 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100755 bin/validate diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 3d173df..ceca105 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -39,3 +39,6 @@ jobs: run: | export GOPATH=$(go env GOPATH)/bin ./bin/test + + - name: Validate + run: ./bin/validate diff --git a/bin/validate b/bin/validate new file mode 100755 index 0000000..508f537 --- /dev/null +++ b/bin/validate @@ -0,0 +1,46 @@ +#!/bin/env bash + +# Copyright © 2015-2023 The Knative Authors +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +echo -e "\nUpdate (Re)generated translation files..." + +PROJ_DIR=$(dirname $0) +if [[ -z $(command -v go-bindata) ]]; then + echo -e "\nInstalling go-bindata..." + # install outside of GO PATH + pushd /tmp >/dev/null + go get -u github.com/go-bindata/go-bindata/... + popd > /dev/null +fi + +pushd $PROJ_DIR >/dev/null +go-bindata -pkg resources -o resources -o i18n4go/resources/i18n_resources.go -nocompress i18n4go/i18n/resources/*.json +echo -e "\nCompleted." + +popd >/dev/null + +echo -e "\nVerify translation messages" + +if [[ ! -f $PROJ_DIR/out/i18n4go ]]; then + echo -e "\nMissing built bui18n4go binary..." + exit 1 +fi + +pushd i18n4go >/dev/null +$PROJ_DIR/out/i18n4go checkup -q i18n -v +popd + +echo -e "\nComplete." From 3fa00d6910003a3fad73a6826ad61a38a7eddb3d Mon Sep 17 00:00:00 2001 From: Aerex Date: Thu, 16 Nov 2023 21:58:15 -0600 Subject: [PATCH 04/13] fix: updated root packages pointing to translation function and removed old dep --- examples/demo1-i18n/i18n_init.go | 2 +- go.mod | 4 ---- go.sum | 8 -------- test_fixtures/checkup/qualified/src/code/main.go | 2 +- .../rewrite_package/f_option/expected_output/i18n_init.go | 2 +- .../f_option/expected_output/nested_dir/i18n_init.go | 2 +- .../expected_output/i18n_init_default.go | 2 +- .../expected_output/i18n_init_from_template.go | 2 +- 8 files changed, 6 insertions(+), 18 deletions(-) diff --git a/examples/demo1-i18n/i18n_init.go b/examples/demo1-i18n/i18n_init.go index 9d0c0ee..e88caa0 100644 --- a/examples/demo1-i18n/i18n_init.go +++ b/examples/demo1-i18n/i18n_init.go @@ -10,7 +10,7 @@ import ( "github.com/pivotal-cf-experimental/jibber_jabber" - goi18n "github.com/maximilien/i18n4go/i18n" + goi18n "github.com/maximilien/i18n4go/i18n4go/i18n" ) type Detector interface { diff --git a/go.mod b/go.mod index bf584da..f9c93ee 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/maximilien/i18n4go go 1.18 require ( - github.com/nicksnyder/go-i18n v1.10.1 github.com/nicksnyder/go-i18n/v2 v2.2.1 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.27.9 @@ -16,16 +15,13 @@ require ( github.com/BurntSushi/toml v1.2.1 // indirect github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect - github.com/go-bindata/go-bindata v3.1.2+incompatible // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/nxadm/tail v1.4.8 // indirect - github.com/pelletier/go-toml v1.2.0 // indirect github.com/spf13/pflag v1.0.5 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.10.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect - gopkg.in/yaml.v2 v2.3.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 4194b8e..907d2fd 100644 --- a/go.sum +++ b/go.sum @@ -5,13 +5,10 @@ github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 h1:tuij github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21/go.mod h1:po7NpZ/QiTKzBKyrsEAxwnTamCoh8uDk/egRpQ7siIc= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/go-bindata/go-bindata v3.1.2+incompatible h1:5vjJMVhowQdPzjE1LdxyFF7YFTXg5IgGVW4gBr5IbvE= -github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= @@ -37,8 +34,6 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/nicksnyder/go-i18n v1.10.1 h1:isfg77E/aCD7+0lD/D00ebR2MV5vgeQ276WYyDaCRQc= -github.com/nicksnyder/go-i18n v1.10.1/go.mod h1:e4Di5xjP9oTVrC6y3C7C0HoSYXjSbhh/dU0eUV32nB4= github.com/nicksnyder/go-i18n/v2 v2.2.1 h1:aOzRCdwsJuoExfZhoiXHy4bjruwCMdt5otbYojM/PaA= github.com/nicksnyder/go-i18n/v2 v2.2.1/go.mod h1:fF2++lPHlo+/kPaj3nB0uxtPwzlPm+BlgwGX7MkeGj0= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -53,8 +48,6 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.27.9 h1:qIyVWbOsvQEye2QCqLsNSeH/5L1RS9vS382erEWfT3o= github.com/onsi/gomega v1.27.9/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pivotal-cf-experimental/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 h1:AbOpFa7UXCGaV+aq9tvFdSHEhmcb8uO6nKZdYhKsT1I= github.com/pivotal-cf-experimental/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21/go.mod h1:4+wzrM70C+Ky5iZiA6lNV5J48jnGmu8YcbmuVWdlt5s= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -131,7 +124,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= diff --git a/test_fixtures/checkup/qualified/src/code/main.go b/test_fixtures/checkup/qualified/src/code/main.go index a4f0bda..a6af416 100644 --- a/test_fixtures/checkup/qualified/src/code/main.go +++ b/test_fixtures/checkup/qualified/src/code/main.go @@ -3,7 +3,7 @@ package code import ( "fmt" - "github.com/nicksnyder/go-i18n/i18n" + i18n "github.com/maximilien/i18n4go/i18n4go/cmds" ) func main() { diff --git a/test_fixtures/rewrite_package/f_option/expected_output/i18n_init.go b/test_fixtures/rewrite_package/f_option/expected_output/i18n_init.go index 258d922..8d6af48 100644 --- a/test_fixtures/rewrite_package/f_option/expected_output/i18n_init.go +++ b/test_fixtures/rewrite_package/f_option/expected_output/i18n_init.go @@ -3,7 +3,7 @@ package input_files import ( "path/filepath" - i18n "github.com/maximilien/i18n4go/i18n" + i18n "github.com/maximilien/i18n4go/i18n4go/i18n" ) var T i18n.TranslateFunc diff --git a/test_fixtures/rewrite_package/f_option/expected_output/nested_dir/i18n_init.go b/test_fixtures/rewrite_package/f_option/expected_output/nested_dir/i18n_init.go index 3ad58ef..97e0796 100644 --- a/test_fixtures/rewrite_package/f_option/expected_output/nested_dir/i18n_init.go +++ b/test_fixtures/rewrite_package/f_option/expected_output/nested_dir/i18n_init.go @@ -3,7 +3,7 @@ package nested_dir import ( "path/filepath" - i18n "github.com/maximilien/i18n4go/i18n" + i18n "github.com/maximilien/i18n4go/i18n4go/i18n" ) var T i18n.TranslateFunc diff --git a/test_fixtures/rewrite_package/init_code_snippet_filename/expected_output/i18n_init_default.go b/test_fixtures/rewrite_package/init_code_snippet_filename/expected_output/i18n_init_default.go index 588ecb3..f3b47b6 100644 --- a/test_fixtures/rewrite_package/init_code_snippet_filename/expected_output/i18n_init_default.go +++ b/test_fixtures/rewrite_package/init_code_snippet_filename/expected_output/i18n_init_default.go @@ -3,7 +3,7 @@ package input_files import ( "path/filepath" - i18n "github.com/maximilien/i18n4go/i18n" + i18n "github.com/maximilien/i18n4go/i18n4go/i18n" ) var T i18n.TranslateFunc diff --git a/test_fixtures/rewrite_package/init_code_snippet_filename/expected_output/i18n_init_from_template.go b/test_fixtures/rewrite_package/init_code_snippet_filename/expected_output/i18n_init_from_template.go index 5ec5cd8..ae3fbf0 100644 --- a/test_fixtures/rewrite_package/init_code_snippet_filename/expected_output/i18n_init_from_template.go +++ b/test_fixtures/rewrite_package/init_code_snippet_filename/expected_output/i18n_init_from_template.go @@ -4,7 +4,7 @@ import ( "fmt" "path/filepath" - "github.com/maximilien/i18n4go/i18n" + "github.com/maximilien/i18n4go/i18n4go/i18n" ) var T i18n.TranslateFunc From 190722856b805d243f1ef947f1c7e0c6cf6ebfd1 Mon Sep 17 00:00:00 2001 From: Aerex Date: Fri, 28 Jun 2024 12:57:48 -0400 Subject: [PATCH 05/13] chore: updated translation --- i18n4go/cmds/checkup.go | 67 +- i18n4go/cmds/create_translations.go | 53 +- i18n4go/cmds/extract_strings.go | 85 +- i18n4go/cmds/fixup.go | 45 +- i18n4go/cmds/i18n_init.go | 11 - i18n4go/cmds/merge_string.go | 13 +- i18n4go/cmds/rewrite_package.go | 75 +- i18n4go/cmds/show_missing_strings.go | 21 +- i18n4go/cmds/verify_strings.go | 57 +- i18n4go/cmds/version.go | 9 +- i18n4go/common/ast.go | 4 +- i18n4go/common/common.go | 22 +- i18n4go/i18n/i18n_init.go | 9 + i18n4go/i18n/i18n_init.go.template | 4 +- i18n4go/i18n/i18n_resources.go | 948 ++++++++++++ i18n4go/i18n/init.go | 21 +- i18n4go/i18n/resources/all.en_US.json | 1945 +++++++++---------------- i18n4go/i18n4go.go | 97 +- i18n4go/resources/i18n_resources.go | 1455 ------------------ 19 files changed, 1977 insertions(+), 2964 deletions(-) delete mode 100644 i18n4go/cmds/i18n_init.go create mode 100644 i18n4go/i18n/i18n_init.go create mode 100644 i18n4go/i18n/i18n_resources.go delete mode 100644 i18n4go/resources/i18n_resources.go diff --git a/i18n4go/cmds/checkup.go b/i18n4go/cmds/checkup.go index 6bb5527..9b6523f 100644 --- a/i18n4go/cmds/checkup.go +++ b/i18n4go/cmds/checkup.go @@ -30,6 +30,7 @@ import ( "github.com/spf13/cobra" "github.com/maximilien/i18n4go/i18n4go/common" + "github.com/maximilien/i18n4go/i18n4go/i18n" ) type Checkup struct { @@ -50,16 +51,16 @@ func NewCheckup(options *common.Options) *Checkup { // NewCheckupCommand implements 'i18n4go checkup' command func NewCheckupCommand(options *common.Options) *cobra.Command { checkupCmd := &cobra.Command{ - Use: T("checkup"), - Short: T("Checks the transated files"), + Use: "checkup", + Short: i18n.T("Checks the transated files"), RunE: func(cmd *cobra.Command, args []string) error { return NewCheckup(options).Run() }, } - checkupCmd.Flags().StringVarP(&options.QualifierFlag, T("qualifier"), T("q"), T(""), T("[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)")) + checkupCmd.Flags().StringVarP(&options.QualifierFlag, "qualifier", "q", "", i18n.T("[optional] the qualifier string that is used when using the i18n.T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)")) // TODO: Optional flags shouldn't have set defaults. We should look into removing the default - checkupCmd.Flags().StringVar(&options.IgnoreRegexpFlag, T("ignore-regexp"), T(".*test.*"), T("recursively extract strings from all files in the same directory as filename or dirName")) + checkupCmd.Flags().StringVar(&options.IgnoreRegexpFlag, "ignore-regexp", ".*test.*", i18n.T("recursively extract strings from all files in the same directory as filename or dirName")) return checkupCmd } @@ -88,44 +89,44 @@ func (cu *Checkup) Run() error { sourceStrings, err := cu.findSourceStrings() if err != nil { - cu.Println(fmt.Sprintf(T("Couldn't find any source strings: {{.Arg0}}", map[string]interface{}{"Arg0": err.Error()}))) + cu.Println(i18n.T("Couldn't find any source strings: {{.Arg0}}", map[string]interface{}{"Arg0": err.Error()})) return err } - locales := findTranslationFiles(T("."), cu.IgnoreRegexp, false) + locales := findTranslationFiles(".", cu.IgnoreRegexp, false) - englishFiles := locales[T("en_US")] + englishFiles := locales["en_US"] if englishFiles == nil { - cu.Println(T("Could not find an i18n file for locale: en_US")) - return errors.New(T("Could not find an i18n file for locale: en_US")) + cu.Println(i18n.T("Could not find an i18n file for locale: en_US")) + return errors.New(i18n.T("Could not find an i18n file for locale: en_US")) } englishStrings, err := cu.findI18nStrings(englishFiles) if err != nil { - cu.Println(fmt.Sprintf(T("Couldn't find the english strings: {{.Arg0}}", map[string]interface{}{"Arg0": err.Error()}))) + cu.Println(i18n.T("Couldn't find the english strings: {{.Arg0}}", map[string]interface{}{"Arg0": err.Error()})) return err } - err = cu.diffStrings(T("the code"), T("en_US"), sourceStrings, englishStrings) + err = cu.diffStrings(i18n.T("the code"), "en_US", sourceStrings, englishStrings) for locale, i18nFiles := range locales { - if locale == T("en_US") { + if locale == "en_US" { continue } translatedStrings, err := cu.findI18nStrings(i18nFiles) if err != nil { - cu.Println(fmt.Sprintf(T("Couldn't get the strings from {{.Arg0}}: {{.Arg1}}", map[string]interface{}{"Arg0": locale, "Arg1": err.Error()}))) + cu.Println(i18n.T("Couldn't get the strings from {{.Arg0}}: {{.Arg1}}", map[string]interface{}{"Arg0": locale, "Arg1": err.Error()})) return err } - err = cu.diffStrings(T("en_US"), locale, englishStrings, translatedStrings) + err = cu.diffStrings("en_US", locale, englishStrings, translatedStrings) } if err == nil { - cu.Printf(T("OK")) + cu.Printf(i18n.T("OK")) } return err @@ -138,7 +139,7 @@ func getGoFiles(dir string) (files []string) { if !fileInfo.IsDir() { name := fileInfo.Name() - if strings.HasSuffix(name, T(".go")) && !strings.HasSuffix(name, T("_test.go")) { + if strings.HasSuffix(name, ".go") && !strings.HasSuffix(name, "_test.go") { files = append(files, filepath.Join(dir, fileInfo.Name())) } } else { @@ -212,7 +213,7 @@ func (cu *Checkup) inspectCallExpr(translatedStrings []string, stmtMap map[strin case *ast.Ident: funName := node.Fun.(*ast.Ident).Name // inspect any T() or t() method calls - if funName == T("T") || funName == T("t") { + if funName == "T" || funName == "t" { translatedStrings = cu.inspectTFunc(translatedStrings, stmtMap, *node) } @@ -220,8 +221,8 @@ func (cu *Checkup) inspectCallExpr(translatedStrings []string, stmtMap map[strin expr := node.Fun.(*ast.SelectorExpr) if ident, ok := expr.X.(*ast.Ident); ok { funName := expr.Sel.Name - // inspect any .T() or .t() method calls (eg. i18n.T()) - if ident.Name == cu.options.QualifierFlag && (funName == T("T") || funName == T("t")) { + // inspect any .i18n.T() or .t() method calls (eg. i18n.T()) + if ident.Name == cu.options.QualifierFlag && (funName == "T" || funName == "t") { translatedStrings = cu.inspectTFunc(translatedStrings, stmtMap, *node) } } @@ -264,12 +265,12 @@ func (cu *Checkup) inspectFile(file string) (translatedStrings []string, err err func (cu *Checkup) findSourceStrings() (sourceStrings map[string]string, err error) { sourceStrings = make(map[string]string) - files := getGoFiles(T(".")) + files := getGoFiles(".") for _, file := range files { fileStrings, err := cu.inspectFile(file) if err != nil { - cu.Println(T("Error when inspecting go file: "), file) + cu.Println(i18n.T("Error when inspecting go file: "), file) return sourceStrings, err } @@ -293,14 +294,14 @@ func getI18nFile(locale, dir string) (filePath string) { name := fileInfo.Name() // assume the file path is a json file and the path contains the locale - if strings.HasSuffix(name, T(".json")) && strings.Contains(name, fmt.Sprintf(T("{{.Arg0}}.", map[string]interface{}{"Arg0": locale}))) { + if strings.HasSuffix(name, ".json") && strings.Contains(name, fmt.Sprintf("{{.Arg0}}.", map[string]interface{}{"Arg0": locale})) { filePath = filepath.Join(dir, fileInfo.Name()) break } } else { filePath = getI18nFile(locale, filepath.Join(dir, fileInfo.Name())) - if filePath != T("") { + if filePath != "" { break } } @@ -317,19 +318,19 @@ func findTranslationFiles(dir string, ignoreRegexp *regexp.Regexp, verbose bool) if !fileInfo.IsDir() { name := fileInfo.Name() - if strings.HasSuffix(name, T(".json")) { - parts := strings.Split(name, T(".")) + if strings.HasSuffix(name, ".json") { + parts := strings.Split(name, ".") var locale string for _, part := range parts { - invalidLangRegexp, _ := regexp.Compile(T("excluded|json|all")) + invalidLangRegexp, _ := regexp.Compile("excluded|json|all") if !invalidLangRegexp.MatchString(part) { locale = part } } // No locale found so skipping - if locale == T("") { + if locale == "" { continue } @@ -378,16 +379,16 @@ func (cu *Checkup) findI18nStrings(i18nFiles []string) (i18nStrings map[string]s func (cu *Checkup) diffStrings(sourceNameOne, sourceNameTwo string, stringsOne, stringsTwo map[string]string) (err error) { for key, _ := range stringsOne { - if stringsTwo[key] == T("") { - cu.Printf(T("\"{{.Arg0}}\" exists in {{.Arg1}}, but not in {{.Arg2}}\n", map[string]interface{}{"Arg0": key, "Arg1": sourceNameOne, "Arg2": sourceNameTwo})) - err = errors.New(T("Strings don't match")) + if stringsTwo[key] == "" { + cu.Printf(i18n.T("\"{{.Arg0}}\" exists in {{.Arg1}}, but not in {{.Arg2}}\n", map[string]interface{}{"Arg0": key, "Arg1": sourceNameOne, "Arg2": sourceNameTwo})) + err = errors.New(i18n.T("Strings don't match")) } } for key, _ := range stringsTwo { - if stringsOne[key] == T("") { - cu.Printf(T("\"{{.Arg0}}\" exists in {{.Arg1}}, but not in {{.Arg2}}\n", map[string]interface{}{"Arg0": key, "Arg1": sourceNameTwo, "Arg2": sourceNameOne})) - err = errors.New(T("Strings don't match")) + if stringsOne[key] == "" { + cu.Printf(i18n.T("\"{{.Arg0}}\" exists in {{.Arg1}}, but not in {{.Arg2}}\n", map[string]interface{}{"Arg0": key, "Arg1": sourceNameTwo, "Arg2": sourceNameOne})) + err = errors.New(i18n.T("Strings don't match")) } } diff --git a/i18n4go/cmds/create_translations.go b/i18n4go/cmds/create_translations.go index 6b2eb43..f765db8 100644 --- a/i18n4go/cmds/create_translations.go +++ b/i18n4go/cmds/create_translations.go @@ -28,6 +28,7 @@ import ( "github.com/spf13/cobra" "github.com/maximilien/i18n4go/i18n4go/common" + "github.com/maximilien/i18n4go/i18n4go/i18n" ) type createTranslations struct { @@ -74,7 +75,7 @@ func NewCreateTranslations(options *common.Options) *createTranslations { func NewCreateTranslationsCommand(options *common.Options) *cobra.Command { createTranslationsCmd := &cobra.Command{ Use: "create-translations", - Short: "Creates the transation files", + Short: i18n.T("Creates the transation files"), RunE: func(cmd *cobra.Command, args []string) error { return NewCreateTranslations(options).Run() }, @@ -82,11 +83,11 @@ func NewCreateTranslationsCommand(options *common.Options) *cobra.Command { // TODO: --google-translate-api-key is too long of an optional flag // might want to shorten it or add an alias for usability - createTranslationsCmd.Flags().StringVar(&options.GoogleTranslateApiKeyFlag, "google-translate-api-key", "", "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)") - createTranslationsCmd.Flags().StringVarP(&options.SourceLanguageFlag, "source-language", "s", "en", "the source language of the file, typically also part of the file name, e.g., \"en_US\"") - createTranslationsCmd.Flags().StringVarP(&options.FilenameFlag, "file", "f", "", "the source translation file") - createTranslationsCmd.Flags().StringVarP(&options.LanguagesFlag, "languages", "l", "", "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"") - createTranslationsCmd.Flags().StringVarP(&options.OutputDirFlag, "output", "o", "", "the output directory where the newly created translation files will be placed") + createTranslationsCmd.Flags().StringVar(&options.GoogleTranslateApiKeyFlag, "google-translate-api-key", "", i18n.T("[optional] your public Google Translate API key which is used to generate translations (charge is applicable)")) + createTranslationsCmd.Flags().StringVarP(&options.SourceLanguageFlag, "source-language", "s", "en", i18n.T("the source language of the file, typically also part of the file name, e.g., \"en_US\"")) + createTranslationsCmd.Flags().StringVarP(&options.FilenameFlag, "file", "f", "", i18n.T("the source translation file")) + createTranslationsCmd.Flags().StringVarP(&options.LanguagesFlag, "languages", "l", "", i18n.T("a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"")) + createTranslationsCmd.Flags().StringVarP(&options.OutputDirFlag, "output", "o", "", i18n.T("the output directory where the newly created translation files will be placed")) return createTranslationsCmd @@ -113,24 +114,24 @@ func (ct *createTranslations) Printf(msg string, a ...interface{}) (int, error) } func (ct *createTranslations) Run() error { - ct.Println("i18n4go: creating translation files for:", ct.Filename) + ct.Println(i18n.T("i18n4go: creating translation files for:"), ct.Filename) ct.Println() for _, language := range ct.Languages { - ct.Println("i18n4go: creating translation file copy for language:", language) + ct.Println(i18n.T("i18n4go: creating translation file copy for language:"), language) if ct.options.GoogleTranslateApiKeyFlag != "" { destFilename, err := ct.createTranslationFileWithGoogleTranslate(language) if err != nil { - return fmt.Errorf("i18n4go: could not create translation file for language: %s with Google Translate", language) + return fmt.Errorf(i18n.T("i18n4go: could not create translation file for language: {{.Arg0}} with Google Translate", map[string]interface{}{"Arg0": language})) } - ct.Println("i18n4go: created translation file with Google Translate:", destFilename) + ct.Println(i18n.T("i18n4go: created translation file with Google Translate:"), destFilename) } else { destFilename, err := ct.createTranslationFile(ct.Filename, language) if err != nil { - return fmt.Errorf("i18n4go: could not create default translation file for language: %s\nerr:%s", language, err.Error()) + return fmt.Errorf(i18n.T("i18n4go: could not create default translation file for language: {{.Arg0}}\nerr:{{.Arg1}}", map[string]interface{}{"Arg0": language, "Arg1": err.Error()})) } - ct.Println("i18n4go: created default translation file:", destFilename) + ct.Println(i18n.T("i18n4go: created default translation file:"), destFilename) } } @@ -148,7 +149,7 @@ func (ct *createTranslations) createTranslationFileWithGoogleTranslate(language err = common.CreateOutputDirsIfNeeded(ct.OutputDirname) if err != nil { ct.Println(err) - return "", fmt.Errorf("i18n4go: could not create output directory: %s", ct.OutputDirname) + return "", fmt.Errorf(i18n.T("i18n4go: could not create output directory: {{.Arg0}}", map[string]interface{}{"Arg0": ct.OutputDirname})) } destFilename := filepath.Join(ct.OutputDirname, strings.Replace(fileName, ct.options.SourceLanguageFlag, language, -1)) @@ -156,19 +157,19 @@ func (ct *createTranslations) createTranslationFileWithGoogleTranslate(language i18nStringInfos, err := common.LoadI18nStringInfos(ct.Filename) if err != nil { ct.Println(err) - return "", fmt.Errorf("i18n4go: could not load i18n strings from file: %s", ct.Filename) + return "", fmt.Errorf(i18n.T("i18n4go: could not load i18n strings from file: {{.Arg0}}", map[string]interface{}{"Arg0": ct.Filename})) } if len(i18nStringInfos) == 0 { - return "", fmt.Errorf("i18n4go: input file: %s is empty", ct.Filename) + return "", fmt.Errorf(i18n.T("i18n4go: input file: {{.Arg0}} is empty", map[string]interface{}{"Arg0": ct.Filename})) } - ct.Println("i18n4go: attempting to use Google Translate to translate source strings in: ", language) + ct.Println(i18n.T("i18n4go: attempting to use Google Translate to translate source strings in: "), language) modifiedI18nStringInfos := make([]common.I18nStringInfo, len(i18nStringInfos)) for i, i18nStringInfo := range i18nStringInfos { translation, _, err := ct.googleTranslate(i18nStringInfo.Translation, language) if err != nil { - ct.Println("i18n4go: error invoking Google Translate for string:", i18nStringInfo.Translation) + ct.Println(i18n.T("i18n4go: error invoking Google Translate for string:"), i18nStringInfo.Translation) } else { modifiedI18nStringInfos[i] = common.I18nStringInfo{ID: i18nStringInfo.ID, Translation: translation} } @@ -177,7 +178,7 @@ func (ct *createTranslations) createTranslationFileWithGoogleTranslate(language err = common.SaveI18nStringInfos(ct, ct.Options(), modifiedI18nStringInfos, destFilename) if err != nil { ct.Println(err) - return "", fmt.Errorf("i18n4go: could not save Google Translate i18n strings to file: %s", destFilename) + return "", fmt.Errorf(i18n.T("i18n4go: could not save Google Translate i18n strings to file: {{.Arg0}}", map[string]interface{}{"Arg0": destFilename})) } if ct.options.PoFlag { @@ -185,7 +186,7 @@ func (ct *createTranslations) createTranslationFileWithGoogleTranslate(language err = common.SaveI18nStringsInPo(ct, ct.Options(), modifiedI18nStringInfos, poFilename) if err != nil { ct.Println(err) - return "", fmt.Errorf("i18n4go: could not save PO file: %s", poFilename) + return "", fmt.Errorf(i18n.T("i18n4go: could not save PO file: {{.Arg0}}", map[string]interface{}{"Arg0": poFilename})) } } @@ -203,15 +204,15 @@ func (ct *createTranslations) createTranslationFile(sourceFilename string, langu i18nStringInfos, err := common.LoadI18nStringInfos(sourceFilename) if err != nil { ct.Println(err) - return "", fmt.Errorf("i18n4go: could not load i18n strings from file: %s", sourceFilename) + return "", fmt.Errorf(i18n.T("i18n4go: could not load i18n strings from file: {{.Arg0}}", map[string]interface{}{"Arg0": sourceFilename})) } if len(i18nStringInfos) == 0 { - return "", fmt.Errorf("i18n4go: input file: %s is empty", sourceFilename) + return "", fmt.Errorf(i18n.T("i18n4go: input file: {{.Arg0}} is empty", map[string]interface{}{"Arg0": sourceFilename})) } destFilename := filepath.Join(ct.OutputDirname, strings.Replace(fileName, ct.options.SourceLanguageFlag, language, -1)) - ct.Println("i18n4go: creating translation file:", destFilename) + ct.Println(i18n.T("i18n4go: creating translation file:"), destFilename) return destFilename, common.CopyFileContents(sourceFilename, destFilename) } @@ -220,9 +221,11 @@ func (ct *createTranslations) googleTranslate(translateString string, language s escapedTranslateString := url.QueryEscape(translateString) googleTranslateUrl := "https://www.googleapis.com/language/translate/v2?key=" + ct.options.GoogleTranslateApiKeyFlag + "&target=" + language + "&q=" + escapedTranslateString + // REMOVEME: Do not commit + fmt.Printf("\ngoogleTranslateUrl: %s\n", googleTranslateUrl) response, err := http.Get(googleTranslateUrl) if err != nil { - ct.Println("i18n4go: ERROR invoking Google Translate: ", googleTranslateUrl) + ct.Println(i18n.T("i18n4go: ERROR invoking Google Translate: "), googleTranslateUrl) return "", "", err } @@ -230,14 +233,14 @@ func (ct *createTranslations) googleTranslate(translateString string, language s body, err := ioutil.ReadAll(response.Body) if err != nil { - ct.Println("i18n4go: ERROR parsing Google Translate response body") + ct.Println(i18n.T("i18n4go: ERROR parsing Google Translate response body")) return "", "", err } var googleTranslateData GoogleTranslateData err = json.Unmarshal(body, &googleTranslateData) if err != nil { - ct.Println("i18n4go: ERROR parsing Google Translate response body") + ct.Println(i18n.T("i18n4go: ERROR parsing Google Translate response body")) return "", "", err } diff --git a/i18n4go/cmds/extract_strings.go b/i18n4go/cmds/extract_strings.go index 9f38589..af779da 100644 --- a/i18n4go/cmds/extract_strings.go +++ b/i18n4go/cmds/extract_strings.go @@ -34,6 +34,7 @@ import ( "github.com/spf13/cobra" "github.com/maximilien/i18n4go/i18n4go/common" + "github.com/maximilien/i18n4go/i18n4go/i18n" ) type extractStrings struct { @@ -78,29 +79,29 @@ func NewExtractStrings(options *common.Options) *extractStrings { func NewExtractStringsCommand(options *common.Options) *cobra.Command { extractTranslationsCmd := &cobra.Command{ Use: "extract-strings", - Short: "Extract the translation strings from go source files", + Short: i18n.T("Extract the translation strings from go source files"), RunE: func(cmd *cobra.Command, args []string) error { return NewExtractStrings(options).Run() }, } - extractTranslationsCmd.Flags().BoolVar(&options.PoFlag, "po", false, "generate standard .po file for translation") + extractTranslationsCmd.Flags().BoolVar(&options.PoFlag, "po", false, i18n.T("generate standard .po file for translation")) // NOTE: To keep existing behavior we are leaving the default value ".*test.*" // but optional flags not used should have default values other than empty or false (for clarity) - extractTranslationsCmd.Flags().StringVarP(&options.FilenameFlag, "file", "f", "", "the file name for which strings are extracted") - extractTranslationsCmd.Flags().StringVarP(&options.ExcludedFilenameFlag, "exclude", "e", "excluded.json", "the JSON file with strings to be excluded, defaults to excluded.json if present") - extractTranslationsCmd.Flags().StringVarP(&options.SubstringFilenameFlag, "substring-file", "s", "capturing_group.json", "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation") - extractTranslationsCmd.Flags().BoolVarP(&options.MetaFlag, "meta", "m", false, "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file") - extractTranslationsCmd.Flags().BoolVar(&options.DryRunFlag, "dry-run", false, "prevents any output files from being created") + extractTranslationsCmd.Flags().StringVarP(&options.FilenameFlag, "file", "f", "", i18n.T("the file name for which strings are extracted")) + extractTranslationsCmd.Flags().StringVarP(&options.ExcludedFilenameFlag, "exclude", "e", "excluded.json", i18n.T("the JSON file with strings to be excluded, defaults to excluded.json if present")) + extractTranslationsCmd.Flags().StringVarP(&options.SubstringFilenameFlag, "substring-file", "s", "capturing_group.json", i18n.T("the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation")) + extractTranslationsCmd.Flags().BoolVarP(&options.MetaFlag, "meta", "m", false, i18n.T("[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file")) + extractTranslationsCmd.Flags().BoolVar(&options.DryRunFlag, "dry-run", false, i18n.T("prevents any output files from being created")) // TODO: Optional flag that defaults to true is not best practice // We should rename this flag to have the default be fault - extractTranslationsCmd.Flags().BoolVar(&options.OutputFlatFlag, "output-flat", true, "generated files are created in the specified output directory") - extractTranslationsCmd.Flags().BoolVar(&options.OutputMatchPackageFlag, "output-match-package", false, "generated files are created in directory to match the package name") - extractTranslationsCmd.Flags().StringVarP(&options.OutputDirFlag, "output", "o", "", "output directory where the translation files will be placed") - extractTranslationsCmd.Flags().StringVarP(&options.DirnameFlag, "directory", "d", "", "the dir name for which all .go files will have their strings extracted") - extractTranslationsCmd.Flags().BoolVarP(&options.RecurseFlag, "recursive", "r", false, "recursively extract strings from all files in the same directory as filename or dirName") + extractTranslationsCmd.Flags().BoolVar(&options.OutputFlatFlag, "output-flat", true, i18n.T("generated files are created in the specified output directory")) + extractTranslationsCmd.Flags().BoolVar(&options.OutputMatchPackageFlag, "output-match-package", false, i18n.T("generated files are created in directory to match the package name")) + extractTranslationsCmd.Flags().StringVarP(&options.OutputDirFlag, "output", "o", "", i18n.T("output directory where the translation files will be placed")) + extractTranslationsCmd.Flags().StringVarP(&options.DirnameFlag, "directory", "d", "", i18n.T("the dir name for which all .go files will have their strings extracted")) + extractTranslationsCmd.Flags().BoolVarP(&options.RecurseFlag, "recursive", "r", false, i18n.T("recursively extract strings from all files in the same directory as filename or dirName")) // Same as NOTE in L78-79 - extractTranslationsCmd.Flags().StringVar(&options.IgnoreRegexpFlag, "ignore-regexp", ".*test.*", "recursively extract strings from all files in the same directory as filename or dirName") + extractTranslationsCmd.Flags().StringVar(&options.IgnoreRegexpFlag, "ignore-regexp", ".*test.*", i18n.T("recursively extract strings from all files in the same directory as filename or dirName")) return extractTranslationsCmd } @@ -131,20 +132,20 @@ func (es *extractStrings) Run() error { } else { err := es.InspectDir(es.options.DirnameFlag, es.options.RecurseFlag) if err != nil { - es.Println("i18n4go: could not extract strings from directory:", es.options.DirnameFlag) + es.Println(i18n.T("i18n4go: could not extract strings from directory:"), es.options.DirnameFlag) return err } es.Println() - es.Println("Total files parsed:", es.TotalFiles) - es.Println("Total extracted strings:", es.TotalStrings) + es.Println(i18n.T("Total files parsed:"), es.TotalFiles) + es.Println(i18n.T("Total extracted strings:"), es.TotalStrings) } return nil } func (es *extractStrings) InspectFile(filename string) error { - es.Println("i18n4go: extracting strings from file:", filename) + es.Println(i18n.T("i18n4go: extracting strings from file:"), filename) if es.options.DryRunFlag { - es.Println("WARNING running in -dry-run mode") + es.Println(i18n.T("WARNING running in -dry-run mode")) } es.ExtractedStrings = make(map[string]common.StringInfo) @@ -168,7 +169,7 @@ func (es *extractStrings) InspectFile(filename string) error { } if strings.HasPrefix(fileInfo.Name(), ".") { - es.Println("WARNING ignoring file:", absFilePath) + es.Println(i18n.T("WARNING ignoring file:"), absFilePath) return nil } @@ -183,14 +184,14 @@ func (es *extractStrings) InspectFile(filename string) error { es.Println(err) return err } - es.Println(fmt.Sprintf("Loaded %d excluded strings", len(es.FilteredStrings))) + es.Println(fmt.Sprintf(i18n.T("Loaded {{.Arg0}} excluded strings", map[string]interface{}{"Arg0": len(es.FilteredStrings)}))) err = es.loadExcludedRegexps() if err != nil { es.Println(err) return err } - es.Println(fmt.Sprintf("Loaded %d excluded regexps", len(es.FilteredRegexps))) + es.Println(fmt.Sprintf(i18n.T("Loaded {{.Arg0}} excluded regexps", map[string]interface{}{"Arg0": len(es.FilteredRegexps)}))) if es.options.SubstringFilenameFlag != "" { err := es.loadSubstringRegexps() @@ -198,7 +199,7 @@ func (es *extractStrings) InspectFile(filename string) error { es.Println(err) return err } - es.Println(fmt.Sprintf("Loaded %d substring regexps", len(es.FilteredRegexps))) + es.Println(fmt.Sprintf(i18n.T("Loaded {{.Arg0}} substring regexps", map[string]interface{}{"Arg0": len(es.FilteredRegexps)}))) } es.excludeImports(astFile) @@ -208,7 +209,7 @@ func (es *extractStrings) InspectFile(filename string) error { es.TotalStrings += len(es.ExtractedStrings) es.TotalFiles += 1 - es.Printf("Extracted %d strings from file: %s\n", len(es.ExtractedStrings), absFilePath) + es.Printf(i18n.T("Extracted {{.Arg0}} strings from file: {{.Arg1}}\n", map[string]interface{}{"Arg0": len(es.ExtractedStrings), "Arg1": absFilePath})) var outputDirname = es.OutputDirname if es.options.OutputDirFlag != "" { @@ -259,7 +260,7 @@ func (es *extractStrings) InspectFile(filename string) error { } func (es *extractStrings) InspectDir(dirName string, recursive bool) error { - es.Printf("i18n4go: inspecting dir %s, recursive: %t\n", dirName, recursive) + es.Printf(i18n.T("i18n4go: inspecting dir {{.Arg0}}, recursive: {{.Arg1}}\n", map[string]interface{}{"Arg0": dirName, "Arg1": recursive})) es.Println() fset := token.NewFileSet() @@ -272,13 +273,13 @@ func (es *extractStrings) InspectDir(dirName string, recursive bool) error { } for k, pkg := range packages { - es.Println("Extracting strings in package:", k) + es.Println(i18n.T("Extracting strings in package:"), k) for fileName, _ := range pkg.Files { if es.IgnoreRegexp != nil && es.IgnoreRegexp.MatchString(fileName) { - es.Println("Using ignore-regexp:", es.options.IgnoreRegexpFlag) + es.Println(i18n.T("Using ignore-regexp:"), es.options.IgnoreRegexpFlag) continue } else { - es.Println("No match for ignore-regexp:", es.options.IgnoreRegexpFlag) + es.Println(i18n.T("No match for ignore-regexp:"), es.options.IgnoreRegexpFlag) } if strings.HasSuffix(fileName, ".go") { @@ -289,7 +290,7 @@ func (es *extractStrings) InspectDir(dirName string, recursive bool) error { } } } - es.Printf("Extracted total of %d strings\n\n", es.TotalStringsDir) + es.Printf(i18n.T("Extracted total of {{.Arg0}} strings\n\n", map[string]interface{}{"Arg0": es.TotalStringsDir})) if recursive { fileInfos, _ := ioutil.ReadDir(dirName) @@ -311,12 +312,12 @@ func (es *extractStrings) findImportPath(filename string) (string, error) { filePath, err := common.FindFilePath(filename) if err != nil { - fmt.Println("ERROR opening file", err) + fmt.Println(i18n.T("ERROR opening file"), err) return "", err } pkg, err := build.ImportDir(filePath, 0) - srcPath := "src" + string(os.PathSeparator) + srcPath := i18n.T("src") + string(os.PathSeparator) if strings.HasPrefix(pkg.Dir, srcPath) { path = filepath.Join(path, pkg.Dir[len(srcPath):len(pkg.Dir)]) } @@ -329,13 +330,13 @@ func (es *extractStrings) findPackagePath(filename string) (string, error) { filePath, err := common.FindFilePath(filename) if err != nil { - fmt.Println("ERROR opening file", err) + fmt.Println(i18n.T("ERROR opening file"), err) return "", err } pkg, err := build.ImportDir(filePath, 0) if err != nil { - fmt.Println("ERROR opening file", err) + fmt.Println(i18n.T("ERROR opening file"), err) return "", err } @@ -344,7 +345,7 @@ func (es *extractStrings) findPackagePath(filename string) (string, error) { func (es *extractStrings) saveExtractedStrings(outputDirname string) error { if len(es.ExtractedStrings) != 0 { - es.Println("Saving extracted strings to file:", es.Filename) + es.Println(i18n.T("Saving extracted strings to file:"), es.Filename) } if !es.options.DryRunFlag { @@ -398,11 +399,11 @@ func (es *extractStrings) setPoFilename(filename string) { func (es *extractStrings) loadExcludedStrings() error { _, err := os.Stat(es.options.ExcludedFilenameFlag) if os.IsNotExist(err) { - es.Println("Could not find:", es.options.ExcludedFilenameFlag) + es.Println(i18n.T("Could not find:"), es.options.ExcludedFilenameFlag) return nil } - es.Println("Excluding strings in file:", es.options.ExcludedFilenameFlag) + es.Println(i18n.T("Excluding strings in file:"), es.options.ExcludedFilenameFlag) content, err := ioutil.ReadFile(es.options.ExcludedFilenameFlag) if err != nil { @@ -427,11 +428,11 @@ func (es *extractStrings) loadExcludedStrings() error { func (es *extractStrings) loadExcludedRegexps() error { _, err := os.Stat(es.options.ExcludedFilenameFlag) if os.IsNotExist(err) { - es.Println("Could not find:", es.options.ExcludedFilenameFlag) + es.Println(i18n.T("Could not find:"), es.options.ExcludedFilenameFlag) return nil } - es.Println("Excluding regexps in file:", es.options.ExcludedFilenameFlag) + es.Println(i18n.T("Excluding regexps in file:"), es.options.ExcludedFilenameFlag) content, err := ioutil.ReadFile(es.options.ExcludedFilenameFlag) if err != nil { @@ -449,7 +450,7 @@ func (es *extractStrings) loadExcludedRegexps() error { for _, regexpString := range excludedRegexps.ExcludedRegexps { compiledRegexp, err := regexp.Compile(regexpString) if err != nil { - fmt.Println("WARNING error compiling regexp:", regexpString) + fmt.Println(i18n.T("WARNING error compiling regexp:"), regexpString) } es.FilteredRegexps = append(es.FilteredRegexps, compiledRegexp) @@ -465,11 +466,11 @@ type CaptureGroupSubstrings struct { func (es *extractStrings) loadSubstringRegexps() error { _, err := os.Stat(es.options.SubstringFilenameFlag) if os.IsNotExist(err) { - es.Println("Could not find:", es.options.SubstringFilenameFlag) + es.Println(i18n.T("Could not find:"), es.options.SubstringFilenameFlag) return nil } - es.Println("Capturing substrings in file:", es.options.SubstringFilenameFlag) + es.Println(i18n.T("Capturing substrings in file:"), es.options.SubstringFilenameFlag) content, err := ioutil.ReadFile(es.options.SubstringFilenameFlag) if err != nil { @@ -487,7 +488,7 @@ func (es *extractStrings) loadSubstringRegexps() error { for _, regexpString := range captureGroupStrings.RegexpsStrings { compiledRegexp, err := regexp.Compile(regexpString) if err != nil { - fmt.Println("WARNING error compiling regexp:", regexpString) + fmt.Println(i18n.T("WARNING error compiling regexp:"), regexpString) } es.SubstringRegexps = append(es.SubstringRegexps, compiledRegexp) @@ -527,7 +528,7 @@ func (es *extractStrings) processBasicLit(basicLit *ast.BasicLit, n ast.Node, fs if compiledRegexp.MatchString(basicLit.Value) { submatches := compiledRegexp.FindStringSubmatch(basicLit.Value) if submatches == nil { - es.Println(fmt.Sprintf("WARNING No capturing group found in %s", compiledRegexp.String())) + es.Println(fmt.Sprintf(i18n.T("WARNING No capturing group found in {{.Arg0}}", map[string]interface{}{"Arg0": compiledRegexp.String()}))) return } captureGroup := submatches[1] diff --git a/i18n4go/cmds/fixup.go b/i18n4go/cmds/fixup.go index 13861f4..401af48 100644 --- a/i18n4go/cmds/fixup.go +++ b/i18n4go/cmds/fixup.go @@ -30,6 +30,7 @@ import ( "go/token" "github.com/maximilien/i18n4go/i18n4go/common" + "github.com/maximilien/i18n4go/i18n4go/i18n" "github.com/spf13/cobra" ) @@ -55,14 +56,14 @@ func NewFixup(options *common.Options) *fixup { func NewFixupCommand(options *common.Options) *cobra.Command { fixupCmd := &cobra.Command{ Use: "fixup", - Long: "Add, update, or remove translation keys from source files and resources files", - Short: "Fixup the transation files", + Long: i18n.T("Add, update, or remove translation keys from source files and resources files"), + Short: i18n.T("Fixup the transation files"), RunE: func(cmd *cobra.Command, args []string) error { return NewFixup(options).Run() }, } - fixupCmd.Flags().StringVar(&options.IgnoreRegexpFlag, "ignore-regexp", ".*test.*", "recursively extract strings from all files in the same directory as filename or dirName") + fixupCmd.Flags().StringVar(&options.IgnoreRegexpFlag, "ignore-regexp", ".*test.*", i18n.T("recursively extract strings from all files in the same directory as filename or dirName")) return fixupCmd } @@ -93,27 +94,31 @@ func (fix *fixup) Run() error { fix.Source = source if err != nil { - fmt.Println(fmt.Sprintf("Couldn't find any source strings: %s", err.Error())) + fmt.Println(i18n.T("Couldn't find any source strings: {{.Arg0}}", map[string]interface{}{ + "Arg0": err.Error(), + })) return err } locales := findTranslationFiles(".", fix.IgnoreRegexp, fix.options.VerboseFlag) englishFiles, ok := locales["en_US"] if !ok { - fmt.Println("Unable to find english translation files") - return errors.New("Unable to find english translation files") + fmt.Println(i18n.T("Unable to find english translation files")) + return errors.New(i18n.T("Unable to find english translation files")) } englishFile := englishFiles[0] if englishFile == "" { - fmt.Println("Could not find an i18n file for locale: en_US") - return errors.New("Could not find an i18n file for locale: en_US") + fmt.Println(i18n.T("Could not find an i18n file for locale: en_US")) + return errors.New(i18n.T("Could not find an i18n file for locale: en_US")) } englishStringInfos, err := fix.findI18nStrings(englishFile) if err != nil { - fmt.Println(fmt.Sprintf("Couldn't find the english strings: %s", err.Error())) + fmt.Println(i18n.T("Couldn't find the english strings: {{.Arg0}}", map[string]interface{}{ + "Arg0": err.Error(), + })) return err } @@ -153,7 +158,7 @@ func (fix *fixup) Run() error { updated := false for !escape { - fmt.Printf("Is the string \"%s\" a new or updated string? [new/upd]\n", newUpdatedTranslation) + fmt.Printf(i18n.T("Is the string \"%s\" a new or updated string? [new/upd]\n"), newUpdatedTranslation) _, err := fmt.Scanf("%s\n", &input) if err != nil { @@ -167,7 +172,7 @@ func (fix *fixup) Run() error { additionalTranslations = append(additionalTranslations, newUpdatedTranslation) escape = true case "upd": - fmt.Println("Select the number for the previous translation:") + fmt.Println(i18n.T("Select the number for the previous translation:")) for index, value := range removedTranslations { fmt.Printf("\t%d. %s\n", (index + 1), value) } @@ -185,15 +190,15 @@ func (fix *fixup) Run() error { updated = true } else { - fmt.Println("Invalid response.") + fmt.Println(i18n.T("Invalid response.")) } } escape = true case "exit": - fmt.Println("Canceling fixup") + fmt.Println(i18n.T("Canceling fixup")) os.Exit(0) default: - fmt.Println("Invalid response.") + fmt.Println(i18n.T("Invalid response.")) } } } else { @@ -207,7 +212,7 @@ func (fix *fixup) Run() error { for locale, i18nFiles := range locales { translatedStrings, err := fix.findI18nStrings(i18nFiles[0]) if err != nil { - fmt.Println(fmt.Sprintf("Couldn't get the strings from %s: %s", locale, err.Error())) + fmt.Println(fmt.Sprintf(i18n.T("Couldn't get the strings from {{.Arg0}}: {{.Arg1}}"), locale, err.Error())) return err } @@ -227,7 +232,7 @@ func (fix *fixup) Run() error { } if err == nil { - fmt.Printf("OK") + fmt.Printf(i18n.T("OK")) } return err @@ -274,7 +279,7 @@ func (fix *fixup) findSourceStrings() (sourceStrings map[string]int, err error) for _, file := range files { fileStrings, err := fix.inspectFile(file) if err != nil { - fmt.Println("Error when inspecting go file: ", file) + fmt.Println(i18n.T("Error when inspecting go file: "), file) return sourceStrings, err } @@ -359,7 +364,7 @@ func writeStringInfoMapToJSON(localeMap map[string]common.I18nStringInfo, locale } func addTranslations(localeMap map[string]common.I18nStringInfo, localeFile string, addTranslations []string) { - fmt.Printf("Adding these strings to the %s translation file:\n", localeFile) + fmt.Printf(i18n.T("Adding these strings to the %s translation file:\n"), localeFile) for _, id := range addTranslations { localeMap[id] = common.I18nStringInfo{ID: id, Translation: id} @@ -369,7 +374,7 @@ func addTranslations(localeMap map[string]common.I18nStringInfo, localeFile stri func removeTranslations(localeMap map[string]common.I18nStringInfo, localeFile string, remTranslations []string) error { var err error - fmt.Printf("Removing these strings from the %s translation file:\n", localeFile) + fmt.Printf(i18n.T("Removing these strings from the %s translation file:\n"), localeFile) for _, id := range remTranslations { delete(localeMap, id) @@ -380,7 +385,7 @@ func removeTranslations(localeMap map[string]common.I18nStringInfo, localeFile s } func updateTranslations(localMap map[string]common.I18nStringInfo, localeFile string, locale string, updTranslations map[string]string) { - fmt.Printf("Updating the following strings from the %s translation file:\n", localeFile) + fmt.Printf(i18n.T("Updating the following strings from the %s translation file:\n"), localeFile) for key, value := range updTranslations { fmt.Println("\t", key) diff --git a/i18n4go/cmds/i18n_init.go b/i18n4go/cmds/i18n_init.go deleted file mode 100644 index 8dda60d..0000000 --- a/i18n4go/cmds/i18n_init.go +++ /dev/null @@ -1,11 +0,0 @@ -package cmds - -import ( - i18n "github.com/maximilien/i18n4go/i18n4go/i18n" -) - -var T i18n.TranslateFunc - -func init() { - T = i18n.Init("", "./i18n4go/i18n/"+i18n.GetResourcesPath()) -} diff --git a/i18n4go/cmds/merge_string.go b/i18n4go/cmds/merge_string.go index f56c693..de70575 100644 --- a/i18n4go/cmds/merge_string.go +++ b/i18n4go/cmds/merge_string.go @@ -22,6 +22,7 @@ import ( "strings" "github.com/maximilien/i18n4go/i18n4go/common" + "github.com/maximilien/i18n4go/i18n4go/i18n" "github.com/spf13/cobra" ) @@ -49,15 +50,15 @@ func NewMergeStrings(options *common.Options) *mergeStrings { func NewMergeStringsCommand(options *common.Options) *cobra.Command { mergeStringsCmd := &cobra.Command{ Use: "merge-strings", - Short: "Merge translation strings", + Short: i18n.T("Merge translation strings"), RunE: func(cmd *cobra.Command, args []string) error { return NewMergeStrings(options).Run() }, } - mergeStringsCmd.Flags().BoolVarP(&options.RecurseFlag, "recursive", "r", false, "recursively extract strings from all files in the same directory as filename or dirName") - mergeStringsCmd.Flags().StringVarP(&options.SourceLanguageFlag, "source-language", "s", "en", "the source language of the file, typically also part of the file name, e.g., \"en_US\"") + mergeStringsCmd.Flags().BoolVarP(&options.RecurseFlag, "recursive", "r", false, i18n.T("recursively extract strings from all files in the same directory as filename or dirName")) + mergeStringsCmd.Flags().StringVarP(&options.SourceLanguageFlag, "source-language", "s", "en", i18n.T("the source language of the file, typically also part of the file name, e.g., \"en_US\"")) - mergeStringsCmd.Flags().StringVarP(&options.DirnameFlag, "directory", "d", "", "the dir name for which all .go files will have their strings extracted") + mergeStringsCmd.Flags().StringVarP(&options.DirnameFlag, "directory", "d", "", i18n.T("the dir name for which all .go files will have their strings extracted")) return mergeStringsCmd } @@ -104,7 +105,7 @@ func (ms *mergeStrings) combineStringInfosPerDirectory(directory string) error { ms.I18nStringInfos = common.I18nStringInfoMapValues2Array(combinedMap) sort.Sort(ms) common.SaveI18nStringInfos(ms, ms.Options(), ms.I18nStringInfos, filePath) - ms.Println("i18n4go: saving combined language file: " + filePath) + ms.Println(i18n.T("i18n4go: saving combined language file: ") + filePath) if ms.Recurse { for _, directory = range directories { @@ -136,7 +137,7 @@ func (ms mergeStrings) matchFileToSourceLanguage(files []string, lang string) (l for _, file := range files { if strings.Contains(file, languageMatcher) { list = append(list, file) - ms.Println("i18n4go: scanning file: " + file) + ms.Println(i18n.T("i18n4go: scanning file: ") + file) } } return diff --git a/i18n4go/cmds/rewrite_package.go b/i18n4go/cmds/rewrite_package.go index 48993ca..cdc38f9 100644 --- a/i18n4go/cmds/rewrite_package.go +++ b/i18n4go/cmds/rewrite_package.go @@ -29,6 +29,7 @@ import ( "github.com/go-bindata/go-bindata/v3" "github.com/maximilien/i18n4go/i18n4go/common" + "github.com/maximilien/i18n4go/i18n4go/i18n" "github.com/spf13/cobra" @@ -85,7 +86,7 @@ func NewRewritePackage(options *common.Options) *rewritePackage { if options.IgnoreRegexpFlag != "" { compiledReg, err := regexp.Compile(options.IgnoreRegexpFlag) if err != nil { - fmt.Println("WARNING compiling ignore-regexp:", err) + fmt.Println(i18n.T("WARNING compiling ignore-regexp:"), err) } compiledRegexp = compiledReg } @@ -112,23 +113,23 @@ func NewRewritePackage(options *common.Options) *rewritePackage { func NewRewritePackageCommand(options *common.Options) *cobra.Command { rewritePackageCmd := &cobra.Command{ Use: "rewrite-package", - Short: "Rewrite translated packages from go source files", + Short: i18n.T("Rewrite translated packages from go source files"), RunE: func(cmd *cobra.Command, args []string) error { return NewRewritePackage(options).Run() }, } - rewritePackageCmd.Flags().BoolVar(&options.PoFlag, "po", false, "generate standard .po file for translation") - rewritePackageCmd.Flags().BoolVarP(&options.RecurseFlag, "recursive", "r", false, "recursively rewrite packages from all files in the same directory as filename or dirName") + rewritePackageCmd.Flags().BoolVar(&options.PoFlag, "po", false, i18n.T("generate standard .po file for translation")) + rewritePackageCmd.Flags().BoolVarP(&options.RecurseFlag, "recursive", "r", false, i18n.T("recursively rewrite packages from all files in the same directory as filename or dirName")) - rewritePackageCmd.Flags().StringVarP(&options.FilenameFlag, "file", "f", "", "the source go file to be rewritten") - rewritePackageCmd.Flags().StringVarP(&options.DirnameFlag, "directory", "d", "", "the dir name for which all .go files will have their strings extracted") - rewritePackageCmd.Flags().StringVar(&options.I18nStringsFilenameFlag, "i18n-strings-filename", "", "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command") - rewritePackageCmd.Flags().StringVar(&options.I18nStringsDirnameFlag, "i18n-strings-dirname", "", "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name") - rewritePackageCmd.Flags().StringVarP(&options.OutputDirFlag, "output", "o", "", "output directory where the translation files will be placed") - rewritePackageCmd.Flags().StringVar(&options.RootPathFlag, "root-path", "", "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified") - rewritePackageCmd.Flags().StringVar(&options.InitCodeSnippetFilenameFlag, "init-code-snippet-filename", "", "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization") - rewritePackageCmd.Flags().StringVar(&options.IgnoreRegexpFlag, "ignore-regexp", ".*test.*", "a perl-style regular expression for files to ignore, e.g., \".*test.*\"") + rewritePackageCmd.Flags().StringVarP(&options.FilenameFlag, "file", "f", "", i18n.T("the source go file to be rewritten")) + rewritePackageCmd.Flags().StringVarP(&options.DirnameFlag, "directory", "d", "", i18n.T("the dir name for which all .go files will have their strings extracted")) + rewritePackageCmd.Flags().StringVar(&options.I18nStringsFilenameFlag, "i18n-strings-filename", "", i18n.T("a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command")) + rewritePackageCmd.Flags().StringVar(&options.I18nStringsDirnameFlag, "i18n-strings-dirname", "", i18n.T("a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name")) + rewritePackageCmd.Flags().StringVarP(&options.OutputDirFlag, "output", "o", "", i18n.T("output directory where the translation files will be placed")) + rewritePackageCmd.Flags().StringVar(&options.RootPathFlag, "root-path", "", i18n.T("the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified")) + rewritePackageCmd.Flags().StringVar(&options.InitCodeSnippetFilenameFlag, "init-code-snippet-filename", "", i18n.T("[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization")) + rewritePackageCmd.Flags().StringVar(&options.IgnoreRegexpFlag, "ignore-regexp", ".*test.*", i18n.T("a perl-style regular expression for files to ignore, e.g., \".*test.*\"")) return rewritePackageCmd } @@ -173,8 +174,8 @@ func (rp *rewritePackage) Run() error { } rp.Println() - rp.Println("Total files parsed:", rp.TotalFiles) - rp.Println("Total rewritten strings:", rp.TotalStrings) + rp.Println(i18n.T("Total files parsed:"), rp.TotalFiles) + rp.Println(i18n.T("Total rewritten strings:"), rp.TotalStrings) return nil } @@ -216,7 +217,7 @@ func (rp *rewritePackage) loadStringsToBeTranslated(fileName string) error { } func (rp *rewritePackage) processDir(dirName string, recursive bool) error { - rp.Printf("i18n4go: rewriting strings in dir %s, recursive: %t\n", dirName, recursive) + rp.Printf(i18n.T("i18n4go: rewriting strings in dir {{.Arg0}}, recursive: {{.Arg1}}\n", map[string]interface{}{"Arg0": dirName, "Arg1": recursive})) rp.Println() fileInfos, _ := ioutil.ReadDir(dirName) @@ -235,9 +236,9 @@ func (rp *rewritePackage) processDir(dirName string, recursive bool) error { rp.I18nStringsFilename = filepath.Join(rp.I18nStringsDirname, i18nFilename) rp.I18nStringsFilePaths = append(rp.I18nStringsFilePaths, rp.I18nStringsFilename) - rp.Printf("i18n4go: loading JSON strings from file: %s\n", rp.I18nStringsFilename) + rp.Printf(i18n.T("i18n4go: loading JSON strings from file: {{.Arg0}}\n", map[string]interface{}{"Arg0": rp.I18nStringsFilename})) if err := rp.loadStringsToBeTranslated(rp.I18nStringsFilename); err != nil { - rp.Println("i18n4go: WARNING could not find JSON file:", rp.I18nStringsFilename, err.Error()) + rp.Println(i18n.T("i18n4go: WARNING could not find JSON file:"), rp.I18nStringsFilename, err.Error()) rp.resetProcessing() continue } @@ -273,7 +274,7 @@ func (rp *rewritePackage) ignoreFile(fileName string) bool { func (rp *rewritePackage) processFilename(fileName string) error { rp.TotalFiles += 1 - rp.Println("i18n4go: rewriting strings for source file:", fileName) + rp.Println(i18n.T("i18n4go: rewriting strings for source file:"), fileName) fileSet := token.NewFileSet() @@ -289,13 +290,13 @@ func (rp *rewritePackage) processFilename(fileName string) error { } if strings.HasSuffix(fileName, "_test.go") { - rp.Println("cowardly refusing to translate the strings in test file:", fileName) + rp.Println(i18n.T("cowardly refusing to translate the strings in test file:"), fileName) return nil } importPath, err := rp.determineImportPath(absFilePath) if err != nil { - rp.Println("i18n4go: error determining the import path:", err.Error()) + rp.Println(i18n.T("i18n4go: error determining the import path:"), err.Error()) return err } @@ -310,20 +311,20 @@ func (rp *rewritePackage) processFilename(fileName string) error { outputDir := filepath.Join(rp.OutputDirname, filepath.Dir(rp.relativePathForFile(fileName))) err = rp.addInitFuncToPackage(astFile.Name.Name, outputDir, importPath) if err != nil { - rp.Println("i18n4go: error adding init() func to package:", err.Error()) + rp.Println(i18n.T("i18n4go: error adding init() func to package:"), err.Error()) return err } err = rp.insertTFuncCall(astFile) if err != nil { - rp.Println("i18n4go: error appending T() to AST file:", err.Error()) + rp.Println(i18n.T("i18n4go: error appending i18n.T() to AST file:"), err.Error()) return err } relativeFilePath := rp.relativePathForFile(fileName) err = rp.saveASTFile(relativeFilePath, fileName, astFile, fileSet) if err != nil { - rp.Println("i18n4go: error saving AST file:", err.Error()) + rp.Println(i18n.T("i18n4go: error saving AST file:"), err.Error()) return err } @@ -331,7 +332,7 @@ func (rp *rewritePackage) processFilename(fileName string) error { i18nStringInfos := common.I18nStringInfoMapValues2Array(rp.UpdatedExtractedStrings) err := common.SaveI18nStringInfos(rp, rp.Options(), i18nStringInfos, rp.I18nStringsFilename) if err != nil { - rp.Println("i18n4go: error saving updated i18n strings file:", err.Error()) + rp.Println(i18n.T("i18n4go: error saving updated i18n strings file:"), err.Error()) return err } } @@ -346,36 +347,36 @@ func (rp *rewritePackage) determineImportPath(filePath string) (string, error) { otherPkgImportPath string ) if rp.options.RootPathFlag == "" { - rp.Println("i18n4go: using the PWD as the rootPath:", os.Getenv("PWD")) + rp.Println(i18n.T("i18n4go: using the PWD as the rootPath:"), os.Getenv("PWD")) rp.RootPath = os.Getenv("PWD") } - rp.Println("i18n4go: determining import path using root path:", rp.RootPath) + rp.Println(i18n.T("i18n4go: determining import path using root path:"), rp.RootPath) pkg, err := build.Default.ImportDir(rp.RootPath, build.ImportMode(1)) if err != nil { - rp.Println("i18n4go: error getting root path import:", err.Error()) + rp.Println(i18n.T("i18n4go: error getting root path import:"), err.Error()) return "", err } if build.IsLocalImport(pkg.ImportPath) { pkgImportPath = pkg.Dir - rp.Printf("i18n4go: got a local import %s so using %s instead for root pkg", pkg.ImportPath, pkg.Dir) + rp.Printf(i18n.T("i18n4go: got a local import {{.Arg0}} so using {{.Arg1}} instead for root pkg", map[string]interface{}{"Arg0": pkg.ImportPath, "Arg1": pkg.Dir})) } else { pkgImportPath = pkg.ImportPath - rp.Println("i18n4go: got a root pkg with import path:", pkg.ImportPath) + rp.Println(i18n.T("i18n4go: got a root pkg with import path:"), pkg.ImportPath) } otherPkg, err := build.Default.ImportDir(dirName, build.ImportMode(0)) if err != nil { - rp.Println("i18n4go: error getting root path import:", err.Error()) + rp.Println(i18n.T("i18n4go: error getting root path import:"), err.Error()) return "", err } if build.IsLocalImport(otherPkg.ImportPath) { otherPkgImportPath = otherPkg.Dir - rp.Printf("i18n4go: got a local import %s so using %s instead for pkg", otherPkg.ImportPath, otherPkg.Dir) + rp.Printf(i18n.T("i18n4go: got a local import {{.Arg0}} so using {{.Arg1}} instead for pkg", map[string]interface{}{"Arg0": otherPkg.ImportPath, "Arg1": otherPkg.Dir})) } else { otherPkgImportPath = otherPkg.ImportPath - rp.Println("i18n4go: got a pkg with import:", otherPkg.ImportPath) + rp.Println(i18n.T("i18n4go: got a pkg with import:"), otherPkg.ImportPath) } importPath := otherPkgImportPath @@ -383,13 +384,13 @@ func (rp *rewritePackage) determineImportPath(filePath string) (string, error) { if strings.HasPrefix(importPath, "/") { importPath = strings.TrimLeft(importPath, "/") } - rp.Println("i18n4go: using import path as:", importPath) + rp.Println(i18n.T("i18n4go: using import path as:"), importPath) return importPath, nil } func (rp *rewritePackage) insertTFuncCall(astFile *ast.File) error { - rp.Println("i18n4go: inserting T() calls for strings that need to be translated") + rp.Println(i18n.T("i18n4go: inserting i18n.T() calls for strings that need to be translated")) var declarations []ast.Decl if len(astFile.Imports) > 0 { declarations = astFile.Decls[1:] @@ -639,7 +640,7 @@ func (rp *rewritePackage) wrapBasicLitWithT(basicLit *ast.BasicLit) ast.Expr { } func (rp *rewritePackage) addInitFuncToPackage(packageName, outputDir, importPath string) error { - rp.Println("i18n4go: adding init func to package:", packageName, " to output dir:", outputDir) + rp.Println(i18n.T("i18n4go: adding init func to package:"), packageName, i18n.T(" to output dir:"), outputDir) common.CreateOutputDirsIfNeeded(outputDir) @@ -659,7 +660,7 @@ func (rp *rewritePackage) getInitFuncCodeSnippetContent(packageName, importPath if rp.InitCodeSnippetFilename != "" { bytes, err := ioutil.ReadFile(rp.InitCodeSnippetFilename) if err != nil { - rp.Printf("i18n4go: error reading content of init code snippet file: %s\n, using default", rp.InitCodeSnippetFilename) + rp.Printf(i18n.T("i18n4go: error reading content of init code snippet file: {{.Arg0}}\n, using default", map[string]interface{}{"Arg0": rp.InitCodeSnippetFilename})) } else { snippetContent = string(bytes) } @@ -684,7 +685,7 @@ func (rp *rewritePackage) saveASTFile(relativeFilePath, fileName string, astFile common.CreateOutputDirsIfNeeded(filepath.Dir(pathToFile)) - rp.Println("saving file to path", pathToFile) + rp.Println(i18n.T("saving file to path"), pathToFile) ioutil.WriteFile(pathToFile, buffer.Bytes(), fileInfo.Mode()) return nil diff --git a/i18n4go/cmds/show_missing_strings.go b/i18n4go/cmds/show_missing_strings.go index cf7d476..5253c3a 100644 --- a/i18n4go/cmds/show_missing_strings.go +++ b/i18n4go/cmds/show_missing_strings.go @@ -29,6 +29,7 @@ import ( "github.com/spf13/cobra" "github.com/maximilien/i18n4go/i18n4go/common" + "github.com/maximilien/i18n4go/i18n4go/i18n" ) type showMissingStrings struct { @@ -53,14 +54,14 @@ func NewShowMissingStrings(options *common.Options) *showMissingStrings { func NewShowMissingStringsCommand(options *common.Options) *cobra.Command { showMissingStringsCmd := &cobra.Command{ Use: "show-missing-strings", - Short: "Shows missing strings in translations", + Short: i18n.T("Shows missing strings in translations"), RunE: func(cmd *cobra.Command, args []string) error { return NewShowMissingStrings(options).Run() }, } - showMissingStringsCmd.Flags().StringVarP(&options.DirnameFlag, "directory", "d", "", "the directory containing the go files to validate") - showMissingStringsCmd.Flags().StringVar(&options.I18nStringsFilenameFlag, "i18n-strings-filename", "", "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command") + showMissingStringsCmd.Flags().StringVarP(&options.DirnameFlag, "directory", "d", "", i18n.T("the directory containing the go files to validate")) + showMissingStringsCmd.Flags().StringVar(&options.I18nStringsFilenameFlag, "i18n-strings-filename", "", i18n.T("a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command")) // TODO: setup options and params for Cobra command here using common.Options @@ -142,7 +143,7 @@ func (sms *showMissingStrings) inspectFile(filename string) error { } if strings.HasPrefix(fileInfo.Name(), ".") || !strings.HasSuffix(fileInfo.Name(), ".go") { - sms.Println("WARNING ignoring file:", absFilePath) + sms.Println(i18n.T("WARNING ignoring file:"), absFilePath) return nil } @@ -170,7 +171,7 @@ func (sms *showMissingStrings) extractString(f *ast.File, fset *token.FileSet, f panic(err.Error()) } - sms.Println("Adding to translated strings:", translatedString) + sms.Println(i18n.T("Adding to translated strings:"), translatedString) sms.TranslatedStrings = append(sms.TranslatedStrings, filename+": "+translatedString) } } @@ -188,13 +189,13 @@ func (sms *showMissingStrings) showMissingTranslatedStrings() error { missingStrings := false for _, codeString := range sms.TranslatedStrings { if !sms.stringInStringInfos(codeString, sms.I18nStringInfos) { - fmt.Println("Missing:", codeString) + fmt.Println(i18n.T("Missing:"), codeString) missingStrings = true } } if missingStrings { - return errors.New("Missing Strings!") + return errors.New(i18n.T("Missing Strings!")) } return nil @@ -209,7 +210,7 @@ func (sms *showMissingStrings) stringInStringInfos(str string, list []common.I18 _, translatedStr := splitFilePathAndString(str) for _, stringInfo := range list { if translatedStr == stringInfo.ID { - sms.Println("Found", stringInfo.ID, "UNDER", str) + sms.Println(i18n.T("Found"), stringInfo.ID, i18n.T("UNDER"), str) return true } } @@ -222,12 +223,12 @@ func (sms *showMissingStrings) showExtraStrings() error { additionalStrings := false for _, stringInfo := range sms.I18nStringInfos { if !stringInTranslatedStrings(stringInfo.ID, sms.TranslatedStrings) { - fmt.Println("Additional:", stringInfo.ID) + fmt.Println(i18n.T("Additional:"), stringInfo.ID) additionalStrings = true } } if additionalStrings { - return errors.New("Additional Strings!") + return errors.New(i18n.T("Additional Strings!")) } return nil } diff --git a/i18n4go/cmds/verify_strings.go b/i18n4go/cmds/verify_strings.go index b4ea639..28d01ee 100644 --- a/i18n4go/cmds/verify_strings.go +++ b/i18n4go/cmds/verify_strings.go @@ -20,6 +20,7 @@ import ( "strings" "github.com/maximilien/i18n4go/i18n4go/common" + "github.com/maximilien/i18n4go/i18n4go/i18n" "github.com/spf13/cobra" ) @@ -51,17 +52,17 @@ func NewVerifyStrings(options *common.Options) *verifyStrings { func NewVerifyStringsCommand(options *common.Options) *cobra.Command { verifyStringsCmd := &cobra.Command{ Use: "verify-strings", - Short: "Verify strings in translations", + Short: i18n.T("Verify strings in translations"), RunE: func(cmd *cobra.Command, args []string) error { return NewVerifyStrings(options).Run() }, } - verifyStringsCmd.Flags().StringVarP(&options.SourceLanguageFlag, "source-language", "s", "en", "the source language of the file, typically also part of the file name, e.g., \"en_US\"") - verifyStringsCmd.Flags().StringVar(&options.LanguagesFlag, "languages", "", "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"") - verifyStringsCmd.Flags().StringVar(&options.LanguageFilesFlag, "language-files", "", `a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\" if not specified then the languages flag is used to find target files in same directory as source`) - verifyStringsCmd.Flags().StringVarP(&options.OutputDirFlag, "output", "o", "", "the output directory where the missing translation keys will be placed") - verifyStringsCmd.Flags().StringVarP(&options.FilenameFlag, "file", "f", "", "the source translation file") + verifyStringsCmd.Flags().StringVarP(&options.SourceLanguageFlag, "source-language", "s", "en", i18n.T("the source language of the file, typically also part of the file name, e.g., \"en_US\"")) + verifyStringsCmd.Flags().StringVar(&options.LanguagesFlag, "languages", "", i18n.T("a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"")) + verifyStringsCmd.Flags().StringVar(&options.LanguageFilesFlag, "language-files", "", i18n.T(`a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\" if not specified then the languages flag is used to find target files in same directory as source`)) + verifyStringsCmd.Flags().StringVarP(&options.OutputDirFlag, "output", "o", "", i18n.T("the output directory where the missing translation keys will be placed")) + verifyStringsCmd.Flags().StringVarP(&options.FilenameFlag, "file", "f", "", i18n.T("the source translation file")) return verifyStringsCmd } @@ -88,16 +89,16 @@ func (vs *verifyStrings) Printf(msg string, a ...interface{}) (int, error) { func (vs *verifyStrings) Run() error { fileName, filePath, err := common.CheckFile(vs.InputFilename) if err != nil { - vs.Println("i18n4go: Error checking input filename: ", vs.InputFilename) + vs.Println(i18n.T("i18n4go: Error checking input filename: "), vs.InputFilename) return err } targetFilenames := vs.determineTargetFilenames(fileName, filePath) - vs.Println("targetFilenames:", targetFilenames) + vs.Println(i18n.T("targetFilenames:"), targetFilenames) for _, targetFilename := range targetFilenames { err = vs.verify(vs.InputFilename, targetFilename) if err != nil { - vs.Println("i18n4go: Error verifying target filename: ", targetFilename) + vs.Println(i18n.T("i18n4go: Error verifying target filename: "), targetFilename) } } @@ -124,22 +125,22 @@ func (vs *verifyStrings) verify(inputFilename string, targetFilename string) err inputI18nStringInfos, err := common.LoadI18nStringInfos(inputFilename) if err != nil { - vs.Println("i18n4go: Error loading the i18n strings from input filename:", inputFilename) + vs.Println(i18n.T("i18n4go: Error loading the i18n strings from input filename:"), inputFilename) return err } if len(inputI18nStringInfos) == 0 { - return fmt.Errorf("i18n4go: Error input file: %s is empty", inputFilename) + return fmt.Errorf(i18n.T("i18n4go: Error input file: {{.Arg0}} is empty", map[string]interface{}{"Arg0": inputFilename})) } inputMap, err := common.CreateI18nStringInfoMap(inputI18nStringInfos) if err != nil { - return fmt.Errorf("File has duplicated key: %s\n%s", inputFilename, err) + return fmt.Errorf(i18n.T("File has duplicated key: {{.Arg0}}\n{{.Arg1}}", map[string]interface{}{"Arg0": inputFilename, "Arg1": err})) } targetI18nStringInfos, err := common.LoadI18nStringInfos(targetFilename) if err != nil { - vs.Println("i18n4go: Error loading the i18n strings from target filename:", targetFilename) + vs.Println(i18n.T("i18n4go: Error loading the i18n strings from target filename:"), targetFilename) return err } @@ -147,51 +148,51 @@ func (vs *verifyStrings) verify(inputFilename string, targetFilename string) err for _, stringInfo := range targetI18nStringInfos { if _, ok := inputMap[stringInfo.ID]; ok { if common.IsTemplatedString(stringInfo.ID) && vs.isTemplatedStringTranslationInvalid(stringInfo) { - vs.Println("i18n4go: WARNING target file has invalid templated translations with key ID: ", stringInfo.ID) + vs.Println(i18n.T("i18n4go: WARNING target file has invalid templated translations with key ID: "), stringInfo.ID) targetInvalidStringInfos = append(targetInvalidStringInfos, stringInfo) } delete(inputMap, stringInfo.ID) } else { - vs.Println("i18n4go: WARNING target file has extra key with ID: ", stringInfo.ID) + vs.Println(i18n.T("i18n4go: WARNING target file has extra key with ID: "), stringInfo.ID) targetExtraStringInfos = append(targetExtraStringInfos, stringInfo) } } var verficationError error if len(targetExtraStringInfos) > 0 { - vs.Println("i18n4go: WARNING target file contains total of extra keys:", len(targetExtraStringInfos)) + vs.Println(i18n.T("i18n4go: WARNING target file contains total of extra keys:"), len(targetExtraStringInfos)) diffFilename, err := vs.generateExtraKeysDiffFile(targetExtraStringInfos, targetFilename) if err != nil { - vs.Println("i18n4go: ERROR could not create the diff file:", err) + vs.Println(i18n.T("i18n4go: ERROR could not create the diff file:"), err) return err } - vs.Println("i18n4go: generated diff file:", diffFilename) - verficationError = fmt.Errorf("i18n4go: target file has extra i18n strings with IDs: %s", strings.Join(keysForI18nStringInfos(targetExtraStringInfos), ",")) + vs.Println(i18n.T("i18n4go: generated diff file:"), diffFilename) + verficationError = fmt.Errorf(i18n.T("i18n4go: target file has extra i18n strings with IDs: {{.Arg0}}", map[string]interface{}{"Arg0": strings.Join(keysForI18nStringInfos(targetExtraStringInfos), ",")})) } if len(targetInvalidStringInfos) > 0 { - vs.Println("i18n4go: WARNING target file contains total of invalid translations:", len(targetInvalidStringInfos)) + vs.Println(i18n.T("i18n4go: WARNING target file contains total of invalid translations:"), len(targetInvalidStringInfos)) diffFilename, err := vs.generateInvalidTranslationDiffFile(targetInvalidStringInfos, targetFilename) if err != nil { - vs.Println("i18n4go: ERROR could not create the diff file:", err) + vs.Println(i18n.T("i18n4go: ERROR could not create the diff file:"), err) return err } - vs.Println("i18n4go: generated diff file:", diffFilename) - verficationError = fmt.Errorf("i18n4go: target file has invalid i18n strings with IDs: %s", strings.Join(keysForI18nStringInfos(targetInvalidStringInfos), ",")) + vs.Println(i18n.T("i18n4go: generated diff file:"), diffFilename) + verficationError = fmt.Errorf(i18n.T("i18n4go: target file has invalid i18n strings with IDs: {{.Arg0}}", map[string]interface{}{"Arg0": strings.Join(keysForI18nStringInfos(targetInvalidStringInfos), ",")})) } if len(inputMap) > 0 { - vs.Println("i18n4go: ERROR input file does not match target file:", targetFilename) + vs.Println(i18n.T("i18n4go: ERROR input file does not match target file:"), targetFilename) diffFilename, err := vs.generateMissingKeysDiffFile(valuesForI18nStringInfoMap(inputMap), targetFilename) if err != nil { - vs.Println("i18n4go: ERROR could not create the diff file:", err) + vs.Println(i18n.T("i18n4go: ERROR could not create the diff file:"), err) return err } - vs.Println("i18n4go: generated diff file:", diffFilename) - verficationError = fmt.Errorf("i18n4go: target file is missing i18n strings with IDs: %s", strings.Join(keysForI18nStringInfoMap(inputMap), ",")) + vs.Println(i18n.T("i18n4go: generated diff file:"), diffFilename) + verficationError = fmt.Errorf(i18n.T("i18n4go: target file is missing i18n strings with IDs: {{.Arg0}}", map[string]interface{}{"Arg0": strings.Join(keysForI18nStringInfoMap(inputMap), ",")})) } return verficationError @@ -217,7 +218,7 @@ func (vs *verifyStrings) isTemplatedStringTranslationInvalid(stringInfo common.I } if len(missingArgs) > 0 { - vs.Println("i18n4go: templated string is invalid, missing args in translation:", strings.Join(missingArgs, ",")) + vs.Println(i18n.T("i18n4go: templated string is invalid, missing args in translation:"), strings.Join(missingArgs, ",")) return true } diff --git a/i18n4go/cmds/version.go b/i18n4go/cmds/version.go index bc9c16c..eece7b3 100644 --- a/i18n4go/cmds/version.go +++ b/i18n4go/cmds/version.go @@ -3,6 +3,7 @@ package cmds import ( "fmt" + "github.com/maximilien/i18n4go/i18n4go/i18n" "github.com/spf13/cobra" ) @@ -14,11 +15,11 @@ var GitRevision string func NewVersionCommand(p *I18NParams) *cobra.Command { versionCmd := &cobra.Command{ Use: "version", - Short: "Show the version of the i18n client", + Short: i18n.T("Show the version of the i18n client"), RunE: func(cmd *cobra.Command, args []string) error { - fmt.Printf("Version: %s\n", Version) - fmt.Printf("Build Date: %s\n", BuildDate) - fmt.Printf("Git Revision: %s\n", GitRevision) + fmt.Printf(i18n.T("Version: {{.Arg0}}\n", map[string]interface{}{"Arg0": Version})) + fmt.Printf(i18n.T("Build Date: {{.Arg0}}\n", map[string]interface{}{"Arg0": BuildDate})) + fmt.Printf(i18n.T("Git Revision: {{.Arg0}}\n", map[string]interface{}{"Arg0": GitRevision})) return nil }, } diff --git a/i18n4go/common/ast.go b/i18n4go/common/ast.go index df298ee..a6c9381 100644 --- a/i18n4go/common/ast.go +++ b/i18n4go/common/ast.go @@ -19,6 +19,8 @@ import ( "fmt" "go/ast" + + "github.com/maximilien/i18n4go/i18n4go/i18n" ) func ImportsForASTFile(astFile *ast.File) (*ast.GenDecl, error) { @@ -33,5 +35,5 @@ func ImportsForASTFile(astFile *ast.File) (*ast.GenDecl, error) { } } - return nil, errors.New(fmt.Sprintf("Could not find imports for root node:\n\t%#v\n", astFile)) + return nil, errors.New(fmt.Sprintf(i18n.T("Could not find imports for root node:\n\t{{.Arg0}}v\n", map[string]interface{}{"Arg0": astFile}))) } diff --git a/i18n4go/common/common.go b/i18n4go/common/common.go index d35f901..c2c0b12 100644 --- a/i18n4go/common/common.go +++ b/i18n4go/common/common.go @@ -28,6 +28,8 @@ import ( "path/filepath" "encoding/json" + + "github.com/maximilien/i18n4go/i18n4go/i18n" ) const ( @@ -66,7 +68,7 @@ func CheckFile(fileName string) (string, string, error) { } if !fileInfo.Mode().IsRegular() { - return "", "", fmt.Errorf("i18n4go: Non-regular source file %s (%s)\n", fileInfo.Name(), fileInfo.Mode().String()) + return "", "", fmt.Errorf(i18n.T("i18n4go: Non-regular source file {{.Arg0}} ({{.Arg1}})\n", map[string]interface{}{"Arg0": fileInfo.Name(), "Arg1": fileInfo.Mode().String()})) } return filepath.Base(fileName), filepath.Dir(fileName), nil @@ -153,7 +155,7 @@ func SaveStrings(printer PrinterInterface, options Options, stringInfos map[stri outputFilename := filepath.Join(outputDirname, fileName[strings.LastIndex(fileName, string(os.PathSeparator))+1:len(fileName)]) if len(stringInfos) != 0 { - printer.Println("Saving extracted i18n strings to file:", outputFilename) + printer.Println(i18n.T("Saving extracted i18n strings to file:"), outputFilename) } if !options.DryRunFlag && len(i18nStringInfos) != 0 { @@ -172,7 +174,7 @@ func SaveStrings(printer PrinterInterface, options Options, stringInfos map[stri func SaveStringsInPo(printer PrinterInterface, options Options, stringInfos map[string]StringInfo, outputDirname string, fileName string) error { if len(stringInfos) != 0 { - printer.Println("Creating and saving i18n strings to .po file:", fileName) + printer.Println(i18n.T("Creating and saving i18n strings to .po file:"), fileName) } if !options.DryRunFlag && len(stringInfos) != 0 { @@ -203,7 +205,7 @@ func SaveStringsInPo(printer PrinterInterface, options Options, stringInfos map[ } func SaveI18nStringsInPo(printer PrinterInterface, options Options, i18nStrings []I18nStringInfo, fileName string) error { - printer.Println("i18n4go: creating and saving i18n strings to .po file:", fileName) + printer.Println(i18n.T("i18n4go: creating and saving i18n strings to .po file:"), fileName) if !options.DryRunFlag && len(i18nStrings) != 0 { file, err := os.Create(fileName) @@ -269,7 +271,7 @@ func CreateI18nStringInfoMap(i18nStringInfos []I18nStringInfo) (map[string]I18nS if _, ok := inputMap[i18nStringInfo.ID]; !ok { inputMap[i18nStringInfo.ID] = i18nStringInfo } else { - return nil, errors.New("Duplicated key found: " + i18nStringInfo.ID) + return nil, errors.New(i18n.T("Duplicated key found: ") + i18nStringInfo.ID) } } @@ -290,7 +292,7 @@ func CopyI18nStringInfoMap(i18nStringInfoMap map[string]I18nStringInfo) map[stri func GetTemplatedStringArgs(aString string) []string { re, err := getTemplatedStringRegexp() if err != nil { - fmt.Printf("i18n4go: Error compiling templated string Regexp: %s\n", err.Error()) + fmt.Printf(i18n.T("i18n4go: Error compiling templated string Regexp: {{.Arg0}}\n", map[string]interface{}{"Arg0": err.Error()})) return []string{} } @@ -308,7 +310,7 @@ func GetTemplatedStringArgs(aString string) []string { func IsTemplatedString(aString string) bool { re, err := getTemplatedStringRegexp() if err != nil { - fmt.Printf("i18n4go: Error compiling templated string Regexp: %s\n", err.Error()) + fmt.Printf(i18n.T("i18n4go: Error compiling templated string Regexp: {{.Arg0}}\n", map[string]interface{}{"Arg0": err.Error()})) return false } @@ -318,7 +320,7 @@ func IsTemplatedString(aString string) bool { func IsInterpolatedString(aString string) bool { re, err := getInterpolatedStringRegexp() if err != nil { - fmt.Printf("i18n4go: Error compiling interpolated string Regexp: %s\n", err.Error()) + fmt.Printf(i18n.T("i18n4go: Error compiling interpolated string Regexp: {{.Arg0}}\n", map[string]interface{}{"Arg0": err.Error()})) return false } @@ -332,7 +334,7 @@ func ConvertToTemplatedString(aString string) string { re, err := getInterpolatedStringRegexp() if err != nil { - fmt.Printf("i18n4go: Error compiling interpolated string Regexp: %s\n", err.Error()) + fmt.Printf(i18n.T("i18n4go: Error compiling interpolated string Regexp: {{.Arg0}}\n", map[string]interface{}{"Arg0": err.Error()})) return "" } @@ -379,7 +381,7 @@ func GetIgnoreRegexp(ignoreRegexp string) (compiledRegexp *regexp.Regexp) { if ignoreRegexp != "" { reg, err := regexp.Compile(ignoreRegexp) if err != nil { - fmt.Println("WARNING: fail to compile ignore-regexp:", err) + fmt.Println(i18n.T("WARNING: fail to compile ignore-regexp:"), err) } compiledRegexp = reg } diff --git a/i18n4go/i18n/i18n_init.go b/i18n4go/i18n/i18n_init.go new file mode 100644 index 0000000..62e6a8b --- /dev/null +++ b/i18n4go/i18n/i18n_init.go @@ -0,0 +1,9 @@ +package i18n + +var T TranslateFunc + +func init() { + T = Init("", GetResourcesPath(), func(asset string) ([]byte, error) { + return Asset(asset) + }) +} diff --git a/i18n4go/i18n/i18n_init.go.template b/i18n4go/i18n/i18n_init.go.template index 2c91a19..b64076b 100644 --- a/i18n4go/i18n/i18n_init.go.template +++ b/i18n4go/i18n/i18n_init.go.template @@ -9,5 +9,7 @@ import ( var T goi18n.TranslateFunc func init() { - T = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath()) + T = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath(), func(asset string) ([]byte, error) { + return Asset(asset) + }) } diff --git a/i18n4go/i18n/i18n_resources.go b/i18n4go/i18n/i18n_resources.go new file mode 100644 index 0000000..c8e154f --- /dev/null +++ b/i18n4go/i18n/i18n_resources.go @@ -0,0 +1,948 @@ +// Code generated for package i18n by go-bindata DO NOT EDIT. (@generated) +// sources: +// i18n4go/i18n/resources/all.en_US.json +package i18n + +import ( + "fmt" + "io/ioutil" + "os" + "path/filepath" + "strings" + "time" +) + +type asset struct { + bytes []byte + info os.FileInfo +} + +type bindataFileInfo struct { + name string + size int64 + mode os.FileMode + modTime time.Time +} + +// Name return file name +func (fi bindataFileInfo) Name() string { + return fi.name +} + +// Size return file size +func (fi bindataFileInfo) Size() int64 { + return fi.size +} + +// Mode return file mode +func (fi bindataFileInfo) Mode() os.FileMode { + return fi.mode +} + +// Mode return file modify time +func (fi bindataFileInfo) ModTime() time.Time { + return fi.modTime +} + +// IsDir return file whether a directory +func (fi bindataFileInfo) IsDir() bool { + return fi.mode&os.ModeDir != 0 +} + +// Sys return file is sys mode +func (fi bindataFileInfo) Sys() interface{} { + return nil +} + +var _i18n4goI18nResourcesAllEn_usJson = []byte(`[ + { + "id": "i18n4go: Error compiling interpolated string Regexp: {{.Arg0}}\n", + "translation": "i18n4go: Error compiling interpolated string Regexp: {{.Arg0}}\n" + }, + { + "id": "i18n4go: error reading content of init code snippet file: {{.Arg0}}\n, using default", + "translation": "i18n4go: error reading content of init code snippet file: {{.Arg0}}\n, using default" + }, + { + "id": "verbose mode where lots of output is generated during execution", + "translation": "verbose mode where lots of output is generated during execution" + }, + { + "id": "i18n4go: rewriting strings for source file:", + "translation": "i18n4go: rewriting strings for source file:" + }, + { + "id": "generated files are created in the specified output directory", + "translation": "generated files are created in the specified output directory" + }, + { + "id": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", + "translation": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified" + }, + { + "id": "i18n4go: Error checking input filename: ", + "translation": "i18n4go: Error checking input filename: " + }, + { + "id": "i18n4go: attempting to use Google Translate to translate source strings in: ", + "translation": "i18n4go: attempting to use Google Translate to translate source strings in: " + }, + { + "id": "i18n4go: WARNING target file contains total of invalid translations:", + "translation": "i18n4go: WARNING target file contains total of invalid translations:" + }, + { + "id": "src", + "translation": "src" + }, + { + "id": "i18n4go: error invoking Google Translate for string:", + "translation": "i18n4go: error invoking Google Translate for string:" + }, + { + "id": "i18n4go: Could not show missing strings, err:", + "translation": "i18n4go: Could not show missing strings, err:" + }, + { + "id": "i18n4go: creating and saving i18n strings to .po file:", + "translation": "i18n4go: creating and saving i18n strings to .po file:" + }, + { + "id": "i18n4go: ERROR invoking Google Translate: ", + "translation": "i18n4go: ERROR invoking Google Translate: " + }, + { + "id": "Verify strings in translations", + "translation": "Verify strings in translations" + }, + { + "id": "i18n4go: Could not successfully rewrite package, err:", + "translation": "i18n4go: Could not successfully rewrite package, err:" + }, + { + "id": "i18n4go: scanning file: ", + "translation": "i18n4go: scanning file: " + }, + { + "id": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", + "translation": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name" + }, + { + "id": "i18n4go: inspecting dir {{.Arg0}}, recursive: {{.Arg1}}\n", + "translation": "i18n4go: inspecting dir {{.Arg0}}, recursive: {{.Arg1}}\n" + }, + { + "id": "Removing these strings from the %s translation file:\n", + "translation": "Removing these strings from the %s translation file:\n" + }, + { + "id": "Total time:", + "translation": "Total time:" + }, + { + "id": "i18n4go: could not load i18n strings from file: {{.Arg0}}", + "translation": "i18n4go: could not load i18n strings from file: {{.Arg0}}" + }, + { + "id": "the source go file to be rewritten", + "translation": "the source go file to be rewritten" + }, + { + "id": "the output directory where the missing translation keys will be placed", + "translation": "the output directory where the missing translation keys will be placed" + }, + { + "id": "ERROR opening file", + "translation": "ERROR opening file" + }, + { + "id": "Updating the following strings from the %s translation file:\n", + "translation": "Updating the following strings from the %s translation file:\n" + }, + { + "id": "Total files parsed:", + "translation": "Total files parsed:" + }, + { + "id": "Adding to translated strings:", + "translation": "Adding to translated strings:" + }, + { + "id": "prints the usage", + "translation": "prints the usage" + }, + { + "id": "i18n4go: generated diff file:", + "translation": "i18n4go: generated diff file:" + }, + { + "id": "output directory where the translation files will be placed", + "translation": "output directory where the translation files will be placed" + }, + { + "id": "\"{{.Arg0}}\" exists in {{.Arg1}}, but not in {{.Arg2}}\n", + "translation": "\"{{.Arg0}}\" exists in {{.Arg1}}, but not in {{.Arg2}}\n" + }, + { + "id": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", + "translation": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command" + }, + { + "id": "UNDER", + "translation": "UNDER" + }, + { + "id": "i18n4go: saving combined language file: ", + "translation": "i18n4go: saving combined language file: " + }, + { + "id": "Shows missing strings in translations", + "translation": "Shows missing strings in translations" + }, + { + "id": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "translation": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation" + }, + { + "id": "saving file to path", + "translation": "saving file to path" + }, + { + "id": "i18n4go: loading JSON strings from file: {{.Arg0}}\n", + "translation": "i18n4go: loading JSON strings from file: {{.Arg0}}\n" + }, + { + "id": "Couldn't find any source strings: {{.Arg0}}", + "translation": "Couldn't find any source strings: {{.Arg0}}" + }, + { + "id": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", + "translation": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup" + }, + { + "id": "cowardly refusing to translate the strings in test file:", + "translation": "cowardly refusing to translate the strings in test file:" + }, + { + "id": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "translation": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source" + }, + { + "id": "General purpose tool for i18n", + "translation": "General purpose tool for i18n" + }, + { + "id": "i18n4go: got a local import {{.Arg0}} so using {{.Arg1}} instead for pkg", + "translation": "i18n4go: got a local import {{.Arg0}} so using {{.Arg1}} instead for pkg" + }, + { + "id": "i18n4go: could not save Google Translate i18n strings to file: {{.Arg0}}", + "translation": "i18n4go: could not save Google Translate i18n strings to file: {{.Arg0}}" + }, + { + "id": "i18n4go: error determining the import path:", + "translation": "i18n4go: error determining the import path:" + }, + { + "id": "i18n4go: could not create default translation file for language: {{.Arg0}}\nerr:{{.Arg1}}", + "translation": "i18n4go: could not create default translation file for language: {{.Arg0}}\nerr:{{.Arg1}}" + }, + { + "id": "Could not load i18n asset: {{.Arg0}}", + "translation": "Could not load i18n asset: {{.Arg0}}" + }, + { + "id": "i18n4go: rewriting strings in dir {{.Arg0}}, recursive: {{.Arg1}}\n", + "translation": "i18n4go: rewriting strings in dir {{.Arg0}}, recursive: {{.Arg1}}\n" + }, + { + "id": "i18n4go: error saving updated i18n strings file:", + "translation": "i18n4go: error saving updated i18n strings file:" + }, + { + "id": "targetFilenames:", + "translation": "targetFilenames:" + }, + { + "id": "i18n4go: got a root pkg with import path:", + "translation": "i18n4go: got a root pkg with import path:" + }, + { + "id": "i18n4go: Could not extract strings, err:", + "translation": "i18n4go: Could not extract strings, err:" + }, + { + "id": "i18n4go: target file has invalid i18n strings with IDs: {{.Arg0}}", + "translation": "i18n4go: target file has invalid i18n strings with IDs: {{.Arg0}}" + }, + { + "id": "i18n4go: created default translation file:", + "translation": "i18n4go: created default translation file:" + }, + { + "id": "recursively extract strings from all files in the same directory as filename or dirName", + "translation": "recursively extract strings from all files in the same directory as filename or dirName" + }, + { + "id": "Duplicated key found: ", + "translation": "Duplicated key found: " + }, + { + "id": "WARNING compiling ignore-regexp:", + "translation": "WARNING compiling ignore-regexp:" + }, + { + "id": "Couldn't get the strings from {{.Arg0}}: {{.Arg1}}", + "translation": "Couldn't get the strings from {{.Arg0}}: {{.Arg1}}" + }, + { + "id": "Loaded {{.Arg0}} excluded regexps", + "translation": "Loaded {{.Arg0}} excluded regexps" + }, + { + "id": "Extracting strings in package:", + "translation": "Extracting strings in package:" + }, + { + "id": "Creates the transation files", + "translation": "Creates the transation files" + }, + { + "id": "Loaded {{.Arg0}} excluded strings", + "translation": "Loaded {{.Arg0}} excluded strings" + }, + { + "id": "i18n4go: could not save PO file: {{.Arg0}}", + "translation": "i18n4go: could not save PO file: {{.Arg0}}" + }, + { + "id": "i18n4go: Error loading the i18n strings from input filename:", + "translation": "i18n4go: Error loading the i18n strings from input filename:" + }, + { + "id": "WARNING running in -dry-run mode", + "translation": "WARNING running in -dry-run mode" + }, + { + "id": "i18n4go: adding init func to package:", + "translation": "i18n4go: adding init func to package:" + }, + { + "id": "Merge translation strings", + "translation": "Merge translation strings" + }, + { + "id": " to output dir:", + "translation": " to output dir:" + }, + { + "id": "i18n4go: Error input file: {{.Arg0}} is empty", + "translation": "i18n4go: Error input file: {{.Arg0}} is empty" + }, + { + "id": "i18n4go: Could not verify strings for input filename, err:", + "translation": "i18n4go: Could not verify strings for input filename, err:" + }, + { + "id": "Found", + "translation": "Found" + }, + { + "id": "i18n4go: creating translation file copy for language:", + "translation": "i18n4go: creating translation file copy for language:" + }, + { + "id": "i18n4go: Non-regular source file {{.Arg0}} ({{.Arg1}})\n", + "translation": "i18n4go: Non-regular source file {{.Arg0}} ({{.Arg1}})\n" + }, + { + "id": "Show the version of the i18n client", + "translation": "Show the version of the i18n client" + }, + { + "id": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", + "translation": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file" + }, + { + "id": "generate standard .po file for translation", + "translation": "generate standard .po file for translation" + }, + { + "id": "i18n4go: ERROR could not create the diff file:", + "translation": "i18n4go: ERROR could not create the diff file:" + }, + { + "id": "Missing Strings!", + "translation": "Missing Strings!" + }, + { + "id": "i18n4go: WARNING target file contains total of extra keys:", + "translation": "i18n4go: WARNING target file contains total of extra keys:" + }, + { + "id": "Extracted {{.Arg0}} strings from file: {{.Arg1}}\n", + "translation": "Extracted {{.Arg0}} strings from file: {{.Arg1}}\n" + }, + { + "id": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", + "translation": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"" + }, + { + "id": "i18n4go: could not create translation file for language: {{.Arg0}} with Google Translate", + "translation": "i18n4go: could not create translation file for language: {{.Arg0}} with Google Translate" + }, + { + "id": "i18n4go: created translation file with Google Translate:", + "translation": "i18n4go: created translation file with Google Translate:" + }, + { + "id": "i18n4go: could not extract strings from directory:", + "translation": "i18n4go: could not extract strings from directory:" + }, + { + "id": "OK", + "translation": "OK" + }, + { + "id": "i18n4go: error adding init() func to package:", + "translation": "i18n4go: error adding init() func to package:" + }, + { + "id": "i18n4go: creating translation file:", + "translation": "i18n4go: creating translation file:" + }, + { + "id": "i18n4go: ERROR parsing Google Translate response body", + "translation": "i18n4go: ERROR parsing Google Translate response body" + }, + { + "id": "Could not find imports for root node:\n\t{{.Arg0}}v\n", + "translation": "Could not find imports for root node:\n\t{{.Arg0}}v\n" + }, + { + "id": "No match for ignore-regexp:", + "translation": "No match for ignore-regexp:" + }, + { + "id": "Checks the transated files", + "translation": "Checks the transated files" + }, + { + "id": "i18n4go: extracting strings from file:", + "translation": "i18n4go: extracting strings from file:" + }, + { + "id": "the JSON file with strings to be excluded, defaults to excluded.json if present", + "translation": "the JSON file with strings to be excluded, defaults to excluded.json if present" + }, + { + "id": "i18n4go: WARNING could not find JSON file:", + "translation": "i18n4go: WARNING could not find JSON file:" + }, + { + "id": "i18n4go: input file: {{.Arg0}} is empty", + "translation": "i18n4go: input file: {{.Arg0}} is empty" + }, + { + "id": "the source translation file", + "translation": "the source translation file" + }, + { + "id": "the file name for which strings are extracted", + "translation": "the file name for which strings are extracted" + }, + { + "id": "Add, update, or remove translation keys from source files and resources files", + "translation": "Add, update, or remove translation keys from source files and resources files" + }, + { + "id": "Invalid response.", + "translation": "Invalid response." + }, + { + "id": "i18n4go: got a pkg with import:", + "translation": "i18n4go: got a pkg with import:" + }, + { + "id": "[optional] the excluded JSON file name, all strings there will be excluded", + "translation": "[optional] the excluded JSON file name, all strings there will be excluded" + }, + { + "id": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", + "translation": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name" + }, + { + "id": "i18n4go: templated string is invalid, missing args in translation:", + "translation": "i18n4go: templated string is invalid, missing args in translation:" + }, + { + "id": "An unexpected type of error", + "translation": "An unexpected type of error" + }, + { + "id": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "translation": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source" + }, + { + "id": "Using ignore-regexp:", + "translation": "Using ignore-regexp:" + }, + { + "id": "Creating and saving i18n strings to .po file:", + "translation": "Creating and saving i18n strings to .po file:" + }, + { + "id": "Rewrite translated packages from go source files", + "translation": "Rewrite translated packages from go source files" + }, + { + "id": "recursively rewrite packages from all files in the same directory as filename or dirName", + "translation": "recursively rewrite packages from all files in the same directory as filename or dirName" + }, + { + "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"" + }, + { + "id": "Capturing substrings in file:", + "translation": "Capturing substrings in file:" + }, + { + "id": "i18n4go: Could not create translation files, err:", + "translation": "i18n4go: Could not create translation files, err:" + }, + { + "id": "Total rewritten strings:", + "translation": "Total rewritten strings:" + }, + { + "id": "WARNING No capturing group found in {{.Arg0}}", + "translation": "WARNING No capturing group found in {{.Arg0}}" + }, + { + "id": "Version: {{.Arg0}}\n", + "translation": "Version: {{.Arg0}}\n" + }, + { + "id": "WARNING ignoring file:", + "translation": "WARNING ignoring file:" + }, + { + "id": "Missing:", + "translation": "Missing:" + }, + { + "id": "Total extracted strings:", + "translation": "Total extracted strings:" + }, + { + "id": "WARNING: fail to compile ignore-regexp:", + "translation": "WARNING: fail to compile ignore-regexp:" + }, + { + "id": "i18n4go: using import path as:", + "translation": "i18n4go: using import path as:" + }, + { + "id": "i18n4go: creating translation files for:", + "translation": "i18n4go: creating translation files for:" + }, + { + "id": "Excluding regexps in file:", + "translation": "Excluding regexps in file:" + }, + { + "id": "Strings don't match", + "translation": "Strings don't match" + }, + { + "id": "prevents any output files from being created", + "translation": "prevents any output files from being created" + }, + { + "id": "generated files are created in directory to match the package name", + "translation": "generated files are created in directory to match the package name" + }, + { + "id": "Git Revision: {{.Arg0}}\n", + "translation": "Git Revision: {{.Arg0}}\n" + }, + { + "id": "Extract the translation strings from go source files", + "translation": "Extract the translation strings from go source files" + }, + { + "id": "Saving extracted strings to file:", + "translation": "Saving extracted strings to file:" + }, + { + "id": "Could not find:", + "translation": "Could not find:" + }, + { + "id": "Excluding strings in file:", + "translation": "Excluding strings in file:" + }, + { + "id": "i18n4go: target file is missing i18n strings with IDs: {{.Arg0}}", + "translation": "i18n4go: target file is missing i18n strings with IDs: {{.Arg0}}" + }, + { + "id": "Saving extracted i18n strings to file:", + "translation": "Saving extracted i18n strings to file:" + }, + { + "id": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", + "translation": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"" + }, + { + "id": "WARNING error compiling regexp:", + "translation": "WARNING error compiling regexp:" + }, + { + "id": "i18n4go: Could not merge strings, err:", + "translation": "i18n4go: Could not merge strings, err:" + }, + { + "id": "Additional Strings!", + "translation": "Additional Strings!" + }, + { + "id": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "translation": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation" + }, + { + "id": "i18n4go: error saving AST file:", + "translation": "i18n4go: error saving AST file:" + }, + { + "id": "i18n4go: got a local import {{.Arg0}} so using {{.Arg1}} instead for root pkg", + "translation": "i18n4go: got a local import {{.Arg0}} so using {{.Arg1}} instead for root pkg" + }, + { + "id": "Fixup the transation files", + "translation": "Fixup the transation files" + }, + { + "id": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", + "translation": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization" + }, + { + "id": "i18n4go: ERROR input file does not match target file:", + "translation": "i18n4go: ERROR input file does not match target file:" + }, + { + "id": "the dir name for which all .go files will have their strings extracted", + "translation": "the dir name for which all .go files will have their strings extracted" + }, + { + "id": "Build Date: {{.Arg0}}\n", + "translation": "Build Date: {{.Arg0}}\n" + }, + { + "id": "i18n4go: inserting i18n.T() calls for strings that need to be translated", + "translation": "i18n4go: inserting i18n.T() calls for strings that need to be translated" + }, + { + "id": "Loaded {{.Arg0}} substring regexps", + "translation": "Loaded {{.Arg0}} substring regexps" + }, + { + "id": "Extracted total of {{.Arg0}} strings\n\n", + "translation": "Extracted total of {{.Arg0}} strings\n\n" + }, + { + "id": "Select the number for the previous translation:", + "translation": "Select the number for the previous translation:" + }, + { + "id": "Additional:", + "translation": "Additional:" + }, + { + "id": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", + "translation": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)" + }, + { + "id": "the code", + "translation": "the code" + }, + { + "id": "i18n4go: Error verifying target filename: ", + "translation": "i18n4go: Error verifying target filename: " + }, + { + "id": "i18n4go: WARNING target file has extra key with ID: ", + "translation": "i18n4go: WARNING target file has extra key with ID: " + }, + { + "id": "the output directory where the newly created translation files will be placed", + "translation": "the output directory where the newly created translation files will be placed" + }, + { + "id": "i18n4go: Error compiling templated string Regexp: {{.Arg0}}\n", + "translation": "i18n4go: Error compiling templated string Regexp: {{.Arg0}}\n" + }, + { + "id": "i18n4go: Could not checkup, err:", + "translation": "i18n4go: Could not checkup, err:" + }, + { + "id": "Couldn't find the english strings: {{.Arg0}}", + "translation": "Couldn't find the english strings: {{.Arg0}}" + }, + { + "id": "i18n4go: error appending i18n.T() to AST file:", + "translation": "i18n4go: error appending i18n.T() to AST file:" + }, + { + "id": "i18n4go: WARNING target file has invalid templated translations with key ID: ", + "translation": "i18n4go: WARNING target file has invalid templated translations with key ID: " + }, + { + "id": "Unable to find english translation files", + "translation": "Unable to find english translation files" + }, + { + "id": "Adding these strings to the %s translation file:\n", + "translation": "Adding these strings to the %s translation file:\n" + }, + { + "id": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", + "translation": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command" + }, + { + "id": "i18n4go: error getting root path import:", + "translation": "i18n4go: error getting root path import:" + }, + { + "id": "the directory containing the go files to validate", + "translation": "the directory containing the go files to validate" + }, + { + "id": "Canceling fixup", + "translation": "Canceling fixup" + }, + { + "id": "[optional] the qualifier string that is used when using the i18n.T(...) function, default to nothing but could be set to ` + "`" + `i18n` + "`" + ` so that all calls would be: i18n.T(...)", + "translation": "[optional] the qualifier string that is used when using the i18n.T(...) function, default to nothing but could be set to ` + "`" + `i18n` + "`" + ` so that all calls would be: i18n.T(...)" + }, + { + "id": "i18n4go: could not create output directory: {{.Arg0}}", + "translation": "i18n4go: could not create output directory: {{.Arg0}}" + }, + { + "id": "Could not find an i18n file for locale: en_US", + "translation": "Could not find an i18n file for locale: en_US" + }, + { + "id": "Error when inspecting go file: ", + "translation": "Error when inspecting go file: " + }, + { + "id": "i18n4go: Error loading the i18n strings from target filename:", + "translation": "i18n4go: Error loading the i18n strings from target filename:" + }, + { + "id": "Is the string \"%s\" a new or updated string? [new/upd]\n", + "translation": "Is the string \"%s\" a new or updated string? [new/upd]\n" + }, + { + "id": "i18n4go: determining import path using root path:", + "translation": "i18n4go: determining import path using root path:" + }, + { + "id": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", + "translation": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t" + }, + { + "id": "{{.Arg0}}\nVersion {{.Arg1}}", + "translation": "{{.Arg0}}\nVersion {{.Arg1}}" + }, + { + "id": "i18n4go: Could not fixup, err:", + "translation": "i18n4go: Could not fixup, err:" + }, + { + "id": "File has duplicated key: {{.Arg0}}\n{{.Arg1}}", + "translation": "File has duplicated key: {{.Arg0}}\n{{.Arg1}}" + }, + { + "id": "i18n4go: target file has extra i18n strings with IDs: {{.Arg0}}", + "translation": "i18n4go: target file has extra i18n strings with IDs: {{.Arg0}}" + }, + { + "id": "i18n4go: using the PWD as the rootPath:", + "translation": "i18n4go: using the PWD as the rootPath:" + } +] +`) + +func i18n4goI18nResourcesAllEn_usJsonBytes() ([]byte, error) { + return _i18n4goI18nResourcesAllEn_usJson, nil +} + +func i18n4goI18nResourcesAllEn_usJson() (*asset, error) { + bytes, err := i18n4goI18nResourcesAllEn_usJsonBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "i18n4go/i18n/resources/all.en_US.json", size: 27145, mode: os.FileMode(420), modTime: time.Unix(1719593700, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +// Asset loads and returns the asset for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func Asset(name string) ([]byte, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) + } + return a.bytes, nil + } + return nil, fmt.Errorf("Asset %s not found", name) +} + +// MustAsset is like Asset but panics when Asset would return an error. +// It simplifies safe initialization of global variables. +func MustAsset(name string) []byte { + a, err := Asset(name) + if err != nil { + panic("asset: Asset(" + name + "): " + err.Error()) + } + + return a +} + +// AssetInfo loads and returns the asset info for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func AssetInfo(name string) (os.FileInfo, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) + } + return a.info, nil + } + return nil, fmt.Errorf("AssetInfo %s not found", name) +} + +// AssetNames returns the names of the assets. +func AssetNames() []string { + names := make([]string, 0, len(_bindata)) + for name := range _bindata { + names = append(names, name) + } + return names +} + +// _bindata is a table, holding each asset generator, mapped to its name. +var _bindata = map[string]func() (*asset, error){ + "i18n4go/i18n/resources/all.en_US.json": i18n4goI18nResourcesAllEn_usJson, +} + +// AssetDir returns the file names below a certain +// directory embedded in the file by go-bindata. +// For example if you run go-bindata on data/... and data contains the +// following hierarchy: +// +// data/ +// foo.txt +// img/ +// a.png +// b.png +// +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// AssetDir("") will return []string{"data"}. +func AssetDir(name string) ([]string, error) { + node := _bintree + if len(name) != 0 { + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") + for _, p := range pathList { + node = node.Children[p] + if node == nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + } + } + if node.Func != nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + rv := make([]string, 0, len(node.Children)) + for childName := range node.Children { + rv = append(rv, childName) + } + return rv, nil +} + +type bintree struct { + Func func() (*asset, error) + Children map[string]*bintree +} + +var _bintree = &bintree{nil, map[string]*bintree{ + "i18n4go": &bintree{nil, map[string]*bintree{ + "i18n": &bintree{nil, map[string]*bintree{ + "resources": &bintree{nil, map[string]*bintree{ + "all.en_US.json": &bintree{i18n4goI18nResourcesAllEn_usJson, map[string]*bintree{}}, + }}, + }}, + }}, +}} + +// RestoreAsset restores an asset under the given directory +func RestoreAsset(dir, name string) error { + data, err := Asset(name) + if err != nil { + return err + } + info, err := AssetInfo(name) + if err != nil { + return err + } + err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) + if err != nil { + return err + } + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + if err != nil { + return err + } + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil +} + +// RestoreAssets restores an asset under the given directory recursively +func RestoreAssets(dir, name string) error { + children, err := AssetDir(name) + // File + if err != nil { + return RestoreAsset(dir, name) + } + // Dir + for _, child := range children { + err = RestoreAssets(dir, filepath.Join(name, child)) + if err != nil { + return err + } + } + return nil +} + +func _filePath(dir, name string) string { + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) +} diff --git a/i18n4go/i18n/init.go b/i18n4go/i18n/init.go index 101a66f..3d6bddb 100644 --- a/i18n4go/i18n/init.go +++ b/i18n4go/i18n/init.go @@ -49,22 +49,19 @@ var SUPPORTED_LOCALES = map[string]string{ "zh": "zh_CN", } var ( - RESOUCES_PATH = filepath.Join("i18n", "resources") - bundle *go_i18n.Bundle + RESOURCES_PATH = filepath.Join("i18n4go", "i18n", "resources") + bundle *go_i18n.Bundle ) func GetResourcesPath() string { return RESOURCES_PATH } -func Init(packageName string, i18nDirname string) TranslateFunc { +func Init(packageName string, i18nDirname string, assetFn AssetFunc) TranslateFunc { if bundle == nil { bundle = go_i18n.NewBundle(language.AmericanEnglish) bundle.RegisterUnmarshalFunc("json", json.Unmarshal) } -} - -func Init(packageName string, i18nDirname string, assetFn AssetFunc) TranslateFunc { userLocale, err := initWithUserLocale(packageName, i18nDirname, assetFn) if err != nil { userLocale = mustLoadDefaultLocale(packageName, i18nDirname, assetFn) @@ -102,6 +99,10 @@ func initWithUserLocale(packageName, i18nDirname string, assetFn AssetFunc) (str func mustLoadDefaultLocale(packageName, i18nDirname string, assetFn AssetFunc) string { userLocale := DEFAULT_LOCALE + // REMOVEME: Do not commit + fmt.Printf("\npackageName: %s\n", packageName) + // REMOVEME: Do not commit + fmt.Printf("\ni18nDirname: %s\n", i18nDirname) err := loadFromAsset(packageName, i18nDirname, DEFAULT_LOCALE, DEFAULT_LANGUAGE, assetFn) if err != nil { panic("Could not load en_US language files. God save the queen. " + err.Error()) @@ -120,7 +121,7 @@ func loadFromAsset(packageName, assetPath, locale, language string, assetFn Asse } if len(byteArray) == 0 { - return fmt.Errorf("Could not load i18n asset: %v", assetKey) + return fmt.Errorf(T("Could not load i18n asset: {{.Arg0}}", map[string]interface{}{"Arg0": assetKey})) } tmpDir, err := ioutil.TempDir("", "i18n4go_res") @@ -198,11 +199,15 @@ func translate(loc *go_i18n.Localizer) TranslateFunc { } } - return loc.MustLocalize(&go_i18n.LocalizeConfig{ + msg, err := loc.Localize(&go_i18n.LocalizeConfig{ MessageID: messageId, TemplateData: data, PluralCount: count, }) + if err != nil { + return "" + } + return msg } } diff --git a/i18n4go/i18n/resources/all.en_US.json b/i18n4go/i18n/resources/all.en_US.json index 2ab7001..8d17025 100644 --- a/i18n4go/i18n/resources/all.en_US.json +++ b/i18n4go/i18n/resources/all.en_US.json @@ -1,1227 +1,722 @@ [ - { - "id": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", - "translation": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", - "modified": false - }, - { - "id": "\nusage: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -f \n or: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -d [-r] [--ignore-regexp ]\n\nusage: i18n4go -c rewrite-package [-v] [-r] -d [--i18n-strings-filename | --i18n-strings-dirname ] [--init-code-snippet-filename ] [--ignore-regexp ]\n or: i18n4go -c rewrite-package [-v] [-r] -f --i18n-strings-filename [--init-code-snippet-filename ] [--ignore-regexp ]\n\nusage: i18n4go -c create-translations [-v] [--google-translate-api-key ] [--source-language ] -f --languages -o \n\nusage: i18n4go -c merge-strings [-v] [-r] [--source-language ] -d \n\nusage: i18n4go -c verify-strings [-v] [--source-language ] -f --language-files [-o ]\n or: i18n4go -c verify-strings [-v] [--source-language ] -f --languages [-o ]\n\nusage: i18n4go -c show-missing-strings [-v] -d --i18n-strings-filename \n\nusage: i18n4go -c checkup\n\n -h | --help prints the usage\n -v verbose\n\n EXTRACT-STRINGS:\n\n -c extract-strings the extract strings command\n\n --po to generate standard .po files for translation\n -e [optional] the JSON file with strings to be excluded, defaults to excluded.json if present\n\t-s\t\t\t\t\t\t\t\t\t\t\t\t [optional] the JSON file with regexp that specify a capturing group to be extracted instead of the full string matching the regexp\n --meta [optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file\n --dry-run [optional] prevents any output files from being created\n\n\n --output-flat generated files are created in the specified output directory (default)\n --output-match-package generated files are created in directory to match the package name\n -o the output directory where the translation files will be placed\n\n -f the go file name to extract strings\n\n -d the directory containing the go files to extract strings\n\n -r [optional] recursesively extract strings from all subdirectories\n --ignore-regexp [optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n REWRITE-PACKAGE:\n\n -c rewrite-package the rewrite package command\n -f the source go file to be rewritten\n -d the directory containing the go files to rewrite\n\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n --i18n-strings-dirname a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name\n --root-path the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified\n\n --init-code-snippet-filename [optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization\"\n -o [optional] output diretory for rewritten file. If not specified, the original file will be overwritten\n\n --ignore-regexp\t\t[optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n MERGE STRINGS:\n\n -c merge-strings the merge strings command which merges multiple .go..json files into a .all.json\n\n -r [optional] recursesively combine files from all subdirectories\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \"en_US\" (default to 'en')\n\n -d the directory containing the json files to combine\n\n CREATE-TRANSLATIONS:\n\n -c create-translations the create translations command\n\n --google-translate-api-key [optional] your public Google Translate API key which is used to generate translations (charge is applicable)\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \\\"en_US\\\"\n\n -f the source translation file\n --languages a comma separated list of valid languages with optional territory, e.g., \\\"en, en_US, fr_FR, es\\\"\n -o the output directory where the newly created translation files will be placed\n\n VERIFY-STRINGS:\n\n -c verify-strings the verify strings command\n\n --source-language [optional] the source language of the source translation file (default to 'en')\n\n -f the source translation file\n\n --language-files a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\"\n if not specified then the languages flag is used to find target files in same directory as source\n --languages a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"\n\n -o the output directory where the missing translation keys will be placed\n\n SHOW-MISSING-STRINGS:\n\n -c show-missing-strings the missing strings command\n\n -d the directory containing the go files to validate\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n\n CHECKUP:\n\n -c checkup the checkup command which ensures that the strings in code match strings in resource files and vice versa\n -q the qualifier to use when calling the T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for T(...) function\n\n FIXUP:\n\n -c fixup the fixup command which interactively lets users add, update, or remove translations keys from code and resource files.\n", - "translation": "\nusage: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -f \n or: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -d [-r] [--ignore-regexp ]\n\nusage: i18n4go -c rewrite-package [-v] [-r] -d [--i18n-strings-filename | --i18n-strings-dirname ] [--init-code-snippet-filename ] [--ignore-regexp ]\n or: i18n4go -c rewrite-package [-v] [-r] -f --i18n-strings-filename [--init-code-snippet-filename ] [--ignore-regexp ]\n\nusage: i18n4go -c create-translations [-v] [--google-translate-api-key ] [--source-language ] -f --languages -o \n\nusage: i18n4go -c merge-strings [-v] [-r] [--source-language ] -d \n\nusage: i18n4go -c verify-strings [-v] [--source-language ] -f --language-files [-o ]\n or: i18n4go -c verify-strings [-v] [--source-language ] -f --languages [-o ]\n\nusage: i18n4go -c show-missing-strings [-v] -d --i18n-strings-filename \n\nusage: i18n4go -c checkup\n\n -h | --help prints the usage\n -v verbose\n\n EXTRACT-STRINGS:\n\n -c extract-strings the extract strings command\n\n --po to generate standard .po files for translation\n -e [optional] the JSON file with strings to be excluded, defaults to excluded.json if present\n\t-s\t\t\t\t\t\t\t\t\t\t\t\t [optional] the JSON file with regexp that specify a capturing group to be extracted instead of the full string matching the regexp\n --meta [optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file\n --dry-run [optional] prevents any output files from being created\n\n\n --output-flat generated files are created in the specified output directory (default)\n --output-match-package generated files are created in directory to match the package name\n -o the output directory where the translation files will be placed\n\n -f the go file name to extract strings\n\n -d the directory containing the go files to extract strings\n\n -r [optional] recursesively extract strings from all subdirectories\n --ignore-regexp [optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n REWRITE-PACKAGE:\n\n -c rewrite-package the rewrite package command\n -f the source go file to be rewritten\n -d the directory containing the go files to rewrite\n\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n --i18n-strings-dirname a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name\n --root-path the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified\n\n --init-code-snippet-filename [optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization\"\n -o [optional] output diretory for rewritten file. If not specified, the original file will be overwritten\n\n --ignore-regexp\t\t[optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n MERGE STRINGS:\n\n -c merge-strings the merge strings command which merges multiple .go..json files into a .all.json\n\n -r [optional] recursesively combine files from all subdirectories\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \"en_US\" (default to 'en')\n\n -d the directory containing the json files to combine\n\n CREATE-TRANSLATIONS:\n\n -c create-translations the create translations command\n\n --google-translate-api-key [optional] your public Google Translate API key which is used to generate translations (charge is applicable)\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \\\"en_US\\\"\n\n -f the source translation file\n --languages a comma separated list of valid languages with optional territory, e.g., \\\"en, en_US, fr_FR, es\\\"\n -o the output directory where the newly created translation files will be placed\n\n VERIFY-STRINGS:\n\n -c verify-strings the verify strings command\n\n --source-language [optional] the source language of the source translation file (default to 'en')\n\n -f the source translation file\n\n --language-files a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\"\n if not specified then the languages flag is used to find target files in same directory as source\n --languages a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"\n\n -o the output directory where the missing translation keys will be placed\n\n SHOW-MISSING-STRINGS:\n\n -c show-missing-strings the missing strings command\n\n -d the directory containing the go files to validate\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n\n CHECKUP:\n\n -c checkup the checkup command which ensures that the strings in code match strings in resource files and vice versa\n -q the qualifier to use when calling the T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for T(...) function\n\n FIXUP:\n\n -c fixup the fixup command which interactively lets users add, update, or remove translations keys from code and resource files.\n", - "modified": false - }, - { - "id": " to output dir:", - "translation": " to output dir:", - "modified": false - }, - { - "id": "\"%s\" exists in %s, but not in %s\n", - "translation": "\"%s\" exists in %s, but not in %s\n", - "modified": false - }, - { - "id": "%s\nVersion %s", - "translation": "%s\nVersion %s", - "modified": false - }, - { - "id": "&target=", - "translation": "&target=", - "modified": false - }, - { - "id": ".*test.*", - "translation": ".*test.*", - "modified": false - }, - { - "id": ".all.json", - "translation": ".all.json", - "modified": false - }, - { - "id": ".en.po", - "translation": ".en.po", - "modified": false - }, - { - "id": ".missing.diff.json", - "translation": ".missing.diff.json", - "modified": false - }, - { - "id": "Add, update, or remove translation keys from source files and resources files", - "translation": "Add, update, or remove translation keys from source files and resources files", - "modified": false - }, - { - "id": "Adding these strings to the %s translation file:\n", - "translation": "Adding these strings to the %s translation file:\n", - "modified": false - }, - { - "id": "Adding to translated strings:", - "translation": "Adding to translated strings:", - "modified": false - }, - { - "id": "Additional Strings!", - "translation": "Additional Strings!", - "modified": false - }, - { - "id": "Additional:", - "translation": "Additional:", - "modified": false - }, - { - "id": "An unexpected type of error", - "translation": "An unexpected type of error", - "modified": false - }, - { - "id": "Build Date: %s\n", - "translation": "Build Date: %s\n", - "modified": false - }, - { - "id": "Canceling fixup", - "translation": "Canceling fixup", - "modified": false - }, - { - "id": "Capturing substrings in file:", - "translation": "Capturing substrings in file:", - "modified": false - }, - { - "id": "Checks the transated files", - "translation": "Checks the transated files", - "modified": false - }, - { - "id": "Could not find an i18n file for locale: en_US", - "translation": "Could not find an i18n file for locale: en_US", - "modified": false - }, - { - "id": "Could not find imports for root node:\n\t%#v\n", - "translation": "Could not find imports for root node:\n\t%#v\n", - "modified": false - }, - { - "id": "Could not find:", - "translation": "Could not find:", - "modified": false - }, - { - "id": "Could not load en_US language files. God save the queen. ", - "translation": "Could not load en_US language files. God save the queen. ", - "modified": false - }, - { - "id": "Could not load i18n asset: %v", - "translation": "Could not load i18n asset: %v", - "modified": false - }, - { - "id": "Couldn't find any source strings: %s", - "translation": "Couldn't find any source strings: %s", - "modified": false - }, - { - "id": "Couldn't find the english strings: %s", - "translation": "Couldn't find the english strings: %s", - "modified": false - }, - { - "id": "Couldn't get the strings from %s: %s", - "translation": "Couldn't get the strings from %s: %s", - "modified": false - }, - { - "id": "Creates the transation files", - "translation": "Creates the transation files", - "modified": false - }, - { - "id": "Creating and saving i18n strings to .po file:", - "translation": "Creating and saving i18n strings to .po file:", - "modified": false - }, - { - "id": "Duplicated key found: ", - "translation": "Duplicated key found: ", - "modified": false - }, - { - "id": "ERROR opening file", - "translation": "ERROR opening file", - "modified": false - }, - { - "id": "Error when inspecting go file: ", - "translation": "Error when inspecting go file: ", - "modified": false - }, - { - "id": "Excluding regexps in file:", - "translation": "Excluding regexps in file:", - "modified": false - }, - { - "id": "Excluding strings in file:", - "translation": "Excluding strings in file:", - "modified": false - }, - { - "id": "Extract the translation strings from go source files", - "translation": "Extract the translation strings from go source files", - "modified": false - }, - { - "id": "Extracted %d strings from file: %s\n", - "translation": "Extracted %d strings from file: %s\n", - "modified": false - }, - { - "id": "Extracted total of %d strings\n\n", - "translation": "Extracted total of %d strings\n\n", - "modified": false - }, - { - "id": "Extracting strings in package:", - "translation": "Extracting strings in package:", - "modified": false - }, - { - "id": "File has duplicated key: %s\n%s", - "translation": "File has duplicated key: %s\n%s", - "modified": false - }, - { - "id": "Fixup the transation files", - "translation": "Fixup the transation files", - "modified": false - }, - { - "id": "Found", - "translation": "Found", - "modified": false - }, - { - "id": "General purpose tool for i18n", - "translation": "General purpose tool for i18n", - "modified": false - }, - { - "id": "Git Revision: %s\n", - "translation": "Git Revision: %s\n", - "modified": false - }, - { - "id": "Invalid response.", - "translation": "Invalid response.", - "modified": false - }, - { - "id": "Is the string \"%s\" a new or updated string? [new/upd]\n", - "translation": "Is the string \"%s\" a new or updated string? [new/upd]\n", - "modified": false - }, - { - "id": "Loaded %d excluded regexps", - "translation": "Loaded %d excluded regexps", - "modified": false - }, - { - "id": "Loaded %d excluded strings", - "translation": "Loaded %d excluded strings", - "modified": false - }, - { - "id": "Loaded %d substring regexps", - "translation": "Loaded %d substring regexps", - "modified": false - }, - { - "id": "Merge translation strings", - "translation": "Merge translation strings", - "modified": false - }, - { - "id": "Missing Strings!", - "translation": "Missing Strings!", - "modified": false - }, - { - "id": "Missing:", - "translation": "Missing:", - "modified": false - }, - { - "id": "No match for ignore-regexp:", - "translation": "No match for ignore-regexp:", - "modified": false - }, - { - "id": "OK", - "translation": "OK", - "modified": false - }, - { - "id": "PWD", - "translation": "PWD", - "modified": false - }, - { - "id": "Removing these strings from the %s translation file:\n", - "translation": "Removing these strings from the %s translation file:\n", - "modified": false - }, - { - "id": "Rewrite translated packages from go source files", - "translation": "Rewrite translated packages from go source files", - "modified": false - }, - { - "id": "Saving extracted i18n strings to file:", - "translation": "Saving extracted i18n strings to file:", - "modified": false - }, - { - "id": "Saving extracted strings to file:", - "translation": "Saving extracted strings to file:", - "modified": false - }, - { - "id": "Select the number for the previous translation:", - "translation": "Select the number for the previous translation:", - "modified": false - }, - { - "id": "Show the version of the i18n client", - "translation": "Show the version of the i18n client", - "modified": false - }, - { - "id": "Shows missing strings in translations", - "translation": "Shows missing strings in translations", - "modified": false - }, - { - "id": "Strings don't match", - "translation": "Strings don't match", - "modified": false - }, - { - "id": "Total extracted strings:", - "translation": "Total extracted strings:", - "modified": false - }, - { - "id": "Total files parsed:", - "translation": "Total files parsed:", - "modified": false - }, - { - "id": "Total rewritten strings:", - "translation": "Total rewritten strings:", - "modified": false - }, - { - "id": "Total time:", - "translation": "Total time:", - "modified": false - }, - { - "id": "UNDER", - "translation": "UNDER", - "modified": false - }, - { - "id": "Unable to find english translation files", - "translation": "Unable to find english translation files", - "modified": false - }, - { - "id": "Updating the following strings from the %s translation file:\n", - "translation": "Updating the following strings from the %s translation file:\n", - "modified": false - }, - { - "id": "Using ignore-regexp:", - "translation": "Using ignore-regexp:", - "modified": false - }, - { - "id": "Verify strings in translations", - "translation": "Verify strings in translations", - "modified": false - }, - { - "id": "Version: %s\n", - "translation": "Version: %s\n", - "modified": false - }, - { - "id": "WARNING No capturing group found in %s", - "translation": "WARNING No capturing group found in %s", - "modified": false - }, - { - "id": "WARNING compiling ignore-regexp:", - "translation": "WARNING compiling ignore-regexp:", - "modified": false - }, - { - "id": "WARNING error compiling regexp:", - "translation": "WARNING error compiling regexp:", - "modified": false - }, - { - "id": "WARNING ignoring file:", - "translation": "WARNING ignoring file:", - "modified": false - }, - { - "id": "WARNING running in -dry-run mode", - "translation": "WARNING running in -dry-run mode", - "modified": false - }, - { - "id": "WARNING: fail to compile ignore-regexp:", - "translation": "WARNING: fail to compile ignore-regexp:", - "modified": false - }, - { - "id": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", - "translation": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", - "modified": false - }, - { - "id": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", - "translation": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", - "modified": false - }, - { - "id": "[optional] the excluded JSON file name, all strings there will be excluded", - "translation": "[optional] the excluded JSON file name, all strings there will be excluded", - "modified": false - }, - { - "id": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", - "translation": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", - "modified": false - }, - { - "id": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)", - "translation": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)", - "modified": false - }, - { - "id": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", - "translation": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", - "modified": false - }, - { - "id": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", - "translation": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", - "modified": false - }, - { - "id": "_test.go", - "translation": "_test.go", - "modified": false - }, - { - "id": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", - "translation": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", - "modified": false - }, - { - "id": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", - "translation": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", - "modified": false - }, - { - "id": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", - "translation": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", - "modified": false - }, - { - "id": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", - "translation": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", - "modified": false - }, - { - "id": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", - "translation": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", - "modified": false - }, - { - "id": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", - "translation": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", - "modified": false - }, - { - "id": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", - "translation": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", - "modified": false - }, - { - "id": "capturing_group.json", - "translation": "capturing_group.json", - "modified": false - }, - { - "id": "cf", - "translation": "cf", - "modified": false - }, - { - "id": "checkup", - "translation": "checkup", - "modified": false - }, - { - "id": "cowardly refusing to translate the strings in test file:", - "translation": "cowardly refusing to translate the strings in test file:", - "modified": false - }, - { - "id": "create-translations", - "translation": "create-translations", - "modified": false - }, - { - "id": "de_DE", - "translation": "de_DE", - "modified": false - }, - { - "id": "directory", - "translation": "directory", - "modified": false - }, - { - "id": "dry-run", - "translation": "dry-run", - "modified": false - }, - { - "id": "en", - "translation": "en", - "modified": false - }, - { - "id": "en_US", - "translation": "en_US", - "modified": false - }, - { - "id": "es_ES", - "translation": "es_ES", - "modified": false - }, - { - "id": "exclude", - "translation": "exclude", - "modified": false - }, - { - "id": "excluded|json|all", - "translation": "excluded|json|all", - "modified": false - }, - { - "id": "exit", - "translation": "exit", - "modified": false - }, - { - "id": "extract-strings", - "translation": "extract-strings", - "modified": false - }, - { - "id": "extracted_strings.json", - "translation": "extracted_strings.json", - "modified": false - }, - { - "id": "file", - "translation": "file", - "modified": false - }, - { - "id": "filepath.Join(", - "translation": "filepath.Join(", - "modified": false - }, - { - "id": "fixup", - "translation": "fixup", - "modified": false - }, - { - "id": "fr_FR", - "translation": "fr_FR", - "modified": false - }, - { - "id": "generate standard .po file for translation", - "translation": "generate standard .po file for translation", - "modified": false - }, - { - "id": "generated files are created in directory to match the package name", - "translation": "generated files are created in directory to match the package name", - "modified": false - }, - { - "id": "generated files are created in the specified output directory", - "translation": "generated files are created in the specified output directory", - "modified": false - }, - { - "id": "google-translate-api-key", - "translation": "google-translate-api-key", - "modified": false - }, - { - "id": "i18n-strings-dirname", - "translation": "i18n-strings-dirname", - "modified": false - }, - { - "id": "i18n-strings-filename", - "translation": "i18n-strings-filename", - "modified": false - }, - { - "id": "i18n4go: Could not checkup, err:", - "translation": "i18n4go: Could not checkup, err:", - "modified": false - }, - { - "id": "i18n4go: Could not create translation files, err:", - "translation": "i18n4go: Could not create translation files, err:", - "modified": false - }, - { - "id": "i18n4go: Could not extract strings, err:", - "translation": "i18n4go: Could not extract strings, err:", - "modified": false - }, - { - "id": "i18n4go: Could not fixup, err:", - "translation": "i18n4go: Could not fixup, err:", - "modified": false - }, - { - "id": "i18n4go: Could not merge strings, err:", - "translation": "i18n4go: Could not merge strings, err:", - "modified": false - }, - { - "id": "i18n4go: Could not show missing strings, err:", - "translation": "i18n4go: Could not show missing strings, err:", - "modified": false - }, - { - "id": "i18n4go: Could not successfully rewrite package, err:", - "translation": "i18n4go: Could not successfully rewrite package, err:", - "modified": false - }, - { - "id": "i18n4go: Could not verify strings for input filename, err:", - "translation": "i18n4go: Could not verify strings for input filename, err:", - "modified": false - }, - { - "id": "i18n4go: ERROR could not create the diff file:", - "translation": "i18n4go: ERROR could not create the diff file:", - "modified": false - }, - { - "id": "i18n4go: ERROR input file does not match target file:", - "translation": "i18n4go: ERROR input file does not match target file:", - "modified": false - }, - { - "id": "i18n4go: ERROR invoking Google Translate: ", - "translation": "i18n4go: ERROR invoking Google Translate: ", - "modified": false - }, - { - "id": "i18n4go: ERROR parsing Google Translate response body", - "translation": "i18n4go: ERROR parsing Google Translate response body", - "modified": false - }, - { - "id": "i18n4go: Error checking input filename: ", - "translation": "i18n4go: Error checking input filename: ", - "modified": false - }, - { - "id": "i18n4go: Error compiling interpolated string Regexp: %s\n", - "translation": "i18n4go: Error compiling interpolated string Regexp: %s\n", - "modified": false - }, - { - "id": "i18n4go: Error compiling templated string Regexp: %s\n", - "translation": "i18n4go: Error compiling templated string Regexp: %s\n", - "modified": false - }, - { - "id": "i18n4go: Error input file: %s is empty", - "translation": "i18n4go: Error input file: %s is empty", - "modified": false - }, - { - "id": "i18n4go: Error loading the i18n strings from input filename:", - "translation": "i18n4go: Error loading the i18n strings from input filename:", - "modified": false - }, - { - "id": "i18n4go: Error loading the i18n strings from target filename:", - "translation": "i18n4go: Error loading the i18n strings from target filename:", - "modified": false - }, - { - "id": "i18n4go: Error verifying target filename: ", - "translation": "i18n4go: Error verifying target filename: ", - "modified": false - }, - { - "id": "i18n4go: Non-regular source file %s (%s)\n", - "translation": "i18n4go: Non-regular source file %s (%s)\n", - "modified": false - }, - { - "id": "i18n4go: WARNING could not find JSON file:", - "translation": "i18n4go: WARNING could not find JSON file:", - "modified": false - }, - { - "id": "i18n4go: WARNING target file contains total of extra keys:", - "translation": "i18n4go: WARNING target file contains total of extra keys:", - "modified": false - }, - { - "id": "i18n4go: WARNING target file contains total of invalid translations:", - "translation": "i18n4go: WARNING target file contains total of invalid translations:", - "modified": false - }, - { - "id": "i18n4go: WARNING target file has extra key with ID: ", - "translation": "i18n4go: WARNING target file has extra key with ID: ", - "modified": false - }, - { - "id": "i18n4go: WARNING target file has invalid templated translations with key ID: ", - "translation": "i18n4go: WARNING target file has invalid templated translations with key ID: ", - "modified": false - }, - { - "id": "i18n4go: adding init func to package:", - "translation": "i18n4go: adding init func to package:", - "modified": false - }, - { - "id": "i18n4go: attempting to use Google Translate to translate source strings in: ", - "translation": "i18n4go: attempting to use Google Translate to translate source strings in: ", - "modified": false - }, - { - "id": "i18n4go: could not create default translation file for language: %s\nerr:%s", - "translation": "i18n4go: could not create default translation file for language: %s\nerr:%s", - "modified": false - }, - { - "id": "i18n4go: could not create output directory: %s", - "translation": "i18n4go: could not create output directory: %s", - "modified": false - }, - { - "id": "i18n4go: could not create translation file for language: %s with Google Translate", - "translation": "i18n4go: could not create translation file for language: %s with Google Translate", - "modified": false - }, - { - "id": "i18n4go: could not extract strings from directory:", - "translation": "i18n4go: could not extract strings from directory:", - "modified": false - }, - { - "id": "i18n4go: could not load i18n strings from file: %s", - "translation": "i18n4go: could not load i18n strings from file: %s", - "modified": false - }, - { - "id": "i18n4go: could not save Google Translate i18n strings to file: %s", - "translation": "i18n4go: could not save Google Translate i18n strings to file: %s", - "modified": false - }, - { - "id": "i18n4go: could not save PO file: %s", - "translation": "i18n4go: could not save PO file: %s", - "modified": false - }, - { - "id": "i18n4go: created default translation file:", - "translation": "i18n4go: created default translation file:", - "modified": false - }, - { - "id": "i18n4go: created translation file with Google Translate:", - "translation": "i18n4go: created translation file with Google Translate:", - "modified": false - }, - { - "id": "i18n4go: creating and saving i18n strings to .po file:", - "translation": "i18n4go: creating and saving i18n strings to .po file:", - "modified": false - }, - { - "id": "i18n4go: creating translation file copy for language:", - "translation": "i18n4go: creating translation file copy for language:", - "modified": false - }, - { - "id": "i18n4go: creating translation file:", - "translation": "i18n4go: creating translation file:", - "modified": false - }, - { - "id": "i18n4go: creating translation files for:", - "translation": "i18n4go: creating translation files for:", - "modified": false - }, - { - "id": "i18n4go: determining import path using root path:", - "translation": "i18n4go: determining import path using root path:", - "modified": false - }, - { - "id": "i18n4go: error adding init() func to package:", - "translation": "i18n4go: error adding init() func to package:", - "modified": false - }, - { - "id": "i18n4go: error appending T() to AST file:", - "translation": "i18n4go: error appending T() to AST file:", - "modified": false - }, - { - "id": "i18n4go: error determining the import path:", - "translation": "i18n4go: error determining the import path:", - "modified": false - }, - { - "id": "i18n4go: error getting root path import:", - "translation": "i18n4go: error getting root path import:", - "modified": false - }, - { - "id": "i18n4go: error invoking Google Translate for string:", - "translation": "i18n4go: error invoking Google Translate for string:", - "modified": false - }, - { - "id": "i18n4go: error reading content of init code snippet file: %s\n, using default", - "translation": "i18n4go: error reading content of init code snippet file: %s\n, using default", - "modified": false - }, - { - "id": "i18n4go: error saving AST file:", - "translation": "i18n4go: error saving AST file:", - "modified": false - }, - { - "id": "i18n4go: error saving updated i18n strings file:", - "translation": "i18n4go: error saving updated i18n strings file:", - "modified": false - }, - { - "id": "i18n4go: extracting strings from file:", - "translation": "i18n4go: extracting strings from file:", - "modified": false - }, - { - "id": "i18n4go: generated diff file:", - "translation": "i18n4go: generated diff file:", - "modified": false - }, - { - "id": "i18n4go: got a local import %s so using %s instead for pkg", - "translation": "i18n4go: got a local import %s so using %s instead for pkg", - "modified": false - }, - { - "id": "i18n4go: got a local import %s so using %s instead for root pkg", - "translation": "i18n4go: got a local import %s so using %s instead for root pkg", - "modified": false - }, - { - "id": "i18n4go: got a pkg with import:", - "translation": "i18n4go: got a pkg with import:", - "modified": false - }, - { - "id": "i18n4go: got a root pkg with import path:", - "translation": "i18n4go: got a root pkg with import path:", - "modified": false - }, - { - "id": "i18n4go: input file: %s is empty", - "translation": "i18n4go: input file: %s is empty", - "modified": false - }, - { - "id": "i18n4go: inserting T() calls for strings that need to be translated", - "translation": "i18n4go: inserting T() calls for strings that need to be translated", - "modified": false - }, - { - "id": "i18n4go: inspecting dir %s, recursive: %t\n", - "translation": "i18n4go: inspecting dir %s, recursive: %t\n", - "modified": false - }, - { - "id": "i18n4go: loading JSON strings from file: %s\n", - "translation": "i18n4go: loading JSON strings from file: %s\n", - "modified": false - }, - { - "id": "i18n4go: rewriting strings for source file:", - "translation": "i18n4go: rewriting strings for source file:", - "modified": false - }, - { - "id": "i18n4go: rewriting strings in dir %s, recursive: %t\n", - "translation": "i18n4go: rewriting strings in dir %s, recursive: %t\n", - "modified": false - }, - { - "id": "i18n4go: saving combined language file: ", - "translation": "i18n4go: saving combined language file: ", - "modified": false - }, - { - "id": "i18n4go: scanning file: ", - "translation": "i18n4go: scanning file: ", - "modified": false - }, - { - "id": "i18n4go: target file has extra i18n strings with IDs: %s", - "translation": "i18n4go: target file has extra i18n strings with IDs: %s", - "modified": false - }, - { - "id": "i18n4go: target file has invalid i18n strings with IDs: %s", - "translation": "i18n4go: target file has invalid i18n strings with IDs: %s", - "modified": false - }, - { - "id": "i18n4go: target file is missing i18n strings with IDs: %s", - "translation": "i18n4go: target file is missing i18n strings with IDs: %s", - "modified": false - }, - { - "id": "i18n4go: templated string is invalid, missing args in translation:", - "translation": "i18n4go: templated string is invalid, missing args in translation:", - "modified": false - }, - { - "id": "i18n4go: using import path as:", - "translation": "i18n4go: using import path as:", - "modified": false - }, - { - "id": "i18n4go: using the PWD as the rootPath:", - "translation": "i18n4go: using the PWD as the rootPath:", - "modified": false - }, - { - "id": "i18n4go_res", - "translation": "i18n4go_res", - "modified": false - }, - { - "id": "i18n_init.go", - "translation": "i18n_init.go", - "modified": false - }, - { - "id": "ignore-regexp", - "translation": "ignore-regexp", - "modified": false - }, - { - "id": "init-code-snippet-filename", - "translation": "init-code-snippet-filename", - "modified": false - }, - { - "id": "it_IT", - "translation": "it_IT", - "modified": false - }, - { - "id": "ja_JA", - "translation": "ja_JA", - "modified": false - }, - { - "id": "ko_KO", - "translation": "ko_KO", - "modified": false - }, - { - "id": "language-files", - "translation": "language-files", - "modified": false - }, - { - "id": "languages", - "translation": "languages", - "modified": false - }, - { - "id": "merge-strings", - "translation": "merge-strings", - "modified": false - }, - { - "id": "meta", - "translation": "meta", - "modified": false - }, - { - "id": "new", - "translation": "new", - "modified": false - }, - { - "id": "output", - "translation": "output", - "modified": false - }, - { - "id": "output directory where the translation files will be placed", - "translation": "output directory where the translation files will be placed", - "modified": false - }, - { - "id": "output-flat", - "translation": "output-flat", - "modified": false - }, - { - "id": "output-match-package", - "translation": "output-match-package", - "modified": false - }, - { - "id": "package __PACKAGE__NAME__\n\nimport (\n\t\"path/filepath\"\n\n\ti18n \"github.com/maximilien/i18n4go/i18n\"\n)\n\nvar T i18n.TranslateFunc\n\nfunc init() {\n\tT = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath())\n}", - "translation": "package __PACKAGE__NAME__\n\nimport (\n\t\"path/filepath\"\n\n\ti18n \"github.com/maximilien/i18n4go/i18n\"\n)\n\nvar T i18n.TranslateFunc\n\nfunc init() {\n\tT = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath())\n}", - "modified": false - }, - { - "id": "po", - "translation": "po", - "modified": false - }, - { - "id": "prevents any output files from being created", - "translation": "prevents any output files from being created", - "modified": false - }, - { - "id": "prints the usage", - "translation": "prints the usage", - "modified": false - }, - { - "id": "pt_BR", - "translation": "pt_BR", - "modified": false - }, - { - "id": "qualifier", - "translation": "qualifier", - "modified": false - }, - { - "id": "recursive", - "translation": "recursive", - "modified": false - }, - { - "id": "recursively extract strings from all files in the same directory as filename or dirName", - "translation": "recursively extract strings from all files in the same directory as filename or dirName", - "modified": false - }, - { - "id": "recursively rewrite packages from all files in the same directory as filename or dirName", - "translation": "recursively rewrite packages from all files in the same directory as filename or dirName", - "modified": false - }, - { - "id": "resources", - "translation": "resources", - "modified": false - }, - { - "id": "rewrite-package", - "translation": "rewrite-package", - "modified": false - }, - { - "id": "root-path", - "translation": "root-path", - "modified": false - }, - { - "id": "ru_RU", - "translation": "ru_RU", - "modified": false - }, - { - "id": "saving file to path", - "translation": "saving file to path", - "modified": false - }, - { - "id": "show-missing-strings", - "translation": "show-missing-strings", - "modified": false - }, - { - "id": "source-language", - "translation": "source-language", - "modified": false - }, - { - "id": "src", - "translation": "src", - "modified": false - }, - { - "id": "string", - "translation": "string", - "modified": false - }, - { - "id": "substring-file", - "translation": "substring-file", - "modified": false - }, - { - "id": "targetFilenames:", - "translation": "targetFilenames:", - "modified": false - }, - { - "id": "the JSON file with strings to be excluded, defaults to excluded.json if present", - "translation": "the JSON file with strings to be excluded, defaults to excluded.json if present", - "modified": false - }, - { - "id": "the code", - "translation": "the code", - "modified": false - }, - { - "id": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", - "translation": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", - "modified": false - }, - { - "id": "the dir name for which all .go files will have their strings extracted", - "translation": "the dir name for which all .go files will have their strings extracted", - "modified": false - }, - { - "id": "the directory containing the go files to validate", - "translation": "the directory containing the go files to validate", - "modified": false - }, - { - "id": "the file name for which strings are extracted", - "translation": "the file name for which strings are extracted", - "modified": false - }, - { - "id": "the output directory where the missing translation keys will be placed", - "translation": "the output directory where the missing translation keys will be placed", - "modified": false - }, - { - "id": "the output directory where the newly created translation files will be placed", - "translation": "the output directory where the newly created translation files will be placed", - "modified": false - }, - { - "id": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", - "translation": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", - "modified": false - }, - { - "id": "the source go file to be rewritten", - "translation": "the source go file to be rewritten", - "modified": false - }, - { - "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", - "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", - "modified": false - }, - { - "id": "the source translation file", - "translation": "the source translation file", - "modified": false - }, - { - "id": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", - "translation": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", - "modified": false - }, - { - "id": "upd", - "translation": "upd", - "modified": false - }, - { - "id": "v1.4.0", - "translation": "v1.4.0", - "modified": false - }, - { - "id": "verbose", - "translation": "verbose", - "modified": false - }, - { - "id": "verbose mode where lots of output is generated during execution", - "translation": "verbose mode where lots of output is generated during execution", - "modified": false - }, - { - "id": "verify-strings", - "translation": "verify-strings", - "modified": false - }, - { - "id": "version", - "translation": "version", - "modified": false - }, - { - "id": "zh_CN", - "translation": "zh_CN", - "modified": false - } + { + "id": "i18n4go: Error compiling interpolated string Regexp: {{.Arg0}}\n", + "translation": "i18n4go: Error compiling interpolated string Regexp: {{.Arg0}}\n" + }, + { + "id": "i18n4go: error reading content of init code snippet file: {{.Arg0}}\n, using default", + "translation": "i18n4go: error reading content of init code snippet file: {{.Arg0}}\n, using default" + }, + { + "id": "verbose mode where lots of output is generated during execution", + "translation": "verbose mode where lots of output is generated during execution" + }, + { + "id": "i18n4go: rewriting strings for source file:", + "translation": "i18n4go: rewriting strings for source file:" + }, + { + "id": "generated files are created in the specified output directory", + "translation": "generated files are created in the specified output directory" + }, + { + "id": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", + "translation": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified" + }, + { + "id": "i18n4go: Error checking input filename: ", + "translation": "i18n4go: Error checking input filename: " + }, + { + "id": "i18n4go: attempting to use Google Translate to translate source strings in: ", + "translation": "i18n4go: attempting to use Google Translate to translate source strings in: " + }, + { + "id": "i18n4go: WARNING target file contains total of invalid translations:", + "translation": "i18n4go: WARNING target file contains total of invalid translations:" + }, + { + "id": "src", + "translation": "src" + }, + { + "id": "i18n4go: error invoking Google Translate for string:", + "translation": "i18n4go: error invoking Google Translate for string:" + }, + { + "id": "i18n4go: Could not show missing strings, err:", + "translation": "i18n4go: Could not show missing strings, err:" + }, + { + "id": "i18n4go: creating and saving i18n strings to .po file:", + "translation": "i18n4go: creating and saving i18n strings to .po file:" + }, + { + "id": "i18n4go: ERROR invoking Google Translate: ", + "translation": "i18n4go: ERROR invoking Google Translate: " + }, + { + "id": "Verify strings in translations", + "translation": "Verify strings in translations" + }, + { + "id": "i18n4go: Could not successfully rewrite package, err:", + "translation": "i18n4go: Could not successfully rewrite package, err:" + }, + { + "id": "i18n4go: scanning file: ", + "translation": "i18n4go: scanning file: " + }, + { + "id": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", + "translation": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name" + }, + { + "id": "i18n4go: inspecting dir {{.Arg0}}, recursive: {{.Arg1}}\n", + "translation": "i18n4go: inspecting dir {{.Arg0}}, recursive: {{.Arg1}}\n" + }, + { + "id": "Removing these strings from the %s translation file:\n", + "translation": "Removing these strings from the %s translation file:\n" + }, + { + "id": "Total time:", + "translation": "Total time:" + }, + { + "id": "i18n4go: could not load i18n strings from file: {{.Arg0}}", + "translation": "i18n4go: could not load i18n strings from file: {{.Arg0}}" + }, + { + "id": "the source go file to be rewritten", + "translation": "the source go file to be rewritten" + }, + { + "id": "the output directory where the missing translation keys will be placed", + "translation": "the output directory where the missing translation keys will be placed" + }, + { + "id": "ERROR opening file", + "translation": "ERROR opening file" + }, + { + "id": "Updating the following strings from the %s translation file:\n", + "translation": "Updating the following strings from the %s translation file:\n" + }, + { + "id": "Total files parsed:", + "translation": "Total files parsed:" + }, + { + "id": "Adding to translated strings:", + "translation": "Adding to translated strings:" + }, + { + "id": "prints the usage", + "translation": "prints the usage" + }, + { + "id": "i18n4go: generated diff file:", + "translation": "i18n4go: generated diff file:" + }, + { + "id": "output directory where the translation files will be placed", + "translation": "output directory where the translation files will be placed" + }, + { + "id": "\"{{.Arg0}}\" exists in {{.Arg1}}, but not in {{.Arg2}}\n", + "translation": "\"{{.Arg0}}\" exists in {{.Arg1}}, but not in {{.Arg2}}\n" + }, + { + "id": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", + "translation": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command" + }, + { + "id": "UNDER", + "translation": "UNDER" + }, + { + "id": "i18n4go: saving combined language file: ", + "translation": "i18n4go: saving combined language file: " + }, + { + "id": "Shows missing strings in translations", + "translation": "Shows missing strings in translations" + }, + { + "id": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "translation": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation" + }, + { + "id": "saving file to path", + "translation": "saving file to path" + }, + { + "id": "i18n4go: loading JSON strings from file: {{.Arg0}}\n", + "translation": "i18n4go: loading JSON strings from file: {{.Arg0}}\n" + }, + { + "id": "Couldn't find any source strings: {{.Arg0}}", + "translation": "Couldn't find any source strings: {{.Arg0}}" + }, + { + "id": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", + "translation": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup" + }, + { + "id": "cowardly refusing to translate the strings in test file:", + "translation": "cowardly refusing to translate the strings in test file:" + }, + { + "id": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "translation": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source" + }, + { + "id": "General purpose tool for i18n", + "translation": "General purpose tool for i18n" + }, + { + "id": "i18n4go: got a local import {{.Arg0}} so using {{.Arg1}} instead for pkg", + "translation": "i18n4go: got a local import {{.Arg0}} so using {{.Arg1}} instead for pkg" + }, + { + "id": "i18n4go: could not save Google Translate i18n strings to file: {{.Arg0}}", + "translation": "i18n4go: could not save Google Translate i18n strings to file: {{.Arg0}}" + }, + { + "id": "i18n4go: error determining the import path:", + "translation": "i18n4go: error determining the import path:" + }, + { + "id": "i18n4go: could not create default translation file for language: {{.Arg0}}\nerr:{{.Arg1}}", + "translation": "i18n4go: could not create default translation file for language: {{.Arg0}}\nerr:{{.Arg1}}" + }, + { + "id": "Could not load i18n asset: {{.Arg0}}", + "translation": "Could not load i18n asset: {{.Arg0}}" + }, + { + "id": "i18n4go: rewriting strings in dir {{.Arg0}}, recursive: {{.Arg1}}\n", + "translation": "i18n4go: rewriting strings in dir {{.Arg0}}, recursive: {{.Arg1}}\n" + }, + { + "id": "i18n4go: error saving updated i18n strings file:", + "translation": "i18n4go: error saving updated i18n strings file:" + }, + { + "id": "targetFilenames:", + "translation": "targetFilenames:" + }, + { + "id": "i18n4go: got a root pkg with import path:", + "translation": "i18n4go: got a root pkg with import path:" + }, + { + "id": "i18n4go: Could not extract strings, err:", + "translation": "i18n4go: Could not extract strings, err:" + }, + { + "id": "i18n4go: target file has invalid i18n strings with IDs: {{.Arg0}}", + "translation": "i18n4go: target file has invalid i18n strings with IDs: {{.Arg0}}" + }, + { + "id": "i18n4go: created default translation file:", + "translation": "i18n4go: created default translation file:" + }, + { + "id": "recursively extract strings from all files in the same directory as filename or dirName", + "translation": "recursively extract strings from all files in the same directory as filename or dirName" + }, + { + "id": "Duplicated key found: ", + "translation": "Duplicated key found: " + }, + { + "id": "WARNING compiling ignore-regexp:", + "translation": "WARNING compiling ignore-regexp:" + }, + { + "id": "Couldn't get the strings from {{.Arg0}}: {{.Arg1}}", + "translation": "Couldn't get the strings from {{.Arg0}}: {{.Arg1}}" + }, + { + "id": "Loaded {{.Arg0}} excluded regexps", + "translation": "Loaded {{.Arg0}} excluded regexps" + }, + { + "id": "Extracting strings in package:", + "translation": "Extracting strings in package:" + }, + { + "id": "Creates the transation files", + "translation": "Creates the transation files" + }, + { + "id": "Loaded {{.Arg0}} excluded strings", + "translation": "Loaded {{.Arg0}} excluded strings" + }, + { + "id": "i18n4go: could not save PO file: {{.Arg0}}", + "translation": "i18n4go: could not save PO file: {{.Arg0}}" + }, + { + "id": "i18n4go: Error loading the i18n strings from input filename:", + "translation": "i18n4go: Error loading the i18n strings from input filename:" + }, + { + "id": "WARNING running in -dry-run mode", + "translation": "WARNING running in -dry-run mode" + }, + { + "id": "i18n4go: adding init func to package:", + "translation": "i18n4go: adding init func to package:" + }, + { + "id": "Merge translation strings", + "translation": "Merge translation strings" + }, + { + "id": " to output dir:", + "translation": " to output dir:" + }, + { + "id": "i18n4go: Error input file: {{.Arg0}} is empty", + "translation": "i18n4go: Error input file: {{.Arg0}} is empty" + }, + { + "id": "i18n4go: Could not verify strings for input filename, err:", + "translation": "i18n4go: Could not verify strings for input filename, err:" + }, + { + "id": "Found", + "translation": "Found" + }, + { + "id": "i18n4go: creating translation file copy for language:", + "translation": "i18n4go: creating translation file copy for language:" + }, + { + "id": "i18n4go: Non-regular source file {{.Arg0}} ({{.Arg1}})\n", + "translation": "i18n4go: Non-regular source file {{.Arg0}} ({{.Arg1}})\n" + }, + { + "id": "Show the version of the i18n client", + "translation": "Show the version of the i18n client" + }, + { + "id": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", + "translation": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file" + }, + { + "id": "generate standard .po file for translation", + "translation": "generate standard .po file for translation" + }, + { + "id": "i18n4go: ERROR could not create the diff file:", + "translation": "i18n4go: ERROR could not create the diff file:" + }, + { + "id": "Missing Strings!", + "translation": "Missing Strings!" + }, + { + "id": "i18n4go: WARNING target file contains total of extra keys:", + "translation": "i18n4go: WARNING target file contains total of extra keys:" + }, + { + "id": "Extracted {{.Arg0}} strings from file: {{.Arg1}}\n", + "translation": "Extracted {{.Arg0}} strings from file: {{.Arg1}}\n" + }, + { + "id": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", + "translation": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"" + }, + { + "id": "i18n4go: could not create translation file for language: {{.Arg0}} with Google Translate", + "translation": "i18n4go: could not create translation file for language: {{.Arg0}} with Google Translate" + }, + { + "id": "i18n4go: created translation file with Google Translate:", + "translation": "i18n4go: created translation file with Google Translate:" + }, + { + "id": "i18n4go: could not extract strings from directory:", + "translation": "i18n4go: could not extract strings from directory:" + }, + { + "id": "OK", + "translation": "OK" + }, + { + "id": "i18n4go: error adding init() func to package:", + "translation": "i18n4go: error adding init() func to package:" + }, + { + "id": "i18n4go: creating translation file:", + "translation": "i18n4go: creating translation file:" + }, + { + "id": "i18n4go: ERROR parsing Google Translate response body", + "translation": "i18n4go: ERROR parsing Google Translate response body" + }, + { + "id": "Could not find imports for root node:\n\t{{.Arg0}}v\n", + "translation": "Could not find imports for root node:\n\t{{.Arg0}}v\n" + }, + { + "id": "No match for ignore-regexp:", + "translation": "No match for ignore-regexp:" + }, + { + "id": "Checks the transated files", + "translation": "Checks the transated files" + }, + { + "id": "i18n4go: extracting strings from file:", + "translation": "i18n4go: extracting strings from file:" + }, + { + "id": "the JSON file with strings to be excluded, defaults to excluded.json if present", + "translation": "the JSON file with strings to be excluded, defaults to excluded.json if present" + }, + { + "id": "i18n4go: WARNING could not find JSON file:", + "translation": "i18n4go: WARNING could not find JSON file:" + }, + { + "id": "i18n4go: input file: {{.Arg0}} is empty", + "translation": "i18n4go: input file: {{.Arg0}} is empty" + }, + { + "id": "the source translation file", + "translation": "the source translation file" + }, + { + "id": "the file name for which strings are extracted", + "translation": "the file name for which strings are extracted" + }, + { + "id": "Add, update, or remove translation keys from source files and resources files", + "translation": "Add, update, or remove translation keys from source files and resources files" + }, + { + "id": "Invalid response.", + "translation": "Invalid response." + }, + { + "id": "i18n4go: got a pkg with import:", + "translation": "i18n4go: got a pkg with import:" + }, + { + "id": "[optional] the excluded JSON file name, all strings there will be excluded", + "translation": "[optional] the excluded JSON file name, all strings there will be excluded" + }, + { + "id": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", + "translation": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name" + }, + { + "id": "i18n4go: templated string is invalid, missing args in translation:", + "translation": "i18n4go: templated string is invalid, missing args in translation:" + }, + { + "id": "An unexpected type of error", + "translation": "An unexpected type of error" + }, + { + "id": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", + "translation": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source" + }, + { + "id": "Using ignore-regexp:", + "translation": "Using ignore-regexp:" + }, + { + "id": "Creating and saving i18n strings to .po file:", + "translation": "Creating and saving i18n strings to .po file:" + }, + { + "id": "Rewrite translated packages from go source files", + "translation": "Rewrite translated packages from go source files" + }, + { + "id": "recursively rewrite packages from all files in the same directory as filename or dirName", + "translation": "recursively rewrite packages from all files in the same directory as filename or dirName" + }, + { + "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", + "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"" + }, + { + "id": "Capturing substrings in file:", + "translation": "Capturing substrings in file:" + }, + { + "id": "i18n4go: Could not create translation files, err:", + "translation": "i18n4go: Could not create translation files, err:" + }, + { + "id": "Total rewritten strings:", + "translation": "Total rewritten strings:" + }, + { + "id": "WARNING No capturing group found in {{.Arg0}}", + "translation": "WARNING No capturing group found in {{.Arg0}}" + }, + { + "id": "Version: {{.Arg0}}\n", + "translation": "Version: {{.Arg0}}\n" + }, + { + "id": "WARNING ignoring file:", + "translation": "WARNING ignoring file:" + }, + { + "id": "Missing:", + "translation": "Missing:" + }, + { + "id": "Total extracted strings:", + "translation": "Total extracted strings:" + }, + { + "id": "WARNING: fail to compile ignore-regexp:", + "translation": "WARNING: fail to compile ignore-regexp:" + }, + { + "id": "i18n4go: using import path as:", + "translation": "i18n4go: using import path as:" + }, + { + "id": "i18n4go: creating translation files for:", + "translation": "i18n4go: creating translation files for:" + }, + { + "id": "Excluding regexps in file:", + "translation": "Excluding regexps in file:" + }, + { + "id": "Strings don't match", + "translation": "Strings don't match" + }, + { + "id": "prevents any output files from being created", + "translation": "prevents any output files from being created" + }, + { + "id": "generated files are created in directory to match the package name", + "translation": "generated files are created in directory to match the package name" + }, + { + "id": "Git Revision: {{.Arg0}}\n", + "translation": "Git Revision: {{.Arg0}}\n" + }, + { + "id": "Extract the translation strings from go source files", + "translation": "Extract the translation strings from go source files" + }, + { + "id": "Saving extracted strings to file:", + "translation": "Saving extracted strings to file:" + }, + { + "id": "Could not find:", + "translation": "Could not find:" + }, + { + "id": "Excluding strings in file:", + "translation": "Excluding strings in file:" + }, + { + "id": "i18n4go: target file is missing i18n strings with IDs: {{.Arg0}}", + "translation": "i18n4go: target file is missing i18n strings with IDs: {{.Arg0}}" + }, + { + "id": "Saving extracted i18n strings to file:", + "translation": "Saving extracted i18n strings to file:" + }, + { + "id": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", + "translation": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"" + }, + { + "id": "WARNING error compiling regexp:", + "translation": "WARNING error compiling regexp:" + }, + { + "id": "i18n4go: Could not merge strings, err:", + "translation": "i18n4go: Could not merge strings, err:" + }, + { + "id": "Additional Strings!", + "translation": "Additional Strings!" + }, + { + "id": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", + "translation": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation" + }, + { + "id": "i18n4go: error saving AST file:", + "translation": "i18n4go: error saving AST file:" + }, + { + "id": "i18n4go: got a local import {{.Arg0}} so using {{.Arg1}} instead for root pkg", + "translation": "i18n4go: got a local import {{.Arg0}} so using {{.Arg1}} instead for root pkg" + }, + { + "id": "Fixup the transation files", + "translation": "Fixup the transation files" + }, + { + "id": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", + "translation": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization" + }, + { + "id": "i18n4go: ERROR input file does not match target file:", + "translation": "i18n4go: ERROR input file does not match target file:" + }, + { + "id": "the dir name for which all .go files will have their strings extracted", + "translation": "the dir name for which all .go files will have their strings extracted" + }, + { + "id": "Build Date: {{.Arg0}}\n", + "translation": "Build Date: {{.Arg0}}\n" + }, + { + "id": "i18n4go: inserting i18n.T() calls for strings that need to be translated", + "translation": "i18n4go: inserting i18n.T() calls for strings that need to be translated" + }, + { + "id": "Loaded {{.Arg0}} substring regexps", + "translation": "Loaded {{.Arg0}} substring regexps" + }, + { + "id": "Extracted total of {{.Arg0}} strings\n\n", + "translation": "Extracted total of {{.Arg0}} strings\n\n" + }, + { + "id": "Select the number for the previous translation:", + "translation": "Select the number for the previous translation:" + }, + { + "id": "Additional:", + "translation": "Additional:" + }, + { + "id": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", + "translation": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)" + }, + { + "id": "the code", + "translation": "the code" + }, + { + "id": "i18n4go: Error verifying target filename: ", + "translation": "i18n4go: Error verifying target filename: " + }, + { + "id": "i18n4go: WARNING target file has extra key with ID: ", + "translation": "i18n4go: WARNING target file has extra key with ID: " + }, + { + "id": "the output directory where the newly created translation files will be placed", + "translation": "the output directory where the newly created translation files will be placed" + }, + { + "id": "i18n4go: Error compiling templated string Regexp: {{.Arg0}}\n", + "translation": "i18n4go: Error compiling templated string Regexp: {{.Arg0}}\n" + }, + { + "id": "i18n4go: Could not checkup, err:", + "translation": "i18n4go: Could not checkup, err:" + }, + { + "id": "Couldn't find the english strings: {{.Arg0}}", + "translation": "Couldn't find the english strings: {{.Arg0}}" + }, + { + "id": "i18n4go: error appending i18n.T() to AST file:", + "translation": "i18n4go: error appending i18n.T() to AST file:" + }, + { + "id": "i18n4go: WARNING target file has invalid templated translations with key ID: ", + "translation": "i18n4go: WARNING target file has invalid templated translations with key ID: " + }, + { + "id": "Unable to find english translation files", + "translation": "Unable to find english translation files" + }, + { + "id": "Adding these strings to the %s translation file:\n", + "translation": "Adding these strings to the %s translation file:\n" + }, + { + "id": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", + "translation": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command" + }, + { + "id": "i18n4go: error getting root path import:", + "translation": "i18n4go: error getting root path import:" + }, + { + "id": "the directory containing the go files to validate", + "translation": "the directory containing the go files to validate" + }, + { + "id": "Canceling fixup", + "translation": "Canceling fixup" + }, + { + "id": "[optional] the qualifier string that is used when using the i18n.T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)", + "translation": "[optional] the qualifier string that is used when using the i18n.T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)" + }, + { + "id": "i18n4go: could not create output directory: {{.Arg0}}", + "translation": "i18n4go: could not create output directory: {{.Arg0}}" + }, + { + "id": "Could not find an i18n file for locale: en_US", + "translation": "Could not find an i18n file for locale: en_US" + }, + { + "id": "Error when inspecting go file: ", + "translation": "Error when inspecting go file: " + }, + { + "id": "i18n4go: Error loading the i18n strings from target filename:", + "translation": "i18n4go: Error loading the i18n strings from target filename:" + }, + { + "id": "Is the string \"%s\" a new or updated string? [new/upd]\n", + "translation": "Is the string \"%s\" a new or updated string? [new/upd]\n" + }, + { + "id": "i18n4go: determining import path using root path:", + "translation": "i18n4go: determining import path using root path:" + }, + { + "id": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", + "translation": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t" + }, + { + "id": "{{.Arg0}}\nVersion {{.Arg1}}", + "translation": "{{.Arg0}}\nVersion {{.Arg1}}" + }, + { + "id": "i18n4go: Could not fixup, err:", + "translation": "i18n4go: Could not fixup, err:" + }, + { + "id": "File has duplicated key: {{.Arg0}}\n{{.Arg1}}", + "translation": "File has duplicated key: {{.Arg0}}\n{{.Arg1}}" + }, + { + "id": "i18n4go: target file has extra i18n strings with IDs: {{.Arg0}}", + "translation": "i18n4go: target file has extra i18n strings with IDs: {{.Arg0}}" + }, + { + "id": "i18n4go: using the PWD as the rootPath:", + "translation": "i18n4go: using the PWD as the rootPath:" + } ] diff --git a/i18n4go/i18n4go.go b/i18n4go/i18n4go.go index 0abace9..b415e7f 100644 --- a/i18n4go/i18n4go.go +++ b/i18n4go/i18n4go.go @@ -25,6 +25,7 @@ import ( "github.com/maximilien/i18n4go/i18n4go/cmds" "github.com/maximilien/i18n4go/i18n4go/common" + "github.com/maximilien/i18n4go/i18n4go/i18n" "github.com/spf13/cobra" ) @@ -65,10 +66,10 @@ func main() { func rootCobraCmd(opts common.Options) { cmd := &cobra.Command{ Use: "i18n4go", - Long: "General purpose tool for i18n", + Long: i18n.T("General purpose tool for i18n"), } - cmd.PersistentFlags().BoolVarP(&opts.VerboseFlag, "verbose", "v", false, "verbose mode where lots of output is generated during execution") + cmd.PersistentFlags().BoolVarP(&opts.VerboseFlag, "verbose", "v", false, i18n.T("verbose mode where lots of output is generated during execution")) cmd.AddCommand(cmds.NewCreateTranslationsCommand(&opts)) cmd.AddCommand(cmds.NewCheckupCommand(&opts)) @@ -98,12 +99,12 @@ func extractStringsCmd() { err := cmd.Run() if err != nil { - cmd.Println("i18n4go: Could not extract strings, err:", err) + cmd.Println(i18n.T("i18n4go: Could not extract strings, err:"), err) os.Exit(1) } duration := time.Now().Sub(startTime) - cmd.Println("Total time:", duration) + cmd.Println(i18n.T("Total time:"), duration) } func createTranslationsCmd() { @@ -118,12 +119,12 @@ func createTranslationsCmd() { err := cmd.Run() if err != nil { - cmd.Println("i18n4go: Could not create translation files, err:", err) + cmd.Println(i18n.T("i18n4go: Could not create translation files, err:"), err) os.Exit(1) } duration := time.Now().Sub(startTime) - cmd.Println("Total time:", duration) + cmd.Println(i18n.T("Total time:"), duration) } func verifyStringsCmd() { @@ -138,12 +139,12 @@ func verifyStringsCmd() { err := cmd.Run() if err != nil { - cmd.Println("i18n4go: Could not verify strings for input filename, err:", err) + cmd.Println(i18n.T("i18n4go: Could not verify strings for input filename, err:"), err) os.Exit(1) } duration := time.Now().Sub(startTime) - cmd.Println("Total time:", duration) + cmd.Println(i18n.T("Total time:"), duration) } func rewritePackageCmd() { @@ -159,12 +160,12 @@ func rewritePackageCmd() { err := cmd.Run() if err != nil { - cmd.Println("i18n4go: Could not successfully rewrite package, err:", err) + cmd.Println(i18n.T("i18n4go: Could not successfully rewrite package, err:"), err) os.Exit(1) } duration := time.Now().Sub(startTime) - cmd.Println("Total time:", duration) + cmd.Println(i18n.T("Total time:"), duration) } func mergeStringsCmd() { @@ -179,12 +180,12 @@ func mergeStringsCmd() { err := mergeStrings.Run() if err != nil { - mergeStrings.Println("i18n4go: Could not merge strings, err:", err) + mergeStrings.Println(i18n.T("i18n4go: Could not merge strings, err:"), err) os.Exit(1) } duration := time.Now().Sub(startTime) - mergeStrings.Println("Total time:", duration) + mergeStrings.Println(i18n.T("Total time:"), duration) } func showMissingStringsCmd() { @@ -199,12 +200,12 @@ func showMissingStringsCmd() { err := showMissingStrings.Run() if err != nil { - showMissingStrings.Println("i18n4go: Could not show missing strings, err:", err) + showMissingStrings.Println(i18n.T("i18n4go: Could not show missing strings, err:"), err) os.Exit(1) } duration := time.Now().Sub(startTime) - showMissingStrings.Println("Total time:", duration) + showMissingStrings.Println(i18n.T("Total time:"), duration) } func checkupCmd() { @@ -219,12 +220,12 @@ func checkupCmd() { err := checkup.Run() if err != nil { - checkup.Println("i18n4go: Could not checkup, err:", err) + checkup.Println(i18n.T("i18n4go: Could not checkup, err:"), err) os.Exit(1) } duration := time.Now().Sub(startTime) - checkup.Println("Total time:", duration) + checkup.Println(i18n.T("Total time:"), duration) } func fixupCmd() { @@ -239,57 +240,57 @@ func fixupCmd() { err := fixup.Run() if err != nil { - fixup.Println("i18n4go: Could not fixup, err:", err) + fixup.Println(i18n.T("i18n4go: Could not fixup, err:"), err) os.Exit(1) } duration := time.Now().Sub(startTime) - fixup.Println("Total time:", duration) + fixup.Println(i18n.T("Total time:"), duration) } func init() { - flag.StringVar(&options.CommandFlag, "c", "", "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup") + flag.StringVar(&options.CommandFlag, "c", "", i18n.T("the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup")) - flag.BoolVar(&options.HelpFlag, "h", false, "prints the usage") - flag.BoolVar(&options.LongHelpFlag, "help", false, "prints the usage") + flag.BoolVar(&options.HelpFlag, "h", false, i18n.T("prints the usage")) + flag.BoolVar(&options.LongHelpFlag, "help", false, i18n.T("prints the usage")) - flag.StringVar(&options.SourceLanguageFlag, "source-language", "en", "the source language of the file, typically also part of the file name, e.g., \"en_US\"") - flag.StringVar(&options.LanguagesFlag, "languages", "", "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"") - flag.StringVar(&options.GoogleTranslateApiKeyFlag, "google-translate-api-key", "", "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)") + flag.StringVar(&options.SourceLanguageFlag, "source-language", "en", i18n.T("the source language of the file, typically also part of the file name, e.g., \"en_US\"")) + flag.StringVar(&options.LanguagesFlag, "languages", "", i18n.T("a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"")) + flag.StringVar(&options.GoogleTranslateApiKeyFlag, "google-translate-api-key", "", i18n.T("[optional] your public Google Translate API key which is used to generate translations (charge is applicable)")) - flag.BoolVar(&options.VerboseFlag, "v", false, "verbose mode where lots of output is generated during execution") + flag.BoolVar(&options.VerboseFlag, "v", false, i18n.T("verbose mode where lots of output is generated during execution")) - flag.BoolVar(&options.PoFlag, "po", false, "generate standard .po file for translation") + flag.BoolVar(&options.PoFlag, "po", false, i18n.T("generate standard .po file for translation")) - flag.BoolVar(&options.MetaFlag, "meta", false, "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file") - flag.BoolVar(&options.DryRunFlag, "dry-run", false, "prevents any output files from being created") + flag.BoolVar(&options.MetaFlag, "meta", false, i18n.T("[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file")) + flag.BoolVar(&options.DryRunFlag, "dry-run", false, i18n.T("prevents any output files from being created")) - flag.StringVar(&options.ExcludedFilenameFlag, "e", "excluded.json", "[optional] the excluded JSON file name, all strings there will be excluded") + flag.StringVar(&options.ExcludedFilenameFlag, "e", "excluded.json", i18n.T("[optional] the excluded JSON file name, all strings there will be excluded")) - flag.StringVar(&options.SubstringFilenameFlag, "s", "capturing_group.json", "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation") + flag.StringVar(&options.SubstringFilenameFlag, "s", "capturing_group.json", i18n.T("[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation")) - flag.StringVar(&options.OutputDirFlag, "o", "", "output directory where the translation files will be placed") + flag.StringVar(&options.OutputDirFlag, "o", "", i18n.T("output directory where the translation files will be placed")) - flag.BoolVar(&options.OutputFlatFlag, "output-flat", true, "generated files are created in the specified output directory") - flag.BoolVar(&options.OutputMatchPackageFlag, "output-match-package", false, "generated files are created in directory to match the package name") + flag.BoolVar(&options.OutputFlatFlag, "output-flat", true, i18n.T("generated files are created in the specified output directory")) + flag.BoolVar(&options.OutputMatchPackageFlag, "output-match-package", false, i18n.T("generated files are created in directory to match the package name")) - flag.StringVar(&options.FilenameFlag, "f", "", "the file name for which strings are extracted") + flag.StringVar(&options.FilenameFlag, "f", "", i18n.T("the file name for which strings are extracted")) - flag.StringVar(&options.DirnameFlag, "d", "", "the dir name for which all .go files will have their strings extracted") + flag.StringVar(&options.DirnameFlag, "d", "", i18n.T("the dir name for which all .go files will have their strings extracted")) - flag.BoolVar(&options.RecurseFlag, "r", false, "recursively extract strings from all files in the same directory as filename or dirName") + flag.BoolVar(&options.RecurseFlag, "r", false, i18n.T("recursively extract strings from all files in the same directory as filename or dirName")) - flag.StringVar(&options.IgnoreRegexpFlag, "ignore-regexp", ".*test.*", "a perl-style regular expression for files to ignore, e.g., \".*test.*\"") + flag.StringVar(&options.IgnoreRegexpFlag, "ignore-regexp", ".*test.*", i18n.T("a perl-style regular expression for files to ignore, e.g., \".*test.*\"")) - flag.StringVar(&options.LanguageFilesFlag, "language-files", "", `[optional] a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\" if not specified then the languages flag is used to find target files in same directory as source`) + flag.StringVar(&options.LanguageFilesFlag, "language-files", "", i18n.T(`[optional] a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\" if not specified then the languages flag is used to find target files in same directory as source`)) - flag.StringVar(&options.I18nStringsFilenameFlag, "i18n-strings-filename", "", "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command") - flag.StringVar(&options.I18nStringsDirnameFlag, "i18n-strings-dirname", "", "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name") - flag.StringVar(&options.RootPathFlag, "root-path", "", "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified") + flag.StringVar(&options.I18nStringsFilenameFlag, "i18n-strings-filename", "", i18n.T("a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command")) + flag.StringVar(&options.I18nStringsDirnameFlag, "i18n-strings-dirname", "", i18n.T("a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name")) + flag.StringVar(&options.RootPathFlag, "root-path", "", i18n.T("the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified")) - flag.StringVar(&options.InitCodeSnippetFilenameFlag, "init-code-snippet-filename", "", "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization") + flag.StringVar(&options.InitCodeSnippetFilenameFlag, "init-code-snippet-filename", "", i18n.T("[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization")) - flag.StringVar(&options.QualifierFlag, "q", "", "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)") + flag.StringVar(&options.QualifierFlag, "q", "", i18n.T("[optional] the qualifier string that is used when using the i18n.T(...) function, default to nothing but could be set to `i18n` so that all calls would be: i18n.T(...)")) flag.Parse() } @@ -397,13 +398,13 @@ usage: i18n4go -c checkup CHECKUP: -c checkup the checkup command which ensures that the strings in code match strings in resource files and vice versa - -q the qualifier to use when calling the T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for T(...) function + -q the qualifier to use when calling the i18n.T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for i18n.T(...) function FIXUP: -c fixup the fixup command which interactively lets users add, update, or remove translations keys from code and resource files. ` - fmt.Println(fmt.Sprintf("%s\nVersion %s", usageString, VERSION)) + fmt.Println(fmt.Sprintf(i18n.T("{{.Arg0}}\nVersion {{.Arg1}}", map[string]interface{}{"Arg0": usageString, "Arg1": VERSION}))) } func handlePanic() { @@ -415,7 +416,7 @@ func handlePanic() { case string: displayCrashDialog(err) default: - displayCrashDialog("An unexpected type of error") + displayCrashDialog(i18n.T("An unexpected type of error")) } } @@ -425,7 +426,7 @@ func handlePanic() { } func displayCrashDialog(errorMessage string) { - formattedString := ` + formattedString := i18n.T(` Something completely unexpected happened. This is a bug in %s. Please file this bug : https://github.com/maximilien/i18n4go/issues Tell us that you ran this command: @@ -439,7 +440,7 @@ this error occurred: and this stack trace: %s - ` + `) stackTrace := "\t" + strings.Replace(string(debug.Stack()), "\n", "\n\t", -1) println(fmt.Sprintf(formattedString, "i18n4go", strings.Join(os.Args, " "), errorMessage, stackTrace)) diff --git a/i18n4go/resources/i18n_resources.go b/i18n4go/resources/i18n_resources.go deleted file mode 100644 index cf78768..0000000 --- a/i18n4go/resources/i18n_resources.go +++ /dev/null @@ -1,1455 +0,0 @@ -// Code generated by go-bindata. (@generated) DO NOT EDIT. - -// Package resources generated by go-bindata. -// sources: -// i18n4go/i18n/resources/all.en_US.json -package resources - -import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time" -) - -type asset struct { - bytes []byte - info os.FileInfo -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -// Name return file name -func (fi bindataFileInfo) Name() string { - return fi.name -} - -// Size return file size -func (fi bindataFileInfo) Size() int64 { - return fi.size -} - -// Mode return file mode -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} - -// ModTime return file modify time -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} - -// IsDir return file whether a directory -func (fi bindataFileInfo) IsDir() bool { - return fi.mode&os.ModeDir != 0 -} - -// Sys return file is sys mode -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -var _i18n4goI18nResourcesAllEn_usJson = []byte(`[ - { - "id": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", - "translation": "\nSomething completely unexpected happened. This is a bug in %s.\nPlease file this bug : https://github.com/maximilien/i18n4go/issues\nTell us that you ran this command:\n\n\t%s\n\nthis error occurred:\n\n\t%s\n\nand this stack trace:\n\n%s\n\t", - "modified": false - }, - { - "id": "\nusage: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -f \n or: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -d [-r] [--ignore-regexp ]\n\nusage: i18n4go -c rewrite-package [-v] [-r] -d [--i18n-strings-filename | --i18n-strings-dirname ] [--init-code-snippet-filename ] [--ignore-regexp ]\n or: i18n4go -c rewrite-package [-v] [-r] -f --i18n-strings-filename [--init-code-snippet-filename ] [--ignore-regexp ]\n\nusage: i18n4go -c create-translations [-v] [--google-translate-api-key ] [--source-language ] -f --languages -o \n\nusage: i18n4go -c merge-strings [-v] [-r] [--source-language ] -d \n\nusage: i18n4go -c verify-strings [-v] [--source-language ] -f --language-files [-o ]\n or: i18n4go -c verify-strings [-v] [--source-language ] -f --languages [-o ]\n\nusage: i18n4go -c show-missing-strings [-v] -d --i18n-strings-filename \n\nusage: i18n4go -c checkup\n\n -h | --help prints the usage\n -v verbose\n\n EXTRACT-STRINGS:\n\n -c extract-strings the extract strings command\n\n --po to generate standard .po files for translation\n -e [optional] the JSON file with strings to be excluded, defaults to excluded.json if present\n\t-s\t\t\t\t\t\t\t\t\t\t\t\t [optional] the JSON file with regexp that specify a capturing group to be extracted instead of the full string matching the regexp\n --meta [optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file\n --dry-run [optional] prevents any output files from being created\n\n\n --output-flat generated files are created in the specified output directory (default)\n --output-match-package generated files are created in directory to match the package name\n -o the output directory where the translation files will be placed\n\n -f the go file name to extract strings\n\n -d the directory containing the go files to extract strings\n\n -r [optional] recursesively extract strings from all subdirectories\n --ignore-regexp [optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n REWRITE-PACKAGE:\n\n -c rewrite-package the rewrite package command\n -f the source go file to be rewritten\n -d the directory containing the go files to rewrite\n\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n --i18n-strings-dirname a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name\n --root-path the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified\n\n --init-code-snippet-filename [optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization\"\n -o [optional] output diretory for rewritten file. If not specified, the original file will be overwritten\n\n --ignore-regexp\t\t[optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n MERGE STRINGS:\n\n -c merge-strings the merge strings command which merges multiple .go..json files into a .all.json\n\n -r [optional] recursesively combine files from all subdirectories\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \"en_US\" (default to 'en')\n\n -d the directory containing the json files to combine\n\n CREATE-TRANSLATIONS:\n\n -c create-translations the create translations command\n\n --google-translate-api-key [optional] your public Google Translate API key which is used to generate translations (charge is applicable)\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \\\"en_US\\\"\n\n -f the source translation file\n --languages a comma separated list of valid languages with optional territory, e.g., \\\"en, en_US, fr_FR, es\\\"\n -o the output directory where the newly created translation files will be placed\n\n VERIFY-STRINGS:\n\n -c verify-strings the verify strings command\n\n --source-language [optional] the source language of the source translation file (default to 'en')\n\n -f the source translation file\n\n --language-files a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\"\n if not specified then the languages flag is used to find target files in same directory as source\n --languages a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"\n\n -o the output directory where the missing translation keys will be placed\n\n SHOW-MISSING-STRINGS:\n\n -c show-missing-strings the missing strings command\n\n -d the directory containing the go files to validate\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n\n CHECKUP:\n\n -c checkup the checkup command which ensures that the strings in code match strings in resource files and vice versa\n -q the qualifier to use when calling the T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for T(...) function\n\n FIXUP:\n\n -c fixup the fixup command which interactively lets users add, update, or remove translations keys from code and resource files.\n", - "translation": "\nusage: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -f \n or: i18n4go -c extract-strings [-vpe] [--dry-run] [--output-flat|--output-match-package|-o ] -d [-r] [--ignore-regexp ]\n\nusage: i18n4go -c rewrite-package [-v] [-r] -d [--i18n-strings-filename | --i18n-strings-dirname ] [--init-code-snippet-filename ] [--ignore-regexp ]\n or: i18n4go -c rewrite-package [-v] [-r] -f --i18n-strings-filename [--init-code-snippet-filename ] [--ignore-regexp ]\n\nusage: i18n4go -c create-translations [-v] [--google-translate-api-key ] [--source-language ] -f --languages -o \n\nusage: i18n4go -c merge-strings [-v] [-r] [--source-language ] -d \n\nusage: i18n4go -c verify-strings [-v] [--source-language ] -f --language-files [-o ]\n or: i18n4go -c verify-strings [-v] [--source-language ] -f --languages [-o ]\n\nusage: i18n4go -c show-missing-strings [-v] -d --i18n-strings-filename \n\nusage: i18n4go -c checkup\n\n -h | --help prints the usage\n -v verbose\n\n EXTRACT-STRINGS:\n\n -c extract-strings the extract strings command\n\n --po to generate standard .po files for translation\n -e [optional] the JSON file with strings to be excluded, defaults to excluded.json if present\n\t-s\t\t\t\t\t\t\t\t\t\t\t\t [optional] the JSON file with regexp that specify a capturing group to be extracted instead of the full string matching the regexp\n --meta [optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file\n --dry-run [optional] prevents any output files from being created\n\n\n --output-flat generated files are created in the specified output directory (default)\n --output-match-package generated files are created in directory to match the package name\n -o the output directory where the translation files will be placed\n\n -f the go file name to extract strings\n\n -d the directory containing the go files to extract strings\n\n -r [optional] recursesively extract strings from all subdirectories\n --ignore-regexp [optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n REWRITE-PACKAGE:\n\n -c rewrite-package the rewrite package command\n -f the source go file to be rewritten\n -d the directory containing the go files to rewrite\n\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n --i18n-strings-dirname a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name\n --root-path the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified\n\n --init-code-snippet-filename [optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization\"\n -o [optional] output diretory for rewritten file. If not specified, the original file will be overwritten\n\n --ignore-regexp\t\t[optional] a perl-style regular expression for files to ignore, e.g., \".*test.*\"\n\n MERGE STRINGS:\n\n -c merge-strings the merge strings command which merges multiple .go..json files into a .all.json\n\n -r [optional] recursesively combine files from all subdirectories\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \"en_US\" (default to 'en')\n\n -d the directory containing the json files to combine\n\n CREATE-TRANSLATIONS:\n\n -c create-translations the create translations command\n\n --google-translate-api-key [optional] your public Google Translate API key which is used to generate translations (charge is applicable)\n --source-language [optional] the source language of the file, typically also part of the file name, e.g., \\\"en_US\\\"\n\n -f the source translation file\n --languages a comma separated list of valid languages with optional territory, e.g., \\\"en, en_US, fr_FR, es\\\"\n -o the output directory where the newly created translation files will be placed\n\n VERIFY-STRINGS:\n\n -c verify-strings the verify strings command\n\n --source-language [optional] the source language of the source translation file (default to 'en')\n\n -f the source translation file\n\n --language-files a comma separated list of target files for different languages to compare, e.g., \"en, en_US, fr_FR, es\"\n if not specified then the languages flag is used to find target files in same directory as source\n --languages a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"\n\n -o the output directory where the missing translation keys will be placed\n\n SHOW-MISSING-STRINGS:\n\n -c show-missing-strings the missing strings command\n\n -d the directory containing the go files to validate\n --i18n-strings-filename a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command\n\n CHECKUP:\n\n -c checkup the checkup command which ensures that the strings in code match strings in resource files and vice versa\n -q the qualifier to use when calling the T(...), defaults to empty but can be used to set to something like i18n for example, such that, i18n.T(...) is used for T(...) function\n\n FIXUP:\n\n -c fixup the fixup command which interactively lets users add, update, or remove translations keys from code and resource files.\n", - "modified": false - }, - { - "id": " to output dir:", - "translation": " to output dir:", - "modified": false - }, - { - "id": "\"%s\" exists in %s, but not in %s\n", - "translation": "\"%s\" exists in %s, but not in %s\n", - "modified": false - }, - { - "id": "%s\nVersion %s", - "translation": "%s\nVersion %s", - "modified": false - }, - { - "id": "&target=", - "translation": "&target=", - "modified": false - }, - { - "id": ".*test.*", - "translation": ".*test.*", - "modified": false - }, - { - "id": ".all.json", - "translation": ".all.json", - "modified": false - }, - { - "id": ".en.po", - "translation": ".en.po", - "modified": false - }, - { - "id": ".missing.diff.json", - "translation": ".missing.diff.json", - "modified": false - }, - { - "id": "Add, update, or remove translation keys from source files and resources files", - "translation": "Add, update, or remove translation keys from source files and resources files", - "modified": false - }, - { - "id": "Adding these strings to the %s translation file:\n", - "translation": "Adding these strings to the %s translation file:\n", - "modified": false - }, - { - "id": "Adding to translated strings:", - "translation": "Adding to translated strings:", - "modified": false - }, - { - "id": "Additional Strings!", - "translation": "Additional Strings!", - "modified": false - }, - { - "id": "Additional:", - "translation": "Additional:", - "modified": false - }, - { - "id": "An unexpected type of error", - "translation": "An unexpected type of error", - "modified": false - }, - { - "id": "Build Date: %s\n", - "translation": "Build Date: %s\n", - "modified": false - }, - { - "id": "Canceling fixup", - "translation": "Canceling fixup", - "modified": false - }, - { - "id": "Capturing substrings in file:", - "translation": "Capturing substrings in file:", - "modified": false - }, - { - "id": "Checks the transated files", - "translation": "Checks the transated files", - "modified": false - }, - { - "id": "Could not find an i18n file for locale: en_US", - "translation": "Could not find an i18n file for locale: en_US", - "modified": false - }, - { - "id": "Could not find imports for root node:\n\t%#v\n", - "translation": "Could not find imports for root node:\n\t%#v\n", - "modified": false - }, - { - "id": "Could not find:", - "translation": "Could not find:", - "modified": false - }, - { - "id": "Could not load en_US language files. God save the queen. ", - "translation": "Could not load en_US language files. God save the queen. ", - "modified": false - }, - { - "id": "Could not load i18n asset: %v", - "translation": "Could not load i18n asset: %v", - "modified": false - }, - { - "id": "Couldn't find any source strings: %s", - "translation": "Couldn't find any source strings: %s", - "modified": false - }, - { - "id": "Couldn't find the english strings: %s", - "translation": "Couldn't find the english strings: %s", - "modified": false - }, - { - "id": "Couldn't get the strings from %s: %s", - "translation": "Couldn't get the strings from %s: %s", - "modified": false - }, - { - "id": "Creates the transation files", - "translation": "Creates the transation files", - "modified": false - }, - { - "id": "Creating and saving i18n strings to .po file:", - "translation": "Creating and saving i18n strings to .po file:", - "modified": false - }, - { - "id": "Duplicated key found: ", - "translation": "Duplicated key found: ", - "modified": false - }, - { - "id": "ERROR opening file", - "translation": "ERROR opening file", - "modified": false - }, - { - "id": "Error when inspecting go file: ", - "translation": "Error when inspecting go file: ", - "modified": false - }, - { - "id": "Excluding regexps in file:", - "translation": "Excluding regexps in file:", - "modified": false - }, - { - "id": "Excluding strings in file:", - "translation": "Excluding strings in file:", - "modified": false - }, - { - "id": "Extract the translation strings from go source files", - "translation": "Extract the translation strings from go source files", - "modified": false - }, - { - "id": "Extracted %d strings from file: %s\n", - "translation": "Extracted %d strings from file: %s\n", - "modified": false - }, - { - "id": "Extracted total of %d strings\n\n", - "translation": "Extracted total of %d strings\n\n", - "modified": false - }, - { - "id": "Extracting strings in package:", - "translation": "Extracting strings in package:", - "modified": false - }, - { - "id": "File has duplicated key: %s\n%s", - "translation": "File has duplicated key: %s\n%s", - "modified": false - }, - { - "id": "Fixup the transation files", - "translation": "Fixup the transation files", - "modified": false - }, - { - "id": "Found", - "translation": "Found", - "modified": false - }, - { - "id": "General purpose tool for i18n", - "translation": "General purpose tool for i18n", - "modified": false - }, - { - "id": "Git Revision: %s\n", - "translation": "Git Revision: %s\n", - "modified": false - }, - { - "id": "Invalid response.", - "translation": "Invalid response.", - "modified": false - }, - { - "id": "Is the string \"%s\" a new or updated string? [new/upd]\n", - "translation": "Is the string \"%s\" a new or updated string? [new/upd]\n", - "modified": false - }, - { - "id": "Loaded %d excluded regexps", - "translation": "Loaded %d excluded regexps", - "modified": false - }, - { - "id": "Loaded %d excluded strings", - "translation": "Loaded %d excluded strings", - "modified": false - }, - { - "id": "Loaded %d substring regexps", - "translation": "Loaded %d substring regexps", - "modified": false - }, - { - "id": "Merge translation strings", - "translation": "Merge translation strings", - "modified": false - }, - { - "id": "Missing Strings!", - "translation": "Missing Strings!", - "modified": false - }, - { - "id": "Missing:", - "translation": "Missing:", - "modified": false - }, - { - "id": "No match for ignore-regexp:", - "translation": "No match for ignore-regexp:", - "modified": false - }, - { - "id": "OK", - "translation": "OK", - "modified": false - }, - { - "id": "PWD", - "translation": "PWD", - "modified": false - }, - { - "id": "Removing these strings from the %s translation file:\n", - "translation": "Removing these strings from the %s translation file:\n", - "modified": false - }, - { - "id": "Rewrite translated packages from go source files", - "translation": "Rewrite translated packages from go source files", - "modified": false - }, - { - "id": "Saving extracted i18n strings to file:", - "translation": "Saving extracted i18n strings to file:", - "modified": false - }, - { - "id": "Saving extracted strings to file:", - "translation": "Saving extracted strings to file:", - "modified": false - }, - { - "id": "Select the number for the previous translation:", - "translation": "Select the number for the previous translation:", - "modified": false - }, - { - "id": "Show the version of the i18n client", - "translation": "Show the version of the i18n client", - "modified": false - }, - { - "id": "Shows missing strings in translations", - "translation": "Shows missing strings in translations", - "modified": false - }, - { - "id": "Strings don't match", - "translation": "Strings don't match", - "modified": false - }, - { - "id": "Total extracted strings:", - "translation": "Total extracted strings:", - "modified": false - }, - { - "id": "Total files parsed:", - "translation": "Total files parsed:", - "modified": false - }, - { - "id": "Total rewritten strings:", - "translation": "Total rewritten strings:", - "modified": false - }, - { - "id": "Total time:", - "translation": "Total time:", - "modified": false - }, - { - "id": "UNDER", - "translation": "UNDER", - "modified": false - }, - { - "id": "Unable to find english translation files", - "translation": "Unable to find english translation files", - "modified": false - }, - { - "id": "Updating the following strings from the %s translation file:\n", - "translation": "Updating the following strings from the %s translation file:\n", - "modified": false - }, - { - "id": "Using ignore-regexp:", - "translation": "Using ignore-regexp:", - "modified": false - }, - { - "id": "Verify strings in translations", - "translation": "Verify strings in translations", - "modified": false - }, - { - "id": "Version: %s\n", - "translation": "Version: %s\n", - "modified": false - }, - { - "id": "WARNING No capturing group found in %s", - "translation": "WARNING No capturing group found in %s", - "modified": false - }, - { - "id": "WARNING compiling ignore-regexp:", - "translation": "WARNING compiling ignore-regexp:", - "modified": false - }, - { - "id": "WARNING error compiling regexp:", - "translation": "WARNING error compiling regexp:", - "modified": false - }, - { - "id": "WARNING ignoring file:", - "translation": "WARNING ignoring file:", - "modified": false - }, - { - "id": "WARNING running in -dry-run mode", - "translation": "WARNING running in -dry-run mode", - "modified": false - }, - { - "id": "WARNING: fail to compile ignore-regexp:", - "translation": "WARNING: fail to compile ignore-regexp:", - "modified": false - }, - { - "id": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", - "translation": "[optional] a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", - "modified": false - }, - { - "id": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", - "translation": "[optional] create a *.extracted.json file with metadata such as: filename, directory, and positions of the strings in source file", - "modified": false - }, - { - "id": "[optional] the excluded JSON file name, all strings there will be excluded", - "translation": "[optional] the excluded JSON file name, all strings there will be excluded", - "modified": false - }, - { - "id": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", - "translation": "[optional] the path to a file containing the template snippet for the code that is used for go-i18n initialization", - "modified": false - }, - { - "id": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to ` + "`" + `i18n` + "`" + ` so that all calls would be: i18n.T(...)", - "translation": "[optional] the qualifier string that is used when using the T(...) function, default to nothing but could be set to ` + "`" + `i18n` + "`" + ` so that all calls would be: i18n.T(...)", - "modified": false - }, - { - "id": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", - "translation": "[optional] the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", - "modified": false - }, - { - "id": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", - "translation": "[optional] your public Google Translate API key which is used to generate translations (charge is applicable)", - "modified": false - }, - { - "id": "_test.go", - "translation": "_test.go", - "modified": false - }, - { - "id": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", - "translation": "a JSON file with the strings that should be i18n enabled, typically the output of -extract-strings command", - "modified": false - }, - { - "id": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", - "translation": "a JSON file with the strings that should be i18n enabled, typically the output of the extract-strings command", - "modified": false - }, - { - "id": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", - "translation": "a comma separated list of target files for different languages to compare, e.g., \\\"en, en_US, fr_FR, es\\\"\t if not specified then the languages flag is used to find target files in same directory as source", - "modified": false - }, - { - "id": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", - "translation": "a comma separated list of valid languages with optional territory, e.g., \"en, en_US, fr_FR, es\"", - "modified": false - }, - { - "id": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", - "translation": "a directory with the extracted JSON files, using -output-match-package with -extract-strings this directory should match the input files package name", - "modified": false - }, - { - "id": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", - "translation": "a directory with the extracted JSON files, using -output-match-package with extract-strings command this directory should match the input files package name", - "modified": false - }, - { - "id": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", - "translation": "a perl-style regular expression for files to ignore, e.g., \".*test.*\"", - "modified": false - }, - { - "id": "capturing_group.json", - "translation": "capturing_group.json", - "modified": false - }, - { - "id": "cf", - "translation": "cf", - "modified": false - }, - { - "id": "checkup", - "translation": "checkup", - "modified": false - }, - { - "id": "cowardly refusing to translate the strings in test file:", - "translation": "cowardly refusing to translate the strings in test file:", - "modified": false - }, - { - "id": "create-translations", - "translation": "create-translations", - "modified": false - }, - { - "id": "de_DE", - "translation": "de_DE", - "modified": false - }, - { - "id": "directory", - "translation": "directory", - "modified": false - }, - { - "id": "dry-run", - "translation": "dry-run", - "modified": false - }, - { - "id": "en", - "translation": "en", - "modified": false - }, - { - "id": "en_US", - "translation": "en_US", - "modified": false - }, - { - "id": "es_ES", - "translation": "es_ES", - "modified": false - }, - { - "id": "exclude", - "translation": "exclude", - "modified": false - }, - { - "id": "excluded|json|all", - "translation": "excluded|json|all", - "modified": false - }, - { - "id": "exit", - "translation": "exit", - "modified": false - }, - { - "id": "extract-strings", - "translation": "extract-strings", - "modified": false - }, - { - "id": "extracted_strings.json", - "translation": "extracted_strings.json", - "modified": false - }, - { - "id": "file", - "translation": "file", - "modified": false - }, - { - "id": "filepath.Join(", - "translation": "filepath.Join(", - "modified": false - }, - { - "id": "fixup", - "translation": "fixup", - "modified": false - }, - { - "id": "fr_FR", - "translation": "fr_FR", - "modified": false - }, - { - "id": "generate standard .po file for translation", - "translation": "generate standard .po file for translation", - "modified": false - }, - { - "id": "generated files are created in directory to match the package name", - "translation": "generated files are created in directory to match the package name", - "modified": false - }, - { - "id": "generated files are created in the specified output directory", - "translation": "generated files are created in the specified output directory", - "modified": false - }, - { - "id": "google-translate-api-key", - "translation": "google-translate-api-key", - "modified": false - }, - { - "id": "i18n-strings-dirname", - "translation": "i18n-strings-dirname", - "modified": false - }, - { - "id": "i18n-strings-filename", - "translation": "i18n-strings-filename", - "modified": false - }, - { - "id": "i18n4go: Could not checkup, err:", - "translation": "i18n4go: Could not checkup, err:", - "modified": false - }, - { - "id": "i18n4go: Could not create translation files, err:", - "translation": "i18n4go: Could not create translation files, err:", - "modified": false - }, - { - "id": "i18n4go: Could not extract strings, err:", - "translation": "i18n4go: Could not extract strings, err:", - "modified": false - }, - { - "id": "i18n4go: Could not fixup, err:", - "translation": "i18n4go: Could not fixup, err:", - "modified": false - }, - { - "id": "i18n4go: Could not merge strings, err:", - "translation": "i18n4go: Could not merge strings, err:", - "modified": false - }, - { - "id": "i18n4go: Could not show missing strings, err:", - "translation": "i18n4go: Could not show missing strings, err:", - "modified": false - }, - { - "id": "i18n4go: Could not successfully rewrite package, err:", - "translation": "i18n4go: Could not successfully rewrite package, err:", - "modified": false - }, - { - "id": "i18n4go: Could not verify strings for input filename, err:", - "translation": "i18n4go: Could not verify strings for input filename, err:", - "modified": false - }, - { - "id": "i18n4go: ERROR could not create the diff file:", - "translation": "i18n4go: ERROR could not create the diff file:", - "modified": false - }, - { - "id": "i18n4go: ERROR input file does not match target file:", - "translation": "i18n4go: ERROR input file does not match target file:", - "modified": false - }, - { - "id": "i18n4go: ERROR invoking Google Translate: ", - "translation": "i18n4go: ERROR invoking Google Translate: ", - "modified": false - }, - { - "id": "i18n4go: ERROR parsing Google Translate response body", - "translation": "i18n4go: ERROR parsing Google Translate response body", - "modified": false - }, - { - "id": "i18n4go: Error checking input filename: ", - "translation": "i18n4go: Error checking input filename: ", - "modified": false - }, - { - "id": "i18n4go: Error compiling interpolated string Regexp: %s\n", - "translation": "i18n4go: Error compiling interpolated string Regexp: %s\n", - "modified": false - }, - { - "id": "i18n4go: Error compiling templated string Regexp: %s\n", - "translation": "i18n4go: Error compiling templated string Regexp: %s\n", - "modified": false - }, - { - "id": "i18n4go: Error input file: %s is empty", - "translation": "i18n4go: Error input file: %s is empty", - "modified": false - }, - { - "id": "i18n4go: Error loading the i18n strings from input filename:", - "translation": "i18n4go: Error loading the i18n strings from input filename:", - "modified": false - }, - { - "id": "i18n4go: Error loading the i18n strings from target filename:", - "translation": "i18n4go: Error loading the i18n strings from target filename:", - "modified": false - }, - { - "id": "i18n4go: Error verifying target filename: ", - "translation": "i18n4go: Error verifying target filename: ", - "modified": false - }, - { - "id": "i18n4go: Non-regular source file %s (%s)\n", - "translation": "i18n4go: Non-regular source file %s (%s)\n", - "modified": false - }, - { - "id": "i18n4go: WARNING could not find JSON file:", - "translation": "i18n4go: WARNING could not find JSON file:", - "modified": false - }, - { - "id": "i18n4go: WARNING target file contains total of extra keys:", - "translation": "i18n4go: WARNING target file contains total of extra keys:", - "modified": false - }, - { - "id": "i18n4go: WARNING target file contains total of invalid translations:", - "translation": "i18n4go: WARNING target file contains total of invalid translations:", - "modified": false - }, - { - "id": "i18n4go: WARNING target file has extra key with ID: ", - "translation": "i18n4go: WARNING target file has extra key with ID: ", - "modified": false - }, - { - "id": "i18n4go: WARNING target file has invalid templated translations with key ID: ", - "translation": "i18n4go: WARNING target file has invalid templated translations with key ID: ", - "modified": false - }, - { - "id": "i18n4go: adding init func to package:", - "translation": "i18n4go: adding init func to package:", - "modified": false - }, - { - "id": "i18n4go: attempting to use Google Translate to translate source strings in: ", - "translation": "i18n4go: attempting to use Google Translate to translate source strings in: ", - "modified": false - }, - { - "id": "i18n4go: could not create default translation file for language: %s\nerr:%s", - "translation": "i18n4go: could not create default translation file for language: %s\nerr:%s", - "modified": false - }, - { - "id": "i18n4go: could not create output directory: %s", - "translation": "i18n4go: could not create output directory: %s", - "modified": false - }, - { - "id": "i18n4go: could not create translation file for language: %s with Google Translate", - "translation": "i18n4go: could not create translation file for language: %s with Google Translate", - "modified": false - }, - { - "id": "i18n4go: could not extract strings from directory:", - "translation": "i18n4go: could not extract strings from directory:", - "modified": false - }, - { - "id": "i18n4go: could not load i18n strings from file: %s", - "translation": "i18n4go: could not load i18n strings from file: %s", - "modified": false - }, - { - "id": "i18n4go: could not save Google Translate i18n strings to file: %s", - "translation": "i18n4go: could not save Google Translate i18n strings to file: %s", - "modified": false - }, - { - "id": "i18n4go: could not save PO file: %s", - "translation": "i18n4go: could not save PO file: %s", - "modified": false - }, - { - "id": "i18n4go: created default translation file:", - "translation": "i18n4go: created default translation file:", - "modified": false - }, - { - "id": "i18n4go: created translation file with Google Translate:", - "translation": "i18n4go: created translation file with Google Translate:", - "modified": false - }, - { - "id": "i18n4go: creating and saving i18n strings to .po file:", - "translation": "i18n4go: creating and saving i18n strings to .po file:", - "modified": false - }, - { - "id": "i18n4go: creating translation file copy for language:", - "translation": "i18n4go: creating translation file copy for language:", - "modified": false - }, - { - "id": "i18n4go: creating translation file:", - "translation": "i18n4go: creating translation file:", - "modified": false - }, - { - "id": "i18n4go: creating translation files for:", - "translation": "i18n4go: creating translation files for:", - "modified": false - }, - { - "id": "i18n4go: determining import path using root path:", - "translation": "i18n4go: determining import path using root path:", - "modified": false - }, - { - "id": "i18n4go: error adding init() func to package:", - "translation": "i18n4go: error adding init() func to package:", - "modified": false - }, - { - "id": "i18n4go: error appending T() to AST file:", - "translation": "i18n4go: error appending T() to AST file:", - "modified": false - }, - { - "id": "i18n4go: error determining the import path:", - "translation": "i18n4go: error determining the import path:", - "modified": false - }, - { - "id": "i18n4go: error getting root path import:", - "translation": "i18n4go: error getting root path import:", - "modified": false - }, - { - "id": "i18n4go: error invoking Google Translate for string:", - "translation": "i18n4go: error invoking Google Translate for string:", - "modified": false - }, - { - "id": "i18n4go: error reading content of init code snippet file: %s\n, using default", - "translation": "i18n4go: error reading content of init code snippet file: %s\n, using default", - "modified": false - }, - { - "id": "i18n4go: error saving AST file:", - "translation": "i18n4go: error saving AST file:", - "modified": false - }, - { - "id": "i18n4go: error saving updated i18n strings file:", - "translation": "i18n4go: error saving updated i18n strings file:", - "modified": false - }, - { - "id": "i18n4go: extracting strings from file:", - "translation": "i18n4go: extracting strings from file:", - "modified": false - }, - { - "id": "i18n4go: generated diff file:", - "translation": "i18n4go: generated diff file:", - "modified": false - }, - { - "id": "i18n4go: got a local import %s so using %s instead for pkg", - "translation": "i18n4go: got a local import %s so using %s instead for pkg", - "modified": false - }, - { - "id": "i18n4go: got a local import %s so using %s instead for root pkg", - "translation": "i18n4go: got a local import %s so using %s instead for root pkg", - "modified": false - }, - { - "id": "i18n4go: got a pkg with import:", - "translation": "i18n4go: got a pkg with import:", - "modified": false - }, - { - "id": "i18n4go: got a root pkg with import path:", - "translation": "i18n4go: got a root pkg with import path:", - "modified": false - }, - { - "id": "i18n4go: input file: %s is empty", - "translation": "i18n4go: input file: %s is empty", - "modified": false - }, - { - "id": "i18n4go: inserting T() calls for strings that need to be translated", - "translation": "i18n4go: inserting T() calls for strings that need to be translated", - "modified": false - }, - { - "id": "i18n4go: inspecting dir %s, recursive: %t\n", - "translation": "i18n4go: inspecting dir %s, recursive: %t\n", - "modified": false - }, - { - "id": "i18n4go: loading JSON strings from file: %s\n", - "translation": "i18n4go: loading JSON strings from file: %s\n", - "modified": false - }, - { - "id": "i18n4go: rewriting strings for source file:", - "translation": "i18n4go: rewriting strings for source file:", - "modified": false - }, - { - "id": "i18n4go: rewriting strings in dir %s, recursive: %t\n", - "translation": "i18n4go: rewriting strings in dir %s, recursive: %t\n", - "modified": false - }, - { - "id": "i18n4go: saving combined language file: ", - "translation": "i18n4go: saving combined language file: ", - "modified": false - }, - { - "id": "i18n4go: scanning file: ", - "translation": "i18n4go: scanning file: ", - "modified": false - }, - { - "id": "i18n4go: target file has extra i18n strings with IDs: %s", - "translation": "i18n4go: target file has extra i18n strings with IDs: %s", - "modified": false - }, - { - "id": "i18n4go: target file has invalid i18n strings with IDs: %s", - "translation": "i18n4go: target file has invalid i18n strings with IDs: %s", - "modified": false - }, - { - "id": "i18n4go: target file is missing i18n strings with IDs: %s", - "translation": "i18n4go: target file is missing i18n strings with IDs: %s", - "modified": false - }, - { - "id": "i18n4go: templated string is invalid, missing args in translation:", - "translation": "i18n4go: templated string is invalid, missing args in translation:", - "modified": false - }, - { - "id": "i18n4go: using import path as:", - "translation": "i18n4go: using import path as:", - "modified": false - }, - { - "id": "i18n4go: using the PWD as the rootPath:", - "translation": "i18n4go: using the PWD as the rootPath:", - "modified": false - }, - { - "id": "i18n4go_res", - "translation": "i18n4go_res", - "modified": false - }, - { - "id": "i18n_init.go", - "translation": "i18n_init.go", - "modified": false - }, - { - "id": "ignore-regexp", - "translation": "ignore-regexp", - "modified": false - }, - { - "id": "init-code-snippet-filename", - "translation": "init-code-snippet-filename", - "modified": false - }, - { - "id": "it_IT", - "translation": "it_IT", - "modified": false - }, - { - "id": "ja_JA", - "translation": "ja_JA", - "modified": false - }, - { - "id": "ko_KO", - "translation": "ko_KO", - "modified": false - }, - { - "id": "language-files", - "translation": "language-files", - "modified": false - }, - { - "id": "languages", - "translation": "languages", - "modified": false - }, - { - "id": "merge-strings", - "translation": "merge-strings", - "modified": false - }, - { - "id": "meta", - "translation": "meta", - "modified": false - }, - { - "id": "new", - "translation": "new", - "modified": false - }, - { - "id": "output", - "translation": "output", - "modified": false - }, - { - "id": "output directory where the translation files will be placed", - "translation": "output directory where the translation files will be placed", - "modified": false - }, - { - "id": "output-flat", - "translation": "output-flat", - "modified": false - }, - { - "id": "output-match-package", - "translation": "output-match-package", - "modified": false - }, - { - "id": "package __PACKAGE__NAME__\n\nimport (\n\t\"path/filepath\"\n\n\ti18n \"github.com/maximilien/i18n4go/i18n\"\n)\n\nvar T i18n.TranslateFunc\n\nfunc init() {\n\tT = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath())\n}", - "translation": "package __PACKAGE__NAME__\n\nimport (\n\t\"path/filepath\"\n\n\ti18n \"github.com/maximilien/i18n4go/i18n\"\n)\n\nvar T i18n.TranslateFunc\n\nfunc init() {\n\tT = i18n.Init(__FULL_IMPORT_PATH__, i18n.GetResourcesPath())\n}", - "modified": false - }, - { - "id": "po", - "translation": "po", - "modified": false - }, - { - "id": "prevents any output files from being created", - "translation": "prevents any output files from being created", - "modified": false - }, - { - "id": "prints the usage", - "translation": "prints the usage", - "modified": false - }, - { - "id": "pt_BR", - "translation": "pt_BR", - "modified": false - }, - { - "id": "qualifier", - "translation": "qualifier", - "modified": false - }, - { - "id": "recursive", - "translation": "recursive", - "modified": false - }, - { - "id": "recursively extract strings from all files in the same directory as filename or dirName", - "translation": "recursively extract strings from all files in the same directory as filename or dirName", - "modified": false - }, - { - "id": "recursively rewrite packages from all files in the same directory as filename or dirName", - "translation": "recursively rewrite packages from all files in the same directory as filename or dirName", - "modified": false - }, - { - "id": "resources", - "translation": "resources", - "modified": false - }, - { - "id": "rewrite-package", - "translation": "rewrite-package", - "modified": false - }, - { - "id": "root-path", - "translation": "root-path", - "modified": false - }, - { - "id": "ru_RU", - "translation": "ru_RU", - "modified": false - }, - { - "id": "saving file to path", - "translation": "saving file to path", - "modified": false - }, - { - "id": "show-missing-strings", - "translation": "show-missing-strings", - "modified": false - }, - { - "id": "source-language", - "translation": "source-language", - "modified": false - }, - { - "id": "src", - "translation": "src", - "modified": false - }, - { - "id": "string", - "translation": "string", - "modified": false - }, - { - "id": "substring-file", - "translation": "substring-file", - "modified": false - }, - { - "id": "targetFilenames:", - "translation": "targetFilenames:", - "modified": false - }, - { - "id": "the JSON file with strings to be excluded, defaults to excluded.json if present", - "translation": "the JSON file with strings to be excluded, defaults to excluded.json if present", - "modified": false - }, - { - "id": "the code", - "translation": "the code", - "modified": false - }, - { - "id": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", - "translation": "the command, one of: extract-strings, create-translations, rewrite-package, verify-strings, merge-strings, checkup, fixup", - "modified": false - }, - { - "id": "the dir name for which all .go files will have their strings extracted", - "translation": "the dir name for which all .go files will have their strings extracted", - "modified": false - }, - { - "id": "the directory containing the go files to validate", - "translation": "the directory containing the go files to validate", - "modified": false - }, - { - "id": "the file name for which strings are extracted", - "translation": "the file name for which strings are extracted", - "modified": false - }, - { - "id": "the output directory where the missing translation keys will be placed", - "translation": "the output directory where the missing translation keys will be placed", - "modified": false - }, - { - "id": "the output directory where the newly created translation files will be placed", - "translation": "the output directory where the newly created translation files will be placed", - "modified": false - }, - { - "id": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", - "translation": "the root path to the Go source files whose packages are being rewritten, defaults to working directory, if not specified", - "modified": false - }, - { - "id": "the source go file to be rewritten", - "translation": "the source go file to be rewritten", - "modified": false - }, - { - "id": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", - "translation": "the source language of the file, typically also part of the file name, e.g., \"en_US\"", - "modified": false - }, - { - "id": "the source translation file", - "translation": "the source translation file", - "modified": false - }, - { - "id": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", - "translation": "the substring capturing JSON file name, all strings there will only have their first capturing group saved as a translation", - "modified": false - }, - { - "id": "upd", - "translation": "upd", - "modified": false - }, - { - "id": "v1.4.0", - "translation": "v1.4.0", - "modified": false - }, - { - "id": "verbose", - "translation": "verbose", - "modified": false - }, - { - "id": "verbose mode where lots of output is generated during execution", - "translation": "verbose mode where lots of output is generated during execution", - "modified": false - }, - { - "id": "verify-strings", - "translation": "verify-strings", - "modified": false - }, - { - "id": "version", - "translation": "version", - "modified": false - }, - { - "id": "zh_CN", - "translation": "zh_CN", - "modified": false - } -] -`) - -func i18n4goI18nResourcesAllEn_usJsonBytes() ([]byte, error) { - return _i18n4goI18nResourcesAllEn_usJson, nil -} - -func i18n4goI18nResourcesAllEn_usJson() (*asset, error) { - bytes, err := i18n4goI18nResourcesAllEn_usJsonBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "i18n4go/i18n/resources/all.en_US.json", size: 51925, mode: os.FileMode(420), modTime: time.Unix(1699928651, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ - "i18n4go/i18n/resources/all.en_US.json": i18n4goI18nResourcesAllEn_usJson, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// -// data/ -// foo.txt -// img/ -// a.png -// b.png -// -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("nonexistent") would return an error -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - canonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(canonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} - -var _bintree = &bintree{nil, map[string]*bintree{ - "i18n4go": &bintree{nil, map[string]*bintree{ - "i18n": &bintree{nil, map[string]*bintree{ - "resources": &bintree{nil, map[string]*bintree{ - "all.en_US.json": &bintree{i18n4goI18nResourcesAllEn_usJson, map[string]*bintree{}}, - }}, - }}, - }}, -}} - -// RestoreAsset restores an asset under the given directory -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil -} - -// RestoreAssets restores an asset under the given directory recursively -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - canonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) -} From d7014cd67aff7faf94ae637a2854b51fec8c2f53 Mon Sep 17 00:00:00 2001 From: Aerex Date: Fri, 5 Jul 2024 19:07:56 -0400 Subject: [PATCH 06/13] test: renamed translation files to v2 go-i18n format --- integration/fixup/fixup_test.go | 27 +++++++++---------- .../fixup/allgood/translations/all.en_US.json | 6 +++++ .../fixup/allgood/translations/all.zh_CN.json | 6 +++++ .../fixup/allgood/translations/en_US.all.json | 6 ----- .../fixup/allgood/translations/zh_CN.all.json | 6 ----- .../{en_US.all.json => all.en_US.json} | 0 .../{zh_CN.all.json => all.zh_CN.json} | 0 .../{en_US.all.json => all.en_US.json} | 0 .../{zh_CN.all.json => all.zh_CN.json} | 0 .../{en_US.all.json => all.en_US.json} | 0 .../{zh_CN.all.json => all.zh_CN.json} | 0 .../{en_US.all.json => all.en_US.json} | 0 .../{zh_CN.all.json => all.zh_CN.json} | 0 .../{en_US.all.json => all.en_US.json} | 0 .../{zh_CN.all.json => all.zh_CN.json} | 0 .../{en_US.all.json => all.en_US.json} | 0 .../{zh_CN.all.json => all.zh_CN.json} | 0 .../{en_US.all.json => all.en_US.json} | 0 .../{zh_CN.all.json => all.zh_CN.json} | 0 .../input_files/init_code_snippet.go.template | 2 +- 20 files changed, 26 insertions(+), 27 deletions(-) create mode 100644 test_fixtures/fixup/allgood/translations/all.en_US.json create mode 100644 test_fixtures/fixup/allgood/translations/all.zh_CN.json delete mode 100644 test_fixtures/fixup/allgood/translations/en_US.all.json delete mode 100644 test_fixtures/fixup/allgood/translations/zh_CN.all.json rename test_fixtures/fixup/notsogood/add/translations/{en_US.all.json => all.en_US.json} (100%) rename test_fixtures/fixup/notsogood/add/translations/{zh_CN.all.json => all.zh_CN.json} (100%) rename test_fixtures/fixup/notsogood/delete/translations/{en_US.all.json => all.en_US.json} (100%) rename test_fixtures/fixup/notsogood/delete/translations/{zh_CN.all.json => all.zh_CN.json} (100%) rename test_fixtures/fixup/notsogood/extra_foreign_key/translations/{en_US.all.json => all.en_US.json} (100%) rename test_fixtures/fixup/notsogood/extra_foreign_key/translations/{zh_CN.all.json => all.zh_CN.json} (100%) rename test_fixtures/fixup/notsogood/missing_foreign_key/translations/{en_US.all.json => all.en_US.json} (100%) rename test_fixtures/fixup/notsogood/missing_foreign_key/translations/{zh_CN.all.json => all.zh_CN.json} (100%) rename test_fixtures/fixup/notsogood/multiple_update/translations/{en_US.all.json => all.en_US.json} (100%) rename test_fixtures/fixup/notsogood/multiple_update/translations/{zh_CN.all.json => all.zh_CN.json} (100%) rename test_fixtures/fixup/notsogood/update/translations/{en_US.all.json => all.en_US.json} (100%) rename test_fixtures/fixup/notsogood/update/translations/{zh_CN.all.json => all.zh_CN.json} (100%) rename test_fixtures/fixup/notsogood/update_add/translations/{en_US.all.json => all.en_US.json} (100%) rename test_fixtures/fixup/notsogood/update_add/translations/{zh_CN.all.json => all.zh_CN.json} (100%) diff --git a/integration/fixup/fixup_test.go b/integration/fixup/fixup_test.go index b05ffa0..2289143 100644 --- a/integration/fixup/fixup_test.go +++ b/integration/fixup/fixup_test.go @@ -82,7 +82,6 @@ var _ = Describe("fixup", func() { panic(err.Error()) } - //session = Runi18n("-c", "fixup") cmd = exec.Command(I18n4goExec, "-c", "fixup") stdinPipe, err = cmd.StdinPipe() @@ -163,11 +162,11 @@ var _ = Describe("fixup", func() { exitCode := cmd.Wait() Ω(exitCode).Should(BeNil()) - file, err := ioutil.ReadFile(filepath.Join(".", "translations", "en_US.all.json")) + file, err := ioutil.ReadFile(filepath.Join(".", "translations", "all.en_US.json")) Ω(err).ShouldNot(HaveOccurred()) Ω(file).Should(ContainSubstring("\"Heal the world\"")) - chineseFile, err := ioutil.ReadFile(filepath.Join(".", "translations", "zh_CN.all.json")) + chineseFile, err := ioutil.ReadFile(filepath.Join(".", "translations", "all.zh_CN.json")) Ω(err).ShouldNot(HaveOccurred()) Ω(chineseFile).Should(ContainSubstring("\"Heal the world\"")) }) @@ -185,11 +184,11 @@ var _ = Describe("fixup", func() { exitCode := cmd.Wait() Ω(exitCode).Should(BeNil()) - file, err := ioutil.ReadFile(filepath.Join(".", "translations", "en_US.all.json")) + file, err := ioutil.ReadFile(filepath.Join(".", "translations", "all.en_US.json")) Ω(err).ShouldNot(HaveOccurred()) Ω(file).ShouldNot(ContainSubstring("\"Heal the world\"")) - chineseFile, err := ioutil.ReadFile(filepath.Join(".", "translations", "zh_CN.all.json")) + chineseFile, err := ioutil.ReadFile(filepath.Join(".", "translations", "all.zh_CN.json")) Ω(err).ShouldNot(HaveOccurred()) Ω(chineseFile).ShouldNot(ContainSubstring("\"Heal the world\"")) }) @@ -234,14 +233,14 @@ var _ = Describe("fixup", func() { It("Updates the keys for all translation files", func() { cmd.Wait() - translations, err := common.LoadI18nStringInfos(filepath.Join(".", "translations", "en_US.all.json")) + translations, err := common.LoadI18nStringInfos(filepath.Join(".", "translations", "all.en_US.json")) Ω(err).ShouldNot(HaveOccurred()) mappedTranslations, err := common.CreateI18nStringInfoMap(translations) Ω(err).ShouldNot(HaveOccurred()) Ω(mappedTranslations["I like bananas."]).Should(Equal(common.I18nStringInfo{})) Ω(mappedTranslations["I like apples."]).ShouldNot(Equal(common.I18nStringInfo{})) - translations, err = common.LoadI18nStringInfos(filepath.Join(".", "translations", "zh_CN.all.json")) + translations, err = common.LoadI18nStringInfos(filepath.Join(".", "translations", "all.zh_CN.json")) Ω(err).ShouldNot(HaveOccurred()) mappedTranslations, err = common.CreateI18nStringInfoMap(translations) Ω(err).ShouldNot(HaveOccurred()) @@ -252,7 +251,7 @@ var _ = Describe("fixup", func() { It("Updates all the translation", func() { cmd.Wait() - translations, err := common.LoadI18nStringInfos(filepath.Join(".", "translations", "en_US.all.json")) + translations, err := common.LoadI18nStringInfos(filepath.Join(".", "translations", "all.en_US.json")) Ω(err).ShouldNot(HaveOccurred()) mappedTranslations, err := common.CreateI18nStringInfoMap(translations) Ω(err).ShouldNot(HaveOccurred()) @@ -262,7 +261,7 @@ var _ = Describe("fixup", func() { It("marks the foreign language translations as updated", func() { cmd.Wait() - translations, err := common.LoadI18nStringInfos(filepath.Join(".", "translations", "zh_CN.all.json")) + translations, err := common.LoadI18nStringInfos(filepath.Join(".", "translations", "all.zh_CN.json")) Ω(err).ShouldNot(HaveOccurred()) mappedTranslations, err := common.CreateI18nStringInfoMap(translations) Ω(err).ShouldNot(HaveOccurred()) @@ -284,14 +283,14 @@ var _ = Describe("fixup", func() { It("adds the new translation and deletes the old translation from all translation files", func() { cmd.Wait() - translations, err := common.LoadI18nStringInfos(filepath.Join(".", "translations", "en_US.all.json")) + translations, err := common.LoadI18nStringInfos(filepath.Join(".", "translations", "all.en_US.json")) Ω(err).ShouldNot(HaveOccurred()) mappedTranslations, err := common.CreateI18nStringInfoMap(translations) Ω(err).ShouldNot(HaveOccurred()) Ω(mappedTranslations["I like bananas."]).Should(Equal(common.I18nStringInfo{})) Ω(mappedTranslations["I like apples."]).Should(Equal(apple)) - translations, err = common.LoadI18nStringInfos(filepath.Join(".", "translations", "zh_CN.all.json")) + translations, err = common.LoadI18nStringInfos(filepath.Join(".", "translations", "all.zh_CN.json")) Ω(err).ShouldNot(HaveOccurred()) mappedTranslations, err = common.CreateI18nStringInfoMap(translations) Ω(err).ShouldNot(HaveOccurred()) @@ -309,7 +308,7 @@ var _ = Describe("fixup", func() { It("adds the extra translation", func() { cmd.Wait() - translations, err := common.LoadI18nStringInfos(filepath.Join(".", "translations", "zh_CN.all.json")) + translations, err := common.LoadI18nStringInfos(filepath.Join(".", "translations", "all.zh_CN.json")) Ω(err).ShouldNot(HaveOccurred()) mappedTranslations, err := common.CreateI18nStringInfoMap(translations) Ω(err).ShouldNot(HaveOccurred()) @@ -327,7 +326,7 @@ var _ = Describe("fixup", func() { It("removes the extra translation", func() { cmd.Wait() - translations, err := common.LoadI18nStringInfos(filepath.Join(".", "translations", "zh_CN.all.json")) + translations, err := common.LoadI18nStringInfos(filepath.Join(".", "translations", "all.zh_CN.json")) Ω(err).ShouldNot(HaveOccurred()) mappedTranslations, err := common.CreateI18nStringInfoMap(translations) Ω(err).ShouldNot(HaveOccurred()) @@ -344,7 +343,7 @@ func storeTranslationFiles(dir string) (files map[string][]byte, err error) { if !fileInfo.IsDir() { name := fileInfo.Name() - if strings.HasSuffix(name, ".all.json") { + if strings.HasPrefix(name, "all.") { path := filepath.Join(dir, fileInfo.Name()) files[path], err = ioutil.ReadFile(path) diff --git a/test_fixtures/fixup/allgood/translations/all.en_US.json b/test_fixtures/fixup/allgood/translations/all.en_US.json new file mode 100644 index 0000000..2dfd192 --- /dev/null +++ b/test_fixtures/fixup/allgood/translations/all.en_US.json @@ -0,0 +1,6 @@ +[ + { + "id": "Translated hello world!", + "translation": "Translated hello world!" + } +] \ No newline at end of file diff --git a/test_fixtures/fixup/allgood/translations/all.zh_CN.json b/test_fixtures/fixup/allgood/translations/all.zh_CN.json new file mode 100644 index 0000000..9ed6605 --- /dev/null +++ b/test_fixtures/fixup/allgood/translations/all.zh_CN.json @@ -0,0 +1,6 @@ +[ + { + "id": "Translated hello world!", + "translation": "你好世界!" + } +] \ No newline at end of file diff --git a/test_fixtures/fixup/allgood/translations/en_US.all.json b/test_fixtures/fixup/allgood/translations/en_US.all.json deleted file mode 100644 index 38485bb..0000000 --- a/test_fixtures/fixup/allgood/translations/en_US.all.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "id": "Translated hello world!", - "translation": "Translated hello world!" - } -] diff --git a/test_fixtures/fixup/allgood/translations/zh_CN.all.json b/test_fixtures/fixup/allgood/translations/zh_CN.all.json deleted file mode 100644 index 8339aca..0000000 --- a/test_fixtures/fixup/allgood/translations/zh_CN.all.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "id": "Translated hello world!", - "translation": "你好世界!" - } -] diff --git a/test_fixtures/fixup/notsogood/add/translations/en_US.all.json b/test_fixtures/fixup/notsogood/add/translations/all.en_US.json similarity index 100% rename from test_fixtures/fixup/notsogood/add/translations/en_US.all.json rename to test_fixtures/fixup/notsogood/add/translations/all.en_US.json diff --git a/test_fixtures/fixup/notsogood/add/translations/zh_CN.all.json b/test_fixtures/fixup/notsogood/add/translations/all.zh_CN.json similarity index 100% rename from test_fixtures/fixup/notsogood/add/translations/zh_CN.all.json rename to test_fixtures/fixup/notsogood/add/translations/all.zh_CN.json diff --git a/test_fixtures/fixup/notsogood/delete/translations/en_US.all.json b/test_fixtures/fixup/notsogood/delete/translations/all.en_US.json similarity index 100% rename from test_fixtures/fixup/notsogood/delete/translations/en_US.all.json rename to test_fixtures/fixup/notsogood/delete/translations/all.en_US.json diff --git a/test_fixtures/fixup/notsogood/delete/translations/zh_CN.all.json b/test_fixtures/fixup/notsogood/delete/translations/all.zh_CN.json similarity index 100% rename from test_fixtures/fixup/notsogood/delete/translations/zh_CN.all.json rename to test_fixtures/fixup/notsogood/delete/translations/all.zh_CN.json diff --git a/test_fixtures/fixup/notsogood/extra_foreign_key/translations/en_US.all.json b/test_fixtures/fixup/notsogood/extra_foreign_key/translations/all.en_US.json similarity index 100% rename from test_fixtures/fixup/notsogood/extra_foreign_key/translations/en_US.all.json rename to test_fixtures/fixup/notsogood/extra_foreign_key/translations/all.en_US.json diff --git a/test_fixtures/fixup/notsogood/extra_foreign_key/translations/zh_CN.all.json b/test_fixtures/fixup/notsogood/extra_foreign_key/translations/all.zh_CN.json similarity index 100% rename from test_fixtures/fixup/notsogood/extra_foreign_key/translations/zh_CN.all.json rename to test_fixtures/fixup/notsogood/extra_foreign_key/translations/all.zh_CN.json diff --git a/test_fixtures/fixup/notsogood/missing_foreign_key/translations/en_US.all.json b/test_fixtures/fixup/notsogood/missing_foreign_key/translations/all.en_US.json similarity index 100% rename from test_fixtures/fixup/notsogood/missing_foreign_key/translations/en_US.all.json rename to test_fixtures/fixup/notsogood/missing_foreign_key/translations/all.en_US.json diff --git a/test_fixtures/fixup/notsogood/missing_foreign_key/translations/zh_CN.all.json b/test_fixtures/fixup/notsogood/missing_foreign_key/translations/all.zh_CN.json similarity index 100% rename from test_fixtures/fixup/notsogood/missing_foreign_key/translations/zh_CN.all.json rename to test_fixtures/fixup/notsogood/missing_foreign_key/translations/all.zh_CN.json diff --git a/test_fixtures/fixup/notsogood/multiple_update/translations/en_US.all.json b/test_fixtures/fixup/notsogood/multiple_update/translations/all.en_US.json similarity index 100% rename from test_fixtures/fixup/notsogood/multiple_update/translations/en_US.all.json rename to test_fixtures/fixup/notsogood/multiple_update/translations/all.en_US.json diff --git a/test_fixtures/fixup/notsogood/multiple_update/translations/zh_CN.all.json b/test_fixtures/fixup/notsogood/multiple_update/translations/all.zh_CN.json similarity index 100% rename from test_fixtures/fixup/notsogood/multiple_update/translations/zh_CN.all.json rename to test_fixtures/fixup/notsogood/multiple_update/translations/all.zh_CN.json diff --git a/test_fixtures/fixup/notsogood/update/translations/en_US.all.json b/test_fixtures/fixup/notsogood/update/translations/all.en_US.json similarity index 100% rename from test_fixtures/fixup/notsogood/update/translations/en_US.all.json rename to test_fixtures/fixup/notsogood/update/translations/all.en_US.json diff --git a/test_fixtures/fixup/notsogood/update/translations/zh_CN.all.json b/test_fixtures/fixup/notsogood/update/translations/all.zh_CN.json similarity index 100% rename from test_fixtures/fixup/notsogood/update/translations/zh_CN.all.json rename to test_fixtures/fixup/notsogood/update/translations/all.zh_CN.json diff --git a/test_fixtures/fixup/notsogood/update_add/translations/en_US.all.json b/test_fixtures/fixup/notsogood/update_add/translations/all.en_US.json similarity index 100% rename from test_fixtures/fixup/notsogood/update_add/translations/en_US.all.json rename to test_fixtures/fixup/notsogood/update_add/translations/all.en_US.json diff --git a/test_fixtures/fixup/notsogood/update_add/translations/zh_CN.all.json b/test_fixtures/fixup/notsogood/update_add/translations/all.zh_CN.json similarity index 100% rename from test_fixtures/fixup/notsogood/update_add/translations/zh_CN.all.json rename to test_fixtures/fixup/notsogood/update_add/translations/all.zh_CN.json diff --git a/test_fixtures/rewrite_package/init_code_snippet_filename/input_files/init_code_snippet.go.template b/test_fixtures/rewrite_package/init_code_snippet_filename/input_files/init_code_snippet.go.template index 4847420..a009d6d 100644 --- a/test_fixtures/rewrite_package/init_code_snippet_filename/input_files/init_code_snippet.go.template +++ b/test_fixtures/rewrite_package/init_code_snippet_filename/input_files/init_code_snippet.go.template @@ -4,7 +4,7 @@ import ( "fmt" "path/filepath" - i18n "github.com/maximilien/i18n4go/i18n4go/i18n" + "github.com/maximilien/i18n4go/i18n4go/i18n" ) var T i18n.TranslateFunc From 8ac62ea32960ac76b3216cfb7e5a9ac56014e462 Mon Sep 17 00:00:00 2001 From: Aerex Date: Fri, 5 Jul 2024 19:08:15 -0400 Subject: [PATCH 07/13] chore: updated build path to match new root package --- bin/build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/build b/bin/build index a9ea41f..0f9d85e 100755 --- a/bin/build +++ b/bin/build @@ -20,4 +20,4 @@ echo -e "\n Formatting packages..." go fmt ./... echo -e "\nGenerating Binary..." -go build -o $(dirname $0)/../out/i18n4go ./i18n4go.go +go build -o $(dirname $0)/../out/i18n4go ./i18n4go/i18n4go.go From e32be4accb75844002f856af7ba913d7b3c804c8 Mon Sep 17 00:00:00 2001 From: Aerex Date: Fri, 5 Jul 2024 19:12:43 -0400 Subject: [PATCH 08/13] chore: removed log statements --- i18n4go/cmds/create_translations.go | 2 -- i18n4go/i18n/init.go | 4 ---- 2 files changed, 6 deletions(-) diff --git a/i18n4go/cmds/create_translations.go b/i18n4go/cmds/create_translations.go index f765db8..529c3b6 100644 --- a/i18n4go/cmds/create_translations.go +++ b/i18n4go/cmds/create_translations.go @@ -221,8 +221,6 @@ func (ct *createTranslations) googleTranslate(translateString string, language s escapedTranslateString := url.QueryEscape(translateString) googleTranslateUrl := "https://www.googleapis.com/language/translate/v2?key=" + ct.options.GoogleTranslateApiKeyFlag + "&target=" + language + "&q=" + escapedTranslateString - // REMOVEME: Do not commit - fmt.Printf("\ngoogleTranslateUrl: %s\n", googleTranslateUrl) response, err := http.Get(googleTranslateUrl) if err != nil { ct.Println(i18n.T("i18n4go: ERROR invoking Google Translate: "), googleTranslateUrl) diff --git a/i18n4go/i18n/init.go b/i18n4go/i18n/init.go index 3d6bddb..f7bc654 100644 --- a/i18n4go/i18n/init.go +++ b/i18n4go/i18n/init.go @@ -99,10 +99,6 @@ func initWithUserLocale(packageName, i18nDirname string, assetFn AssetFunc) (str func mustLoadDefaultLocale(packageName, i18nDirname string, assetFn AssetFunc) string { userLocale := DEFAULT_LOCALE - // REMOVEME: Do not commit - fmt.Printf("\npackageName: %s\n", packageName) - // REMOVEME: Do not commit - fmt.Printf("\ni18nDirname: %s\n", i18nDirname) err := loadFromAsset(packageName, i18nDirname, DEFAULT_LOCALE, DEFAULT_LANGUAGE, assetFn) if err != nil { panic("Could not load en_US language files. God save the queen. " + err.Error()) From f607fd347eef257e95b6d842d2ae9dfdaadc5e6e Mon Sep 17 00:00:00 2001 From: Aerex Date: Fri, 12 Jul 2024 10:59:15 -0400 Subject: [PATCH 09/13] build: used go install to install go-bindata --- bin/validate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/validate b/bin/validate index 508f537..178397b 100755 --- a/bin/validate +++ b/bin/validate @@ -22,7 +22,7 @@ if [[ -z $(command -v go-bindata) ]]; then echo -e "\nInstalling go-bindata..." # install outside of GO PATH pushd /tmp >/dev/null - go get -u github.com/go-bindata/go-bindata/... + go install -a -v github.com/go-bindata/go-bindata/...@latest popd > /dev/null fi From 178d19bb0ce285c94e8f6e209ae454118bdfc7a0 Mon Sep 17 00:00:00 2001 From: Aerex Date: Fri, 12 Jul 2024 11:00:51 -0400 Subject: [PATCH 10/13] build: fixed retrieving project dir --- bin/validate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/validate b/bin/validate index 178397b..183fa13 100755 --- a/bin/validate +++ b/bin/validate @@ -17,7 +17,7 @@ set -e echo -e "\nUpdate (Re)generated translation files..." -PROJ_DIR=$(dirname $0) +PROJ_DIR=$(cd $(dirname $(dirname $0)) && pwd) if [[ -z $(command -v go-bindata) ]]; then echo -e "\nInstalling go-bindata..." # install outside of GO PATH From 05c7a75f64ef314198dcb8529f3fb0da7ca3cc2e Mon Sep 17 00:00:00 2001 From: Aerex Date: Fri, 12 Jul 2024 12:27:49 -0400 Subject: [PATCH 11/13] fix: used root package from proj when using i18n4go in source --- i18n4go/i18n/i18n_init.go | 4 +++- i18n4go/i18n/i18n_init.go.template | 2 +- i18n4go/i18n/init.go | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/i18n4go/i18n/i18n_init.go b/i18n4go/i18n/i18n_init.go index 62e6a8b..eb1d882 100644 --- a/i18n4go/i18n/i18n_init.go +++ b/i18n4go/i18n/i18n_init.go @@ -1,9 +1,11 @@ package i18n +import "path/filepath" + var T TranslateFunc func init() { - T = Init("", GetResourcesPath(), func(asset string) ([]byte, error) { + T = Init("", filepath.Join("i18n4go", GetResourcesPath()), func(asset string) ([]byte, error) { return Asset(asset) }) } diff --git a/i18n4go/i18n/i18n_init.go.template b/i18n4go/i18n/i18n_init.go.template index b64076b..573d44b 100644 --- a/i18n4go/i18n/i18n_init.go.template +++ b/i18n4go/i18n/i18n_init.go.template @@ -3,7 +3,7 @@ package __PACKAGE__NAME__ import ( "path/filepath" - i18n "github.com/maximilien/i18n4go/i18n4go/i18n" + "github.com/maximilien/i18n4go/i18n4go/i18n" ) var T goi18n.TranslateFunc diff --git a/i18n4go/i18n/init.go b/i18n4go/i18n/init.go index f7bc654..7b47228 100644 --- a/i18n4go/i18n/init.go +++ b/i18n4go/i18n/init.go @@ -49,7 +49,7 @@ var SUPPORTED_LOCALES = map[string]string{ "zh": "zh_CN", } var ( - RESOURCES_PATH = filepath.Join("i18n4go", "i18n", "resources") + RESOURCES_PATH = filepath.Join("i18n", "resources") bundle *go_i18n.Bundle ) From ac3b65e9bde730c1cd8f33eac94d21e9cfeaca3c Mon Sep 17 00:00:00 2001 From: Aerex Date: Fri, 12 Jul 2024 12:29:28 -0400 Subject: [PATCH 12/13] chore: fixed comment --- i18n4go/cmds/checkup.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n4go/cmds/checkup.go b/i18n4go/cmds/checkup.go index 9b6523f..0214768 100644 --- a/i18n4go/cmds/checkup.go +++ b/i18n4go/cmds/checkup.go @@ -221,7 +221,7 @@ func (cu *Checkup) inspectCallExpr(translatedStrings []string, stmtMap map[strin expr := node.Fun.(*ast.SelectorExpr) if ident, ok := expr.X.(*ast.Ident); ok { funName := expr.Sel.Name - // inspect any .i18n.T() or .t() method calls (eg. i18n.T()) + // inspect any .T() or .t() method calls (eg. i18n.T()) if ident.Name == cu.options.QualifierFlag && (funName == "T" || funName == "t") { translatedStrings = cu.inspectTFunc(translatedStrings, stmtMap, *node) } From 84c2ee76032d6d5f36bad03d188a6bf3f47a9653 Mon Sep 17 00:00:00 2001 From: Aerex Date: Fri, 12 Jul 2024 12:59:07 -0400 Subject: [PATCH 13/13] chore: removed redundant import qualifier in snippet --- i18n4go/cmds/rewrite_package.go | 2 +- .../rewrite_package/f_option/expected_output/i18n_init.go | 2 +- .../f_option/expected_output/nested_dir/i18n_init.go | 2 +- .../expected_output/i18n_init_default.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/i18n4go/cmds/rewrite_package.go b/i18n4go/cmds/rewrite_package.go index cdc38f9..799ae6f 100644 --- a/i18n4go/cmds/rewrite_package.go +++ b/i18n4go/cmds/rewrite_package.go @@ -44,7 +44,7 @@ const ( import ( "path/filepath" - i18n "github.com/maximilien/i18n4go/i18n4go/i18n" + "github.com/maximilien/i18n4go/i18n4go/i18n" ) var T i18n.TranslateFunc diff --git a/test_fixtures/rewrite_package/f_option/expected_output/i18n_init.go b/test_fixtures/rewrite_package/f_option/expected_output/i18n_init.go index f894386..6e2184b 100644 --- a/test_fixtures/rewrite_package/f_option/expected_output/i18n_init.go +++ b/test_fixtures/rewrite_package/f_option/expected_output/i18n_init.go @@ -3,7 +3,7 @@ package input_files import ( "path/filepath" - i18n "github.com/maximilien/i18n4go/i18n4go/i18n" + "github.com/maximilien/i18n4go/i18n4go/i18n" ) var T i18n.TranslateFunc diff --git a/test_fixtures/rewrite_package/f_option/expected_output/nested_dir/i18n_init.go b/test_fixtures/rewrite_package/f_option/expected_output/nested_dir/i18n_init.go index 2911004..0f54b7d 100644 --- a/test_fixtures/rewrite_package/f_option/expected_output/nested_dir/i18n_init.go +++ b/test_fixtures/rewrite_package/f_option/expected_output/nested_dir/i18n_init.go @@ -3,7 +3,7 @@ package nested_dir import ( "path/filepath" - i18n "github.com/maximilien/i18n4go/i18n4go/i18n" + "github.com/maximilien/i18n4go/i18n4go/i18n" ) var T i18n.TranslateFunc diff --git a/test_fixtures/rewrite_package/init_code_snippet_filename/expected_output/i18n_init_default.go b/test_fixtures/rewrite_package/init_code_snippet_filename/expected_output/i18n_init_default.go index 14c1430..6e9443c 100644 --- a/test_fixtures/rewrite_package/init_code_snippet_filename/expected_output/i18n_init_default.go +++ b/test_fixtures/rewrite_package/init_code_snippet_filename/expected_output/i18n_init_default.go @@ -3,7 +3,7 @@ package input_files import ( "path/filepath" - i18n "github.com/maximilien/i18n4go/i18n4go/i18n" + "github.com/maximilien/i18n4go/i18n4go/i18n" ) var T i18n.TranslateFunc