Date/Time 占位符本地化

Date/Time placeholder localization

我正在处理 Orbeon 2018 form-runner 中 Date/Time 占位符的本地化(尽管这似乎在 2019 年和 2020 年都没有改变).

我要找的在orbeon-form-runner.jar\xbl\orbeon\date\date.xbl中有定义(和time/time.xbl,不过目前我觉得已经足够了讨论第一个) 文件,更具体的在这里:

<xf:var
    name="placeholder"
    value="
        let $format      := xxf:property('oxf.xforms.format.input.date'),
            $cleaned     := translate($format, '[01]', ''),
            $duplicate   := replace(replace(replace($cleaned,
                            'M', 'MM'),
                            'D', 'DD'),
                            'Y', 'YYYY'),
            $format-en   := instance('orbeon-resources')/resource[@xml:lang = 'en']/format,
            $format-lang := xxf:r('format'),
            $translated  := translate($duplicate, $format-en, $format-lang)
        return
            $translated
    "/>
<xh:input type="text" placeholder="{$placeholder}" id="input"/> 

占位符变量组装在html输入上,这很清楚。

在我的语言中,YYYY、MM、DD 不是日期部分的正确占位符,因此我的要求是根据当前请求区域设置更改它们。

起初我尝试扩展 apps/fr/18n/resource.xml 中的标签,并将静态 'MM'、'DD' 等常量替换为 xxf:r('components.labels.MM', '|fr-fr-resources|')) 和类似的事情没有任何成功(好吧,占位符已经显示,但与我修改之前可见的默认占位符相同)。

我的第二种方法是将这些标签放到同一个文件中,并以同样的方式引用它们:xxf:r('MM'),没有成功(与第一种情况相同的结果).

我的第三种方法,我现在在这里,是尝试对这些静态的东西进行硬编码,并且只为我的语言环境修复这些标签(使用 xsl:choose),我在这里:我找不到我到底怎么能在这里获取请求区域设置(在 xbl 文件的上下文中)。 变量指向正确的当前请求语言环境(它们显示为“en”)。

你知道如何正确解决这个问题吗?

您通过oxf.xforms.format.input.date属性定义输入格式。并且只能有一种输入格式,不能依赖于当前语言

在占位符中,组件显示您在 oxf.xforms.format.input.date 中定义的格式,但更改字母 M(月)、D(日)和 Y(年)以匹配当前语言,并且这是通过将 resource 添加到 orbeon-resources 来完成的,目前有:

<resource xml:lang="en"><format>MDY</format></resource>
<resource xml:lang="fr"><format>MJA</format></resource>
<resource xml:lang="de"><format>MTJ</format></resource>
<resource xml:lang="pl"><format>YMD</format></resource>