# TypeScript TS

> TypeScript TS file localization

URL: https://store.crowdin.com/ts
Identifier: ts
Category: File Formats
Type: System
Author: Crowdin

TypeScript TS is a natively supported file format, you can use it without an additional installation. Just upload it to your projects and start the localization.

## File Format Details

| Attribute | Value |
| --------- | ----- |
| File Extension | .ts |
| [API Type](https://developer.crowdin.com/api/v2/#operation/api.projects.files.post) | ts |
| Source can be edited in Crowdin | No |
| Generating translated files via [Bundles](https://support.crowdin.com/bundles/) | [Search Crowdin Store](https://store.crowdin.com/tags/string-exporter) |
| Supports pluralization | No |
| WYSIWYG Preview in the editor | No |
| Supported types of contextual information | Text comments, Screenshots, In-Context |
| Custom attributes | No |
| Existing translations import possibility | Key-value mapping |

## Support for Const Assertions
Crowdin supports localization of TypeScript files that use `const` assertions. This approach allows you to create immutable key-value objects, commonly used for defining translation resources.

### Usage Example
Below is a sample file using `as const` to define translation keys and values. These constants can be uploaded to Crowdin for localization, and downloaded as translated files when your project is ready.
```typescript
const root = {
  get_started: 'Get started',
  app_title: 'Next.js with next-intl and Crowdin',
  app_description: 'Generated by create-next-app to experiment with next-intl and Crowdin',
  hello__name: 'Hello {name}',
} as const;
export default root;
```
### Notes
- `as const` ensures the object is readonly, preserving exact string values for localization.
- Crowdin detects these structures automatically and processes them as key-value pairs.

## Sample File

```typescript
export enum EncounterIcons {
    disrespected = "encounter-disrespected",
    textInDoubleQuotes = "Text in double qoutes",
    textInSingleQoutes = 'Text in single qoutes',
    emptyTextInDoubleQuotes = "",
    emptyTextInSingleQoutes = '',
    textWithPlaceHolder = "{0} (text with placeholder)",
    textWithEscapedQuotesInDoubleQuotes = "\"this is a text\"",
    textWithEscapedQuotesInSingleQuotes = '\'this is a text\'',
    someChineseHierogliphs = '（原币）',
    format = "d/m/Y",
    bool = true,
    integer = 42,
    float = 3.14,
    regex = /^([\d]{4})$/,
}
```
