-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): rename i18n to translater & fix few other issues (#174)
* fix(core): rename i18n to translater & fix few other issues - fix couple of issues found for the lib to work with Aurelia-Slickgrid
- Loading branch information
1 parent
38414a1
commit 34c963a
Showing
32 changed files
with
128 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
export * from './caseType.enum'; | ||
export * from './columnReorderFunction.type'; | ||
export * from './compositeEditorModalType.type'; | ||
export * from './fieldType.enum'; | ||
export * from './extensionList.type'; | ||
export * from './eventNamingStyle.enum'; | ||
export * from './emitterType.enum'; | ||
export * from './fileType.enum'; | ||
export * from './delimiterType.enum'; | ||
export * from './columnReorderFunction.type'; | ||
export * from './emitterType.enum'; | ||
export * from './eventNamingStyle.enum'; | ||
export * from './extensionList.type'; | ||
export * from './extensionName.enum'; | ||
export * from './fieldType.enum'; | ||
export * from './fileType.enum'; | ||
export * from './filterMultiplePassType.enum'; | ||
export * from './filterMultiplePassTypeString.type'; | ||
export * from './gridAutosizeColsMode.enum'; | ||
export * from './gridStateType.enum'; | ||
export * from './keyCode.enum'; | ||
export * from './operatorString.type'; | ||
export * from './operatorType.enum'; | ||
export * from './searchTerm.type'; | ||
export * from './slickControlList.enum'; | ||
export * from './slickPluginList.enum'; | ||
export * from './sortDirection.enum'; | ||
export * from './sortDirectionString.type'; | ||
export * from './sortDirectionNumber.enum'; | ||
export * from './sortDirection.enum'; | ||
export * from './slickPluginList.enum'; | ||
export * from './slickControlList.enum'; | ||
export * from './searchTerm.type'; | ||
export * from './operatorType.enum'; | ||
export * from './operatorString.type'; | ||
export * from './keyCode.enum'; | ||
export * from './gridStateType.enum'; | ||
export * from './gridAutosizeColsMode.enum'; | ||
export * from './filterMultiplePassTypeString.type'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import { Formatter } from './../interfaces/index'; | ||
|
||
/** Takes a cell value and translates it (i18n). Requires an instance of the Translate Service:: `i18n: this.translate */ | ||
/** Takes a cell value and translates it (translater). Requires an instance of the Translate Service:: `translater: this.translate */ | ||
export const translateFormatter: Formatter = (_row, _cell, value, columnDef, _dataContext, grid) => { | ||
const gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; | ||
const i18n = gridOptions.i18n || (columnDef && columnDef.params && columnDef.params.i18n); | ||
const translater = gridOptions.translater || (columnDef && columnDef.params && columnDef.params.translater); | ||
|
||
if (!i18n || typeof i18n.translate !== 'function') { | ||
throw new Error(`The translate formatter requires the Translate Service to be provided as a Grid Options or Column Definition "i18n". | ||
For example: this.gridOptions = { enableTranslate: true, i18n: this.translateService }`); | ||
if (!translater || typeof translater.translate !== 'function') { | ||
throw new Error(`The translate formatter requires the Translate Service to be provided as a Grid Options or Column Definition "translater". | ||
For example: this.gridOptions = { enableTranslate: true, translater: this.translateService }`); | ||
} | ||
|
||
// make sure the value is a string (for example a boolean value would throw an error) | ||
if (value !== undefined && value !== null && typeof value !== 'string') { | ||
value = value + ''; | ||
} | ||
|
||
return value ? i18n.translate(value) : ''; | ||
return value ? translater.translate(value) : ''; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.