ResourceMessage

특성 자원에서 자국어 지원 가능 메시지(자국어 지원 참조)를 작성합니다.

선택적으로 특성은 형식화된 인수의 플레이스홀더를 지정할 수 있습니다. 형식화 지원 및 구문은 MessageFormat에 대한 JavaDoc에 설명되어 있습니다.

경고: JavaDoc에 설명된 대로 작은 따옴표 또는 어포스트로피(')를 출력해야 하는 경우 특성 텍스트에 두 개의 작은 따옴표('')를 지정해야 합니다.

XML 또는 HTML을 출력해야 하며 복합 토큰 형식화 또는 규칙을 변경하지 않고 메시지 텍스트를 변경하는 기능이 필요하지 않은 경우 XmlMessage를 대신 사용하십시오.

<?xml version="1.0" encoding="UTF-8"?>
<RuleSet name="Example_ResourceMessage"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation=
"http://www.curamsoftware.com/CreoleRulesSchema.xsd">
  <Class name="Person">

    <Attribute name="gender">
      <type>
        <javaclass name="String"/>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

    <Attribute name="isMarried">
      <type>
        <javaclass name="Boolean"/>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

    <Attribute name="firstName">
      <type>
        <javaclass name="String"/>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

    <Attribute name="surname">
      <type>
        <javaclass name="String"/>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

    <Attribute name="income">
      <type>
        <javaclass name="Number"/>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

    <!-- 사용자 로케일로 출력될 수 있는
        인사말을 리턴합니다. -->
    <Attribute name="simpleGreetingMessage">
      <type>
        <javaclass name="curam.creole.value.Message"/>
      </type>
      <derivation>
        <ResourceMessage key="simpleGreeting"
          resourceBundle="curam.creole.example.Messages"/>
      </derivation>
    </Attribute>

    <!-- 개인의 칭호와 성이 포함된
         인사말을 리턴합니다.
         인사말과 칭호는 자국어로 지원되지만
         성은 지원되지 않습니다(모든 로케일에서
         동일함). -->
    <Attribute name="parameterizedGreetingMessage">
      <type>
        <javaclass name="curam.creole.value.Message"/>
      </type>
      <derivation>
        <!-- 메시지 플레이스홀더에
             인수 전달 -->
        <ResourceMessage key="parameterizedGreeting"
          resourceBundle="curam.creole.example.Messages">
          <!-- 칭호 -->
          <choose>
            <type>
              <javaclass name="curam.creole.value.Message"/>
            </type>
            <when>
              <condition>
                <equals>
                  <reference attribute="gender"/>
                  <String value="Male"/>
                </equals>
              </condition>
              <value>
                <ResourceMessage key="title.male"
                  resourceBundle="curam.creole.example.Messages"/>
              </value>
            </when>
            <when>
              <condition>
                <reference attribute="isMarried"/>
              </condition>
              <value>
                <ResourceMessage key="title.female.married"
                  resourceBundle="curam.creole.example.Messages"/>
              </value>
            </when>
            <otherwise>
              <value>
                <ResourceMessage key="title.female.single"
                  resourceBundle="curam.creole.example.Messages"/>
              </value>
            </otherwise>
          </choose>

          <!-- 성 -->
          <reference attribute="surname"/>

        </ResourceMessage>
      </derivation>
    </Attribute>

    <!-- 사용자 로케일을 사용하여 소수점과
         천 단위 분리문자가 포함된 소수점 2자리의 수로
         수를 형식화합니다. -->
    <Attribute name="incomeStatementMessage">
      <type>
        <javaclass name="curam.creole.value.Message"/>
      </type>
      <derivation>
        <ResourceMessage key="incomeStatement"
          resourceBundle="curam.creole.example.Messages">
          <reference attribute="income"/>
        </ResourceMessage>
      </derivation>
    </Attribute>

  </Class>

</RuleSet>
그림 1. 예제 특성 - 영어
# curam/creole/example/Messages_en.properties 파일

simpleGreeting=Hello
parameterizedGreeting=Hello, {0} {1}
title.male=Mr.
title.female.single=Miss
title.female.married=Mrs.
incomeStatement=Income: USD{0,number,#0.00}
그림 2. 예제 특성 - 프랑스어
# curam/creole/example/Messages_fr.properties 파일

simpleGreeting=Bonjour
parameterizedGreeting=Bonjour, {0} {1}
title.male=M.
title.female.single=Mlle.
title.female.married=Mme.
incomeStatement=Revenue: EUR{0,number,#0.00}