lingo-linter-tool 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -11,7 +11,6 @@ const glob_1 = require("glob");
11
11
  const no_string_concat_1 = require("./linter/rules/no-string-concat");
12
12
  const missing_keys_1 = require("./linter/rules/missing-keys");
13
13
  const healer_1 = require("./healer");
14
- const reporter_1 = require("./utils/reporter");
15
14
  const program = new commander_1.Command();
16
15
  const calculateHealth = (errors, warnings) => {
17
16
  let score = 100 - errors * 5 - warnings * 2;
@@ -60,7 +59,6 @@ program
60
59
  console.log("");
61
60
  });
62
61
  const score = calculateHealth(errorCount, warningCount);
63
- await (0, reporter_1.uploadHealthScore)(score, errorCount, warningCount);
64
62
  const scoreColor = score > 80 ? chalk_1.default.green : score > 50 ? chalk_1.default.yellow : chalk_1.default.red;
65
63
  console.log(chalk_1.default.bold("-----------------------------------"));
66
64
  console.log(`Localization Health: ${scoreColor(score + " / 100")}`);
@@ -30,32 +30,32 @@ exports.Translator = void 0;
30
30
  const axios_1 = __importDefault(require("axios"));
31
31
  const dotenv = __importStar(require("dotenv"));
32
32
  dotenv.config();
33
- const API_KEY = process.env.LINGO_API_KEY;
34
- const API_URL = "https://api.lingo.dev/v1/translate";
33
+ const API_KEY = process.env.LINGO_API_KEY || process.env.OPENAI_API_KEY;
35
34
  class Translator {
36
35
  static async translate(text, targetLocale) {
37
36
  if (!text)
38
37
  return "";
39
38
  if (!API_KEY) {
40
- console.warn("⚠️ No LINGO_API_KEY found. Using mock mode.");
41
- return `[${targetLocale.toUpperCase()}] ${text}`;
39
+ console.warn("⚠️ MISSING API KEY: Cannot translate. Ensure LINGO_API_KEY is set in GitHub Secrets.");
40
+ return text;
42
41
  }
43
42
  try {
44
- const response = await axios_1.default.post(API_URL, {
43
+ const response = await axios_1.default.post("https://api.lingo.dev/v1/translate", {
45
44
  source: "en",
46
45
  target: targetLocale,
47
46
  content: text,
47
+ context: "UI String",
48
48
  }, {
49
49
  headers: {
50
50
  Authorization: `Bearer ${API_KEY}`,
51
51
  "Content-Type": "application/json",
52
52
  },
53
53
  });
54
- return (response.data.translation ||
55
- response.data.choices[0].message.content);
54
+ return response.data.translation;
56
55
  }
57
56
  catch (error) {
58
- console.error(`❌ API Error translating to ${targetLocale}:`, error);
57
+ const msg = error.response?.data?.message || error.message;
58
+ console.error(`❌ API Error (${targetLocale}): ${msg}`);
59
59
  return text;
60
60
  }
61
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lingo-linter-tool",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Localization linter and self-healing tool",
5
5
  "bin": {
6
6
  "lingo": "./dist/cli.js"