Write JavaScript code examples of I18N record pagination violations, and how to fix for I18N compliance. Include code and detailed explanations
 Internationalization (i18n) is the process of designing a software application so that it can be adapted to various languages and regions without engineering changes. One common i18n pitfall is record pagination, where the number of records displayed per page and the pagination controls may not work correctly for all languages. Here are some examples of pagination violations and how to fix them for i18n compliance.

Violation 1: Hardcoding the number of records per page
---------------------------------------------------

Hardcoding the number of records per page in the code is a common mistake that can lead to i18n issues. For example:
```javascript
const pageSize = 10; // Hardcoded

function getPageData(data, pageNumber) {
  const startIndex = pageNumber * pageSize;
  const endIndex = startIndex + pageSize;
  return data.slice(startIndex, endIndex);
}
```
In this example, the `pageSize` variable is hardcoded to 10 records per page. This may work well for English, but it can cause issues for languages that require more space to display the same amount of information. For example, Chinese characters typically take up less space than English characters, so a page with 10 Chinese characters may display more information than a page with 10 English characters.

To fix
Here are some JavaScript code examples of I18N record pagination violations and how to fix them for I18N compliance:

**Violation 1: Hardcoded pagination limits**

**Non-compliant code:**
```javascript
const pageSize = 10;
const currentPage = 1;
const records = getRecordsFromAPI(); // assume this returns an array of records
const paginatedRecords = records.slice((currentPage - 1) * pageSize, currentPage * pageSize);
```
**Problem:** The pagination limit (10) is hardcoded, which may not be suitable for all languages or regions.

**Compliant code:**
```javascript
const pageSize = getPageSizeFromConfig(); // retrieve page size from configuration or locale-specific settings
const currentPage = 1;
const records = getRecordsFromAPI(); // assume this returns an array of records
const paginatedRecords = records.slice((currentPage - 1) * pageSize, currentPage * pageSize);
```
**Explanation:** Instead of hardcoding the page size, we retrieve it from a configuration or locale-specific settings. This allows us to easily change the page size for different languages or regions.

**Violation 2: Inconsistent pagination ordering**

**Non-compliant code:**
```javascript
const records = getRecordsFromAPI(); // assume this returns an array of records
const paginatedRecords = records.slice(0, 10); // hardcoded pagination limit
//...
// later in the code...
const nextPageRecords = records.slice(10,