|
252 | 252 | <section id="task-localization"> |
253 | 253 | <h1>Task Localization<a class="headerlink" href="#task-localization" title="Link to this heading">¶</a></h1> |
254 | 254 | <p>TAPS and PsyFlow make cross-cultural localization efficient by cleanly separating task logic from configuration and content. This modular design allows researchers to adapt paradigms across languages and cultural contexts <strong>without modifying the task code</strong>, promoting global accessibility, reproducibility, and reuse.</p> |
| 255 | +<p><strong>Why It Matters</strong>: Localization is essential for making psychological tasks globally accessible and inclusive. By adapting tasks to different languages and cultural contexts, researchers can extend their reach, maintain standardization across implementations, ensure reproducibility of results, and improve usability for diverse participant groups—including children, older adults, and individuals with limited literacy.</p> |
| 256 | +<p><strong>How It Works</strong> In a TAPS-compliant task, all participant-facing content is cleanly separated from the task logic and stored in the <code class="docutils literal notranslate"><span class="pre">config.yaml</span></code> file. Specifically, localization targets the <code class="docutils literal notranslate"><span class="pre">subinfo_mapping</span></code> section (for registration labels and messages) and the <code class="docutils literal notranslate"><span class="pre">stimuli</span></code> section (for all <code class="docutils literal notranslate"><span class="pre">text</span></code> or <code class="docutils literal notranslate"><span class="pre">textbox</span></code> content). This modular structure enables full language adaptation without modifying any core Python code.</p> |
255 | 257 | <section id="manual-adaptation-quick-and-easy"> |
256 | 258 | <h2>1. Manual Adaptation (Quick and Easy)<a class="headerlink" href="#manual-adaptation-quick-and-easy" title="Link to this heading">¶</a></h2> |
257 | 259 | <p>The simplest way to localize your task is to <strong>manually translate</strong> the <code class="docutils literal notranslate"><span class="pre">config/config.yaml</span></code> file. This is ideal when you’re using LLMs interactively (e.g., ChatGPT, Gemini, DeepSeek, Claude).</p> |
258 | 260 | <p>Paste your YAML content directly into an LLM chat window, along with a clear instruction.</p> |
259 | 261 | <p><strong>Here’s an example prompt:</strong></p> |
260 | | -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>Translate the following YAML fields into Japanese. |
261 | | -1. The right-hand values of subinfo_mapping (e.g., messages, instructional text). |
262 | | -2. The text content of stimuls of text and textbox |
263 | | -3. Do not modify YAML structure, indentation, or key names. |
264 | | -4. Preserve placeholder variables such as {field}, {duration}, {block_num} exactly as they are. |
265 | | -5. For multiline text fields, preserve line breaks and do not introduce extra quotation marks or escape characters. |
266 | | -6. Do not include any commentary, markdown, or explanation—output the translated YAML only. |
267 | | -7. Output the full yaml content in a code block |
268 | | -Here is the original yaml content: |
269 | | -</pre></div> |
270 | | -</div> |
271 | 262 | <p><strong>Orignal config.yaml</strong></p> |
272 | 263 | <p>To save space we just show the relevant content.</p> |
273 | | -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span># config.yaml |
274 | | -# === Subject info === |
275 | | -subinfo_mapping: |
276 | | - subject_id: "被试号" |
277 | | - subname: "被试姓名(拼音)" |
278 | | - age: "年龄" |
279 | | - gender: "性别" |
280 | | - Male: "男" |
281 | | - Female: "女" |
282 | | - registration_failed: "注册失败。" |
283 | | - registration_successful: "注册成功!" |
284 | | - invalid_input: "字段 {field} 输入无效" |
285 | | - |
286 | | -# === Stimuli (for SST task) === |
287 | | -stimuli: |
288 | | - fixation: |
289 | | - type: text |
290 | | - text: "+" |
291 | | - color: white |
292 | | - |
293 | | - no_response_feedback : |
294 | | - type: text |
295 | | - text: | |
296 | | - 【未按键】 |
297 | | - 请在箭头出现后按键 |
298 | | - font: SimHei |
299 | | - height: 0.78 |
300 | | - |
301 | | - block_break: |
302 | | - type: text |
303 | | - text: | |
304 | | - 【休息提示】 |
305 | | - |
306 | | - 第 {block_num} / {total_blocks} 部分完成。 |
307 | | - 击中率:{go_accuracy:.2f} |
308 | | - 正确停止率:{stop_accuracy:.2f} |
309 | | - |
310 | | - 请在充分休息后按【空格键】 |
311 | | - 进入下一部分 |
312 | | - color: white |
313 | | - font: SimHei |
314 | | - height: 0.78 |
315 | | - |
316 | | - |
317 | | - instruction_text: |
318 | | - type: textbox |
319 | | - text: | |
320 | | - 【停止信号任务说明】 |
321 | | - |
322 | | - 在本任务中,您将看到箭头指向左或右 |
323 | | - 您的目标是尽快且准确地做出反应 |
324 | | - - 如果箭头指向左,请用左手食指按【F】 |
325 | | - - 如果箭头指向右,请用右手食指按【J】 |
326 | | - |
327 | | - 注意:在某些试次中 |
328 | | - 箭头出现后不久会出现红色箭头 |
329 | | - 当看到红色箭头时 |
330 | | - 请尽力抑制您的反应不要按任何按键 |
331 | | - |
332 | | - 在没有红色箭头出现时,请快速做出反应 |
333 | | - 出现红色箭头时,请尽量不做出任何按键反应 |
334 | | - |
335 | | - 准备好后,请按【空格键】开始任务。 |
336 | | - color: white |
337 | | - font: SimHei |
338 | | - alignment: center |
339 | | - letterHeight: 0.78 |
340 | | - units: deg |
341 | | - size: [20, 5] |
342 | | - |
343 | | - iti_stim: |
344 | | - type: text |
345 | | - text: "" |
346 | | - |
347 | | - good_bye: |
348 | | - type: textbox |
349 | | - text: | |
350 | | - 任务结束 |
351 | | - |
352 | | - 感谢您的参与 |
353 | | - 请按【空格键】键退出 |
354 | | - color: white |
355 | | - font: SimHei |
356 | | - alignment: center |
357 | | - letterHeight: 0.78 |
358 | | - |
359 | | -</pre></div> |
360 | | -</div> |
361 | 264 | <p>Then copy the translated YAML back into your project and save as a localized config file, e.g., <code class="docutils literal notranslate"><span class="pre">config.ja.yaml</span></code>.</p> |
362 | 265 | <p><strong>Translated config.ja.yaml</strong></p> |
363 | 266 | <p>To save space we just show the relevant content.</p> |
364 | | -<div class="highlight-default notranslate"><div class="highlight"><pre><span></span># config.yaml |
365 | | -# === Subject info === |
366 | | -subinfo_mapping: |
367 | | - subject_id: "被験者ID" |
368 | | - subname: "被験者氏名(ローマ字)" |
369 | | - age: "年齢" |
370 | | - gender: "性別" |
371 | | - Male: "男性" |
372 | | - Female: "女性" |
373 | | - registration_failed: "登録に失敗しました。" |
374 | | - registration_successful: "登録に成功しました!" |
375 | | - invalid_input: "フィールド {field} の入力が無効です" |
376 | | - |
377 | | -# === Stimuli (for SST task) === |
378 | | -stimuli: |
379 | | - fixation: |
380 | | - type: text |
381 | | - text: "+" |
382 | | - color: white |
383 | | - |
384 | | - no_response_feedback : |
385 | | - type: text |
386 | | - text: | |
387 | | - 【未反応】 |
388 | | - 矢印が表示されたらキーを押してください |
389 | | - font: SimHei |
390 | | - height: 0.78 |
391 | | - |
392 | | - block_break: |
393 | | - type: text |
394 | | - text: | |
395 | | - 【休憩のお知らせ】 |
396 | | - |
397 | | - 第 {block_num} / {total_blocks} ブロックが完了しました。 |
398 | | - 命中率:{go_accuracy:.2f} |
399 | | - 正しく停止できた割合:{stop_accuracy:.2f} |
400 | | - |
401 | | - 十分に休憩した後、【スペースキー】を押して |
402 | | - 次のブロックに進んでください |
403 | | - color: white |
404 | | - font: SimHei |
405 | | - height: 0.78 |
406 | | - |
407 | | - instruction_text: |
408 | | - type: textbox |
409 | | - text: | |
410 | | - 【ストップシグナル課題の説明】 |
411 | | - |
412 | | - この課題では、矢印が左または右を指します。 |
413 | | - できるだけ素早く正確に反応してください。 |
414 | | - - 矢印が左を指したら、左手の人差し指で【F】を押してください。 |
415 | | - - 矢印が右を指したら、右手の人差し指で【J】を押してください。 |
416 | | - |
417 | | - 注意:一部の試行では、 |
418 | | - 矢印の直後に赤い矢印が表示されることがあります。 |
419 | | - 赤い矢印が表示されたら、 |
420 | | - 反応を抑えてキーを押さないようにしてください。 |
421 | | - |
422 | | - 赤い矢印が表示されなければ、すぐに反応してください。 |
423 | | - 赤い矢印が表示された場合は、できるだけ反応しないでください。 |
424 | | - |
425 | | - 準備ができたら【スペースキー】を押して課題を開始してください。 |
426 | | - color: white |
427 | | - font: SimHei |
428 | | - alignment: center |
429 | | - letterHeight: 0.78 |
430 | | - units: deg |
431 | | - size: [20, 5] |
432 | | - |
433 | | - iti_stim: |
434 | | - type: text |
435 | | - text: "" |
436 | | - |
437 | | - good_bye: |
438 | | - type: textbox |
439 | | - text: | |
440 | | - 課題終了 |
441 | | - |
442 | | - ご参加ありがとうございました |
443 | | - 【スペースキー】を押して終了してください |
444 | | - color: white |
445 | | - font: SimHei |
446 | | - alignment: center |
447 | | - letterHeight: 0.78 |
448 | | -</pre></div> |
449 | | -</div> |
450 | 267 | </section> |
451 | 268 | <section id="programmatic-localization-via-api"> |
452 | 269 | <h2>2. Programmatic Localization via API<a class="headerlink" href="#programmatic-localization-via-api" title="Link to this heading">¶</a></h2> |
@@ -494,7 +311,7 @@ <h2>3. Important Notes on Task Localization<a class="headerlink" href="#importan |
494 | 311 | <div class="bottom-of-page"> |
495 | 312 | <div class="left-details"> |
496 | 313 | <div class="copyright"> |
497 | | - Copyright © 2025, Zhipeng |
| 314 | + Copyright © 2025, Zhipeng Cao |
498 | 315 | </div> |
499 | 316 | Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s |
500 | 317 |
|
|
0 commit comments