Android中的string.sml中xliff:g标签的使用用法

本文详细介绍了xliff:g标签的功能与应用,包括如何利用该标签动态插入数据,并解释了不同格式化选项如字符串、整数及浮点数的表示方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天遇到了这个xliff:g标签不懂,找了好久,最后找到了答案,为了以后方便自己记忆于是把对xliff:g标签的学习总结如下:

我的代码片段:

    <string name="name_already_exist">用户名:<xliff:g id="id1" example="abc">%1$s</xliff:g>已存在,请重新输入!</string>

这个主要用于动态的插入数据使用:

属性id可以随便命名 
属性example表示举例说明,可以省略 
%n$ms:代表输出的是字符串,n代表是第几个参数,设置m的值可以在输出之前放置空格 
%n$md:代表输出的是整数,n代表是第几个参数,设置m的值可以在输出之前放置空格,也可以设为0m,在输出之前放置m个0 
%n$mf:代表输出的是浮点数,n代表是第几个参数,设置m的值可以控制小数位数,如m=2.2时,输出格式为00.00

也可简单写成:

%d   (表示整数)

%f    (表示浮点数)

%s   (表示字符串)


这是用户区的settings.json: { "code-runner.fileDirectoryAsCwd": true, "code-runner.runInTerminal": true, "code-runner.clearPreviousOutput": true, "security.workspace.trust.untrustedFiles": "open", "markdown-preview-enhanced.mathRenderingOption": "MathJax", "markdown.extension.completion.enabled": true, "python.defaultInterpreterPath": "C:\\Users\\imsfp\\AppData\\Local\\Programs\\Python\\Python313\\python.exe", "editor.fontFamily": "Maple Mono, Consolas, monospace", "terminal.integrated.fontFamily": "monospace", "workbench.iconTheme": "vscode-icons", "workbench.colorCustomizations": { "editorCursor.foreground": "#FF0000", "terminalCursor.foreground": "#FF5555" }, "window.titleBarStyle": "custom", "python.terminal.executeInFileDir": true, "python.analysis.completeFunctionParens": true, "code-runner.executorMap": { "python": "set PYTHONIOENCODING=utf8 && $pythonPath -u $fullFileName" }, "code-runner.showExecutionMessage": false, "git.ignoreMissingGitWarning": true, "git.openRepositoryInParentFolders": "never", "github.copilot.chat.agent.thinkingTool": true, "github.copilot.chat.languageContext.typescript.enabled": true, "github.copilot.chat.newWorkspaceCreation.enabled": true, "github.copilot.chat.editor.temporalContext.enabled": true, "terminal.integrated.defaultProfile.windows": "Windows PowerShell", "editor.formatOnSave": true, "python.analysis.typeCheckingMode": "strict", "chat.editing.confirmEditRequestRetry": false, "github.copilot.chat.agent.toolValidation": "strict", "github.copilot.codeQualityScan.enabled": true, "chat.mcp.discovery.enabled": true, "[markdown]": { "editor.defaultFormatter": "DavidAnson.vscode-markdownlint" }, "explorer.confirmDelete": false, "files.autoSave": "afterDelay", "geminicodeassist.project": "noble-subset-466101-u9", "IntelligentCodeCompletion.disableLanguages": { "vue": "false", "typescript": "false", "javascript": "false", "python": "false", "go": "false", "c": "false", "c++": "false", "shell": "false", "bash": "false", "batch": "false", "lua": "false", "java": "false", "php": "false", "ruby": "false" }, "FunctionQuickCommands.disableLanguages": { "typescript": "false", "javascript": "false", "python": "false", "go": "false", "c": "false", "c++": "false", "lua": "false", "java": "false", "php": "false", "ruby": "false" }, "IntelligentCodeCompletion.enabled": true, "zgsm.allowedCommands": [ "npm test", "npm install", "tsc", "git log", "git diff", "git show" ], "github.copilot.nextEditSuggestions.enabled": true, "[python]": { "diffEditor.ignoreTrimWhitespace": false, "editor.defaultColorDecorators": "never", "gitlens.codeLens.symbolScopes": [ "!Module" ], "editor.formatOnType": true, "editor.wordBasedSuggestions": "off" }, "terminal.integrated.splitCwd": "workspaceRoot", "code-runner.executorMapByFileExtension": { ".vb": "cd $dir && vbc /nologo $fileName && $dir$fileNameWithoutExt", ".vbs": "cscript //Nologo", ".scala": "scala", ".jl": "julia", ".cr": "crystal", ".ml": "ocaml", ".zig": "zig run", ".exs": "elixir", ".hx": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt", ".rkt": "racket", ".scm": "csi -script", ".ahk": "autohotkey", ".au3": "autoit3", ".kt": "cd $dir && kotlinc $fileName -include-runtime -d $fileNameWithoutExt.jar && java -jar $fileNameWithoutExt.jar", ".kts": "kotlinc -script", ".dart": "dart", ".pas": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt", ".pp": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt", ".d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt", ".hs": "runhaskell", ".nim": "nim compile --verbosity:0 --hints:off --run", ".csproj": "dotnet run --project", ".fsproj": "dotnet run --project", ".lisp": "sbcl --script", ".kit": "kitc --run", ".v": "v run", ".vsh": "v run", ".sass": "sass --style expanded", ".cu": "cd $dir && nvcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt", ".ring": "ring", ".sml": "cd $dir && sml $fileName", ".mojo": "mojo run", ".erl": "escript", ".spwn": "spwn build", ".pkl": "cd $dir && pkl eval -f yaml $fileName -o $fileNameWithoutExt.yaml", ".gleam": "gleam run -m $fileNameWithoutExt" }, "code-runner.saveAllFilesBeforeRun": true, "code-runner.saveFileBeforeRun": true, "code-runner.languageIdToFileExtensionMap": { "bat": ".bat", "powershell": ".ps1", "typescript": ".ts" }, "code-runner.terminalRoot": "'/mnt/", } 检查是哪个设置出了问题使得coderunner持续的使用unix风格命令
最新发布
07-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值