Hi all,

sorry for the suspense ;-) Here are my ideas for an IMHO better i18n
message structure; please find listings of the current nodetypes and
my new proposal at the end of the mail.

1) I think the name "sling:Language" is misleading. I suggest to name
it "sling:MessageBundle", because it is a container for messages, not
a language.

2) Not sure for which use cases the sling:basename propert is needed.

3) sling:MessageBundle would only contain sling:Messages - we don't
want to mix it with other content if this structure is typically
auto-generated (eg. XLIFF importer)

4) sling:Message can be a node type, I don't see the case where one
wants to mix it with an existing node type structure and needs a
mixin. sling:MessageEntry can be removed then.

5) Not sure about the nt:hierarchyNode inheritance for
sling:Message(Entry) - do we need it?

6) The sling:key should be optional and only be used if the actual key
(which would typically be the original, eg. english, source string) is
not a valid JCR name. Otherwise the node name should be the key (no
need for generating message1, message2, etc.)

7) If the key is not valid for the jcr name, we generate a valid name
based on the key, to make the node structure more browsable.

Here is a pseudo algorithm for generating the key:

   input: node name
   esc = cut off 50 char from key
   esc = escape esc (using
org.apache.jackrabbit.util.Text.escapeIllegalJcrChars())
   if escaped == original key => put in node name
   else => put in sling:key property, use
   ensure unique name! append number

WDYT?


Current i18n nodetypes
==================

// The sling:language mixin node type allows to list one or more base
// names of resource bundles to which the messages below this language
// node belong.
[sling:Language] > mix:language
    mixin
  - sling:basename (string)
  - sling:basename (string) multiple


// Mixin node type for a single key to message mapping
// This mixin node type may be applied to any node such, that mappings
// may be located just inside some existing node hierarchy
[sling:Message]
    mixin
  - sling:key (string)
  - sling:message (undefined)

[sling:MessageEntry] > nt:hierarchyNode, sling:Message


Proposed new i18n Nodetypes
========================

Example node tree:

/libs/languages
         + Deutsch (sling:MessageBundle)
               - jcr:language = de-ch

               + Ok (sling:Message)
                 - sling:message = "'sch Ok"

               + Lorem_Ipsum_001 (sling:Message)
                 - sling:key = "Lorem Ipsum is simply [...]"
                 - sling:message = "Mir doch egal."

Nodetypes:

[sling:MessageBundle] > mix:language
  + * (sling:Message)

[sling:Message]
  - sling:key (string)
  - sling:message (undefined)


Regards,
Alex

-- 
Alexander Klimetschek
[EMAIL PROTECTED]

Reply via email to