Page MenuHomePhabricator

Switch ZMonoLingualString over to using Z60/Natural language objects, rather than 'en' etc. strings
Open, HighPublic

Event Timeline

I have looked into this issue to define the scope of it, and mapped it to be as follow:

  • Change the UI component of a monolingual string to show a dropdown of Z60 and not he hardcoded
  • Change the UI component to define the selected language as a reference to the Z60 selected ( this is my assumption)
  • Change the PHP side to define a monolingual as an array of Z60
  • Define the Z60 and tests associated to it in the backend
  • Change the "getPreferredMonolingualString" method to return the Z60 representation of the language?

Not sure what "Change the PHP side to define a monolingual as an array of Z60" means, but if it means that a Monolingual string should use the Z60 instead of a Z6 for the language, then that is right.

You also asked me to provide a few example JSONs, here we go:

So the definition of Z11/Monolingual string would change from the current

  • Z11K1/language of type Z6/String
  • Z11K2/text of type Z6/String

to

  • Z11K1/language of type Z60/Language
  • Z11K2/text of type Z6/String

We already should have a set of languages available in an empty installation (all Z1xxx objects).

So an instance of a current monolingual text would currently look like

{
  "Z1K1": "Z11",
  "Z11K1": "en",
  "Z11K2": "Hello, world!"
}

and would look after the change like

{
  "Z1K1": "Z11",
  "Z11K1": "Z1002",
  "Z11K2": "Hello, world!"
}

or, in normal form,

{
  "Z1K1": {
    "Z1K1": "Z9",
    "Z9K1": "Z11"
  },
  "Z11K1": {
    "Z1K1": "Z6",
    "Z6K1": "en"
  },
  "Z11K2": {
    "Z1K1": "Z6",
    "Z6K1": "Hello, world!"
  }
}

would change to

{
  "Z1K1": {
    "Z1K1": "Z9",
    "Z9K1": "Z11"
  },
  "Z11K1": {
    "Z1K1": "Z9",
    "Z9K1": "Z1002"
  },
  "Z11K2": {
    "Z1K1": "Z6",
    "Z6K1": "Hello, world!"
  }
}

Thus, a literal of a Z12/Multingual string would change, in canonical form, from

{
  "Z1K1": "Z12",
  "Z12K1": [{
    "Z1K1": "Z11",
    "Z11K1": "en",
    "Z11K2": "Hello, world!"
  }, {
    "Z1K1": "Z11",
    "Z11K1": "it",
    "Z11K2": "Ciao mondo!"
  }]
}

to

{
  "Z1K1": "Z12",
  "Z12K1": [{
    "Z1K1": "Z11",
    "Z11K1": "Z1002",
    "Z11K2": "Hello, world!"
  }, {
    "Z1K1": "Z11",
    "Z11K1": "Z1787",
    "Z11K2": "Ciao mondo!"
  }]
}

I hope this helps!

One thing that would need to be changed would be to change all the data on wiki from the current code based language identifiers to the new ZIDs, at least for the data to be loaded in. We might also want to have a task to provide a maintenance script to update an existing wiki.

That explanation is perfect Denny!

i will investigate this story further and ask for clarification/help if required down the line

DVrandecic raised the priority of this task from Lowest to Low.
SimoneThisDot raised the priority of this task from Low to High.Mon, May 10, 7:34 AM