# General Translation Changelog: generaltranslation 8.1.0: Locale-aware text truncation
URL: https://generaltranslation.com/en-GB/blog/generaltranslation_v8_1_0.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 
Authors: Ernest McCarter
Published: 2025-12-06

## Overview

**generaltranslation@8.1.0** introduces `formatCutoff()`, a locale-aware text truncation function that handles character limits with appropriate terminators for different languages.

***

## Motivation

UI text truncation typically relies on CSS `text-overflow: ellipsis` or simple string slicing, but these approaches don&#39;t take locale-specific conventions into account. Different languages use different ellipsis characters, spacing, and punctuation rules when text is cut off.

Additionally, when AI translations are constrained to character limits, there&#39;s often a need to enforce those limits strictly on the client side as a fallback.

***

## Usage

`formatCutoff()` is available both as a GT instance method and as a standalone function:

```javascript
import { GT, formatCutoff } from 'generaltranslation'

const gt = new GT({ targetLocale: 'en-US' })

// Basic truncation
gt.formatCutoff('Hello, world!', { maxChars: 9 })
// Returns: 'Hello, w…'

// Standalone function
formatCutoff('Hello, world!', { 
  locales: 'fr-FR', 
  maxChars: 9 
})
// Returns: 'Hello, w\u202F…'  // Note the narrow space before ellipsis
```


### Negative maxChars

Negative values slice from the end and prepend the terminator:

```javascript
gt.formatCutoff('Hello, world!', { maxChars: -4 })
// Returns: '…ld!'
```


### Locale-specific terminators

Different locales use different ellipsis styles:

```javascript
// Chinese and Japanese use double ellipsis
formatCutoff('你好世界', { locales: 'zh-CN', maxChars: 4 })
// Returns: '你好……'

// French uses narrow non-breaking space before ellipsis  
formatCutoff('Bonjour', { locales: 'fr-FR', maxChars: 6 })
// Returns: 'Bonj\u202F…'
```


### Custom terminators

Override default behaviour with custom terminators and separators:

```javascript
gt.formatCutoff('Long text here', {
  maxChars: 13,
  terminator: '...',
  separator: ' '
})
// Returns: 'Long text ...'
```


### No terminator

Use the `'none'` style to truncate without a terminator:

```javascript
gt.formatCutoff('Hello, world!', {
  maxChars: 5,
  style: 'none'
})
// Returns: 'Hello'
```

***


## Foundation for UI libraries

This functionality serves as the foundation for UI-specific implementations in `gt-react` and `gt-next`, which will expose the subsets of this functionality appropriate to their frameworks.

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
