Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<ul> <li>Log event identifiers rather than messages.</li> <li>Capture event specific data along with the event identifier.</li> <li>When a user views the log, localize the event message based on the unique identifier.</li> </ul> <p>The problem you'll run into is if you try to insert dynamic data into the messages in a conversational fashion. For example, if you have to write "No messages found" vs. "One message found" vs. "X messages found" is problematic - in English we have different pluralities for zero, one, and more than one... but it's not necessarily like that in other languages. Things like numbers or dates are less problematic to insert in String.Format form, but you don't want to get in the business of trying to dynamically generate real language in a localized fashion.</p> <p>I'd recommend following a pattern a lot like the Windows Event Log where you output an event ID, a localized message based on the event ID, and then capturing certain "fields" where you'll localize the field name and the display format of the field, like "Amount: $2.00" or whatever. It may not be the prettiest way to go, but unless you've got a full-time linguist dedicated to this and you intend on accounting for all the little nuances of every language, I'd punt and go with a simpler log output format.</p> <p>In your given example, you'd separate the log message from the data, like:</p> <p>Customer failed to finish payment.<br/> Amount: XX</p> <p>You'd log a message ID, like "13579" might be the unique ID for the event when a customer fails to finish a payment. Finally, you could store the value as a separate field.</p> <p>How you go about figuring out how many fields to allocate to an event or how to store the data is... well, an exercise best left to the reader.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload