Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Sometimes, while working with Deployment Script, I see situations where phrases are reported as being deleted locally, but I'm sure I wasn't deleting anything. It all ends with fact, that some part of /modules/custom/install/english.lang file wasn't imported. Without import log this is pretty hard to analyze later on.

There are 2 use cases at least, where it will be used:

  • deployment script
  • direct language pack import from "Regional" section

Because of it we need to make sure, that logging format isn't hardcoded within language importing code. To implement that we need to:

  1. create ILanguagePackImportListener interface
  2. create single class per each use case (2 classes for now), that would implement this interface
  3. add LanguagePackImportHelper::setListener method, that would allow for listener to be set
  4. each add/change/delete operation would be reported to a listener (see example below)
Code Block
languagejavascript
{
	'language': 'English',
	'language_id': '1',
	'item_type': 'phrase',
	'item_key': 'LA_TEST_LABEL',
	'action_type': 'added'
}

Also it would be wise to replace any reporting text, that is the same each time with class named constants.