language.stateRestore

Since: StateRestore 2.0.0

StateRestore language options.
Please note - this property requires the StateRestore extension for DataTables.

Description

This object provides the ability to specify the language strings that are used by StateRestore for its UI elements. As with all language strings for DataTables, they can be set at initialisation time with this property, via defaults (DataTable.defaults.language.stateRestore) or loaded via Ajax.

The language strings used by StateRestore can be broken down into the following blocks:

  • Buttons
  • Editing form
  • Editing modal
  • Table display
  • Misc.

Buttons

StateRestore makes use of the Buttons extension to provide a simple to use list UI for the end user. The labels used by the buttons are defined as follows with the keys shown available under language.stateRestore.button:

Object key Description Default value
.create Label for stateCreate Create state
.duplicate Sub-button that can be used to duplicate a shared in or predefined state. Copy
.edit Sub-button to trigger the editing of a state's properties. Edit
.empty Shown in place of the state list when there are no saved states. No saved states
.replace Sub-button that will replace the selected state with the table's current state. Replace
.remove Sub-button to delete the selected state. Delete:
.statesRemoveAll Label for statesRemoveAll. Remove all states
.statesList Label for statesList. Saved states
.statesTable Label for statesTable. Saved states

Editing form

When creating, editing or deleting a state, the following language strings are used. The keys are available under language.stateRestore.state:

Object key Description Default value

| name | Label for the state name field. | Name: | | nameInfo | Information describing the name field. | Empty string | | nameRequired | Error message if a name isn't given. | A name is required for the state | | defaults | Label for the default field | Default: | | defaultsInfo | Information describing the default field. | The state that is selected as the default will be used automatically when the page is loaded. | | save | Button used for submitting the form. | Save | | share | Label for the share field. | Share: | | shareInfo | Information describing the share field. | Other users of the system will be able to use states that you share. They will not be able to edit the state. | | properties | State properties field label. | State properties: |

Editing modal

The editing modal is reused with different strings to indicate what action is being performed. The keys are available under language.stateRestore and provide the ability to customise the modal information:

Object key Description Default value
.create.title Modal title for creating a state. Save new state
.create.info Optional description of the create state action. Empty string
.edit.title Modal title for editing a state. Edit state
.edit.info Optional description of the edit state action. Empty string
.replace.title Modal title for replacing a state. Replace state
.replace.info Optional description of the replace state action. Empty string
.remove.button Modal submit button. Delete
.remove.title Modal title for deleting a state. Delete state
.remove.message Message asking the user to confirm the deletion. Are you sure you wish to remove the following states:

Table display

When using the statesTable button to display and manage the list of states, the following strings are used. Note that the button strings described above are also used for the control button labels. These keys are available under language.stateRestore.table:

Object key Description Default value
.active Column header for the active status Active
.default Column header for the default status Default
.entries The object type for the table - i.e. a translation of "States" states
.load Load button text Load
.name Column header for the state name Name
.share Column header for the share state Share

Misc

Object key Description Default value
.copyName Postfix to add when copying a state (copy)
.newName Base string for new state names. The # is replaced with the next number in the sequence. State #

Defaults

By default there is no stateRestore object attached to the DataTables.defaults.language object. Instead the default values are defined in the library - please see below for the default values. To set a default, set DataTables.defaults.language.stateRestore using the structure below.

stateRestore: {
    button: {
        create: "Create state",
        duplicate: "Copy",
        edit: "Edit",
        empty: "No saved states",
        replace: "Replace",
        remove: "Delete:",
        statesRemoveAll: "Remove all states",
        statesList: "Saved states"
    },
    create: {
        title: "Save new state"
        info: ""
    },
    edit: {
        title: "Edit state"
        info: ""
    },
    replace: {
        title: "Replace state"
        info: "Replace the currently saved state with the table's current state."
    },
    remove: {
        button: "Delete",
        title: "Delete state"
        message: {
            _: "Are you sure you wish to remove the following states:",
            1: "Are you sure you wish to remove the following state:"
        }
    },
    state: {
        name: "Name:",
        nameInfo: "",
        nameRequired: "A name is required for the state",
        defaults: "Default:",
        defaultsInfo: "The state that is selected as the default will be used automatically when the page is loaded.",
        save: "Save",
        share: "Share:",
        shareInfo: "Other users of the system will be able to use states that you share. They will not be able to edit the state.",
        properties: "State properties:"
    },
    table: {
        active: 'Active',
        default: 'Default',
        entries: {
            1: 'entry',
            _: 'entries'
        },
        load: 'Load',
        name: 'Name',
        share: 'Share'
    },
    copyName: " (copy)",
    newName: "State #"
}

Community translations

Our amazing community have provided a wide range of translations for DataTables, which are available on our CDN for you to use. Please see the Internalisation plug-ins page for more details.

It is possible that you might find translations missing for the specific keys you need. If you have knowledge of a specific language, please take the time to submit the missing strings so everyone can benefit!

Type

object

This option hosts the language strings that are used by StateRestore for its UI.

Example

French translation for the StateRestore buttons:

new DataTable('#myTable', {
	language: {
		stateRestore: {
			button {
				create: "Créer un état",
				duplicate: "Dupliquer",
				edit: "Modifier",
				empty: "Aucun état sauvegardé",
				replace: "Remplacer",
				remove: "Supprimer :",
				statesRemoveAll: "Supprimer tous les états",
				statesList: "États sauvegardés"
			}
		}
	},
	layout: {
		topStart: {
			buttons: ['stateCreate', 'statesList']
		}
	}
});