Skip to content

Commit 9ff2432

Browse files
committed
[Translator] Add Symfony UX Translator package
1 parent b6c86be commit 9ff2432

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1812
-0
lines changed

src/Translator/.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/.gitattributes export-ignore
2+
/.gitignore export-ignore
3+
/.symfony.bundle.yaml export-ignore
4+
/phpunit.xml.dist export-ignore
5+
/assets/src export-ignore
6+
/assets/test export-ignore
7+
/assets/jest.config.js export-ignore
8+
/tests export-ignore

src/Translator/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
vendor
2+
composer.lock
3+
.php_cs.cache
4+
.phpunit.result.cache

src/Translator/.symfony.bundle.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
branches: ["2.x"]
2+
maintained_branches: ["2.x"]
3+
doc_dir: "doc"

src/Translator/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CHANGELOG
2+
3+
## Unreleased
4+
5+
- Component added

src/Translator/LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2020-2022 Fabien Potencier
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

src/Translator/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Symfony UX Translator
2+
3+
Symfony UX Translator integrates [Symfony Translation](https://symfony.com/doc/current/translation.html) for JavaScript.
4+
5+
**This repository is a READ-ONLY sub-tree split**. See
6+
https://github.com/symfony/ux to create issues or submit pull requests.
7+
8+
## Resources
9+
10+
- [Documentation](https://symfony.com/bundles/ux-translator/current/index.html)
11+
- [Report issues](https://github.com/symfony/ux/issues) and
12+
[send Pull Requests](https://github.com/symfony/ux/pulls)
13+
in the [main Symfony UX repository](https://github.com/symfony/ux)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { Locale, MessageId } from '../types';
2+
export declare function format(id: MessageId, parameters: Record<string, string | number> | undefined, domain: string | null | undefined, locale: Locale): string;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { Domain, Locale, MessageId } from '../types';
2+
export declare function formatIcu(id: MessageId, parameters: Record<string, string | number> | undefined, domain: Domain, locale: Locale): string;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { Domain, Locale, MessageId } from '../types';
2+
export declare function formatIntl(id: MessageId, parameters: Record<string, string | number> | undefined, domain: Domain, locale: Locale): string;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Domain, Locale, MessageId, MessageValue } from './types';
2+
declare global {
3+
interface Window {
4+
__symfony_ux_translator?: {
5+
locale: Locale;
6+
translations: Record<Locale, Record<Domain, Record<MessageId, MessageValue>>>;
7+
};
8+
setTranslatorLocale(locale: Locale): void;
9+
}
10+
}
11+
export declare function setLocale(locale: string): void;
12+
export declare function trans(id: MessageId | null, parameters?: Record<string, string | number>, domain?: Domain, locale?: Locale | null): string;

0 commit comments

Comments
 (0)