{"record":{"id":"090d1abca14d6b2b","repo":"abpframework/abp","slug":"target-culture-is-missing","errorCode":null,"errorMessage":"Target culture is missing!","messagePattern":"Target culture is missing!","errorType":"exception","errorClass":"CliUsageException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/TranslateCommand.cs","lineNumber":49,"sourceCode":"            await VerifyJsonAsync(currentDirectory);\n            return;\n        }\n\n        var referenceCulture = commandLineArgs.Options.GetOrNull(Options.ReferenceCulture.Short, Options.ReferenceCulture.Long) ?? \"en\";\n        var allValues = commandLineArgs.Options.ContainsKey(Options.AllValues.Short) || commandLineArgs.Options.ContainsKey(Options.AllValues.Long);\n\n        // Apply abp-translation.json file\n        if (commandLineArgs.Options.ContainsKey(Options.Apply.Short) || commandLineArgs.Options.ContainsKey(Options.Apply.Long))\n        {\n            var inputFile = Path.Combine(currentDirectory, commandLineArgs.Options.GetOrNull(Options.File.Short, Options.File.Long) ?? \"abp-translation.json\");\n            await ApplyAbpTranslateInfoAsync(currentDirectory, inputFile);\n            return;\n        }\n\n        var targetCulture = commandLineArgs.Options.GetOrNull(Options.Culture.Short, Options.Culture.Long);\n        if (targetCulture == null)\n        {\n            throw new CliUsageException(\"Target culture is missing!\" + Environment.NewLine + Environment.NewLine + GetUsageInfo());\n        }\n\n        // Translate online\n        if (commandLineArgs.Options.ContainsKey(Options.Online.Long))\n        {\n            var authKey = commandLineArgs.Options.GetOrNull(Options.DeepLAuthKey.Short, Options.DeepLAuthKey.Short);\n            if (authKey == null)\n            {\n                throw new CliUsageException(\"DeepL auth key is missing!\" + Environment.NewLine + Environment.NewLine + GetUsageInfo());\n            }\n            await TranslateAbpTranslateInfoAsync(currentDirectory, targetCulture, referenceCulture, allValues, authKey);\n            return;\n        }\n\n        // Generate abp-translation.json file\n        var outputFile = Path.Combine(currentDirectory, commandLineArgs.Options.GetOrNull(Options.Output.Short, Options.Output.Long) ?? \"abp-translation.json\");\n        await GenerateAbpTranslateInfoAsync(currentDirectory, targetCulture, referenceCulture, allValues, outputFile);\n    }","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/TranslateCommand.cs#L31-L67","documentation":"Thrown by TranslateCommand.ExecuteAsync when the -c/--culture option is not provided AND neither --apply/-a nor --verify is set. The target culture specifies which language to translate into (e.g., 'zh-Hans', 'de', 'tr'). It is required for both translation generation and online translation modes. The only mode that doesn't require it is --apply (which reads culture from the translation file).","triggerScenarios":"Running 'abp translate' without --culture and without --apply. For example: 'abp translate' alone, or 'abp translate --all-values' without a culture.","commonSituations":"Developer forgets to specify the target culture, misunderstands that --apply and --culture are different modes, or expects the command to prompt interactively.","solutions":["Add --culture <culture-name> (e.g., --culture zh-Hans, --culture de, --culture tr)","If applying a previously generated translation file, use --apply instead of --culture","Run 'abp help translate' to see all available options"],"exampleFix":"// before\nabp translate\n\n// after\nabp translate --culture zh-Hans","handlingStrategy":"validation","validationCode":"// Validate that culture is provided when not in apply mode\nvar isApply = commandLineArgs.Options.ContainsKey(\"a\") || commandLineArgs.Options.ContainsKey(\"apply\");\nvar isVerify = commandLineArgs.Options.ContainsKey(\"verify\");\nvar hasCulture = commandLineArgs.Options.ContainsKey(\"c\") || commandLineArgs.Options.ContainsKey(\"culture\");\n\nif (!isApply && !isVerify && !hasCulture)\n{\n    Console.Error.WriteLine(\"Error: --culture is required (or use --apply / --verify).\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    await translateCommand.ExecuteAsync(commandLineArgs);\n}\ncatch (CliUsageException ex) when (ex.Message.Contains(\"Target culture is missing\"))\n{\n    Console.Error.WriteLine(\"Missing --culture. Example: abp translate -c zh-Hans\");\n}","preventionTips":["Always specify --culture for generation and online modes","Remember that --apply and --verify are separate modes that don't need --culture","Use valid .NET culture names (e.g., zh-Hans, de, tr, fr)"],"tags":["translate","cli","localization","missing-argument","command-line"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}