gpt4 book ai didi

internationalization - cucumber /小 cucumber 的翻译在哪里?

转载 作者:行者123 更新时间:2023-12-04 00:15:01 27 4
gpt4 key购买 nike

我想用法语翻译这个小 cucumber 场景。

Feature: Test the validation on the person object

Background:
Given the language is 'english'

Scenario: Create a person with firstName empty and check we have a violation error message on it
Given we create a new person
And we set firstName ''
And we set lastName 'smith'
When we apply validation
Then we should have 1 violation
And we should have a error message on 'firstName' that says 'may not be empty'

但是我没有看到背景的翻译在哪里,我发现(偶然)Java @Etantdonné(类似于@Given)中的注释实际上用在带有空格的特征文件中:“Etant donné”。

关于这一点,我在 cucumber 站点文档中找不到。

有人可以给我一个链接以了解如何在 cucumber /小 cucumber 中使用 i18n 吗?

最佳答案

查看可用语言列表

> cucumber --i18n help

列出特定语言的关键字
> cucumber --i18n <language_code>

> cucumber --i18n fr

for Java, you'll need a full command line: java -cp "jars/*" cucumber.api.cli.Main --i18n fr (where "jars/*" is the folder that your Cucumber/Gherkin jars are located)



特征文件中的标题

请记住,任何不同于 en 的语言应该用 # language: ... 明确标记在您的 *.feature file 开头的评论:

例子:
# language: fr
**Fonctionnalité: ...**
...

对于法语。如果省略此标题,Cucumber 将默认为英文 (en) .

This way your features will hold all the information about its content type, which is very important for methodologies like BDD and also gives Cucumber the ability to have multilanguage features in one suite.



所有小 cucumber 词都已翻译

例如法语:
  • 场景- Scénario
  • 场景大纲 - Plan du scénario or Plan du Scénario
  • 然后 - Alors
  • 当 - Quand
  • 和 - Et que
  • 但是 - Mais que

  • 等等 ...

    语言的 Cucumber JSON 数据

    你可以在这里找到小 cucumber 的所有翻译 : https://github.com/cucumber/gherkin3/blob/master/gherkin-languages.json

    法语的 JSON 数据
    fr: {
    and: [
    "* ",
    "Et que ",
    "Et qu'",
    "Et "
    ],
    background: [
    "Contexte"
    ],
    but: [
    "* ",
    "Mais que ",
    "Mais qu'",
    "Mais "
    ],
    examples: [
    "Exemples"
    ],
    feature: [
    "Fonctionnalité"
    ],
    given: [
    "* ",
    "Soit ",
    "Etant donné que ",
    "Etant donné qu'",
    "Etant donné ",
    "Etant donnée ",
    "Etant donnés ",
    "Etant données ",
    "Étant donné que ",
    "Étant donné qu'",
    "Étant donné ",
    "Étant donnée ",
    "Étant donnés ",
    "Étant données "
    ],
    name: "French",
    native: "français",
    scenario: [
    "Scénario"
    ],
    scenarioOutline: [
    "Plan du scénario",
    "Plan du Scénario"
    ],
    then: [
    "* ",
    "Alors "
    ],
    when: [
    "* ",
    "Quand ",
    "Lorsque ",
    "Lorsqu'"
    ]
    },

    希望它会帮助你...

    关于internationalization - cucumber /小 cucumber 的翻译在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34257188/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com