Skip to content

Commit 81d02e8

Browse files
committed
update readme
1 parent 71ac05b commit 81d02e8

4 files changed

Lines changed: 14 additions & 13 deletions

File tree

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,21 @@ composer require elaborate-code/php-json-tongue
1616

1717
## Usage
1818

19-
Set the file structure
19+
Set the file structure.
2020

2121
![illustration](illustration.png)
2222

23-
Then use the facade
23+
Then use the facade.
2424

2525
```php
2626
use ElaborateCode\JsonTongue\TongueFacade;
2727

2828
$tongue = new TongueFacade('/lang');
2929

30-
$tongue->transcribe();
30+
$localization = $tongue->transcribe();
3131
```
3232

33+
`$localization` will look like:
34+
35+
![transcribed](transcribed.png)
36+

tests/feature/TongueFacadeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
->addLocale('en', [
1212
'en.json' => [
1313
'en' => 'en',
14-
'Super' => 'Super',
14+
"I know. They're both good. It's hard to decide. McCain is older but he has more experience. Obama seems to have a lot of good ideas, but some people say he wants to raise taxes." => 'Lo sé. Ambos son buenos. Es difícil decidir. McCain es mayor pero tiene más experiencia. Obama parece tener muchas buenas ideas, pero algunas personas dicen que quiere aumentar los impuestos.',
1515
],
1616
'one.json' => [
1717
'one' => 'one',

tests/unit/FileTest.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22

33
use ElaborateCode\JsonTongue\Strategies\File;
44

5-
it('gets correct project root path', function () {
6-
$root_folder = new File;
5+
test('getProjectRoot')
6+
->expect(fn () => (new File)->getProjectRoot())
7+
->toBe(realpath(__DIR__.'/../../'));
78

8-
expect($root_folder->getProjectRoot())
9-
->toBe(realpath(__DIR__.'/../../'));
10-
});
11-
12-
it('gets correct tests folder path', function () {
9+
test('getPath', function () {
1310
expect((string) new File('tests'))
1411
->toBe(realpath(__DIR__.'/../'));
1512

@@ -21,12 +18,12 @@
2118
->toBe(realpath(__DIR__.'/../'));
2219
});
2320

24-
it('throws an exception when relative path is invalid', function () {
21+
it('throws an exception when $rel_path is invalid', function () {
2522
expect(fn () => new File('i want some fruits'))
2623
->toThrow(\Exception::class, "Invalid relative path. Can't get absolute path from 'i want some fruits'!");
2724
});
2825

29-
it('scans directories', function () {
26+
test('getDirectoryContent', function () {
3027
$dir = new File();
3128

3229
expect($dir->getDirectoryContent())

transcribed.png

14.4 KB
Loading

0 commit comments

Comments
 (0)