-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flatter data file structure (#65)
- Loading branch information
1 parent
5a40a66
commit be79775
Showing
26 changed files
with
672 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,7 +139,6 @@ Options: | |
Default: . | ||
`) | ||
os.Exit(1) | ||
} | ||
|
||
// commonInitialisms is a set of common initialisms. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package main | ||
|
||
import "testing" | ||
|
||
func TestMergeExecuteFlatJSON(t *testing.T) { | ||
files := []string{ | ||
"testdata/input/flat/en-us.one.json", | ||
"testdata/input/flat/en-us.two.json", | ||
"testdata/input/flat/fr-fr.json", | ||
"testdata/input/flat/ar-ar.one.json", | ||
"testdata/input/flat/ar-ar.two.json", | ||
} | ||
testFlatMergeExecute(t, files) | ||
} | ||
|
||
func testFlatMergeExecute(t *testing.T, files []string) { | ||
resetDir(t, "testdata/output/flat") | ||
|
||
mc := &mergeCommand{ | ||
translationFiles: files, | ||
sourceLanguage: "en-us", | ||
outdir: "testdata/output/flat", | ||
format: "json", | ||
flat: true, | ||
} | ||
if err := mc.execute(); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
expectEqualFiles(t, "testdata/output/flat/en-us.all.json", "testdata/expected/flat/en-us.all.json") | ||
expectEqualFiles(t, "testdata/output/flat/ar-ar.all.json", "testdata/expected/flat/ar-ar.all.json") | ||
expectEqualFiles(t, "testdata/output/flat/fr-fr.all.json", "testdata/expected/flat/fr-fr.all.json") | ||
expectEqualFiles(t, "testdata/output/flat/en-us.untranslated.json", "testdata/expected/flat/en-us.untranslated.json") | ||
expectEqualFiles(t, "testdata/output/flat/ar-ar.untranslated.json", "testdata/expected/flat/ar-ar.untranslated.json") | ||
expectEqualFiles(t, "testdata/output/flat/fr-fr.untranslated.json", "testdata/expected/flat/fr-fr.untranslated.json") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"program_greeting": { | ||
"other": "Hello world" | ||
}, | ||
|
||
"person_greeting": { | ||
"other": "Hello {{.Person}}" | ||
}, | ||
|
||
"my_height_in_meters": { | ||
"one": "I am {{.Count}} meter tall.", | ||
"other": "I am {{.Count}} meters tall." | ||
}, | ||
|
||
"your_unread_email_count": { | ||
"one": "You have {{.Count}} unread email.", | ||
"other": "You have {{.Count}} unread emails." | ||
}, | ||
|
||
"person_unread_email_count": { | ||
"one": "{{.Person}} has {{.Count}} unread email.", | ||
"other": "{{.Person}} has {{.Count}} unread emails." | ||
}, | ||
|
||
"person_unread_email_count_timeframe": { | ||
"one": "{{.Person}} has {{.Count}} unread email in the past {{.Timeframe}}.", | ||
"other": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}." | ||
}, | ||
|
||
"d_days": { | ||
"one": "{{.Count}} day.", | ||
"other": "{{.Count}} days." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
program_greeting: | ||
other: "Hello world" | ||
|
||
person_greeting: | ||
other: "Hello {{.Person}}" | ||
|
||
my_height_in_meters: | ||
one: "I am {{.Count}} meter tall." | ||
other: "I am {{.Count}} meters tall." | ||
|
||
your_unread_email_count: | ||
one: "You have {{.Count}} unread email." | ||
other: "You have {{.Count}} unread emails." | ||
|
||
person_unread_email_count: | ||
one: "{{.Person}} has {{.Count}} unread email." | ||
other: "{{.Person}} has {{.Count}} unread emails." | ||
|
||
person_unread_email_count_timeframe: | ||
one: "{{.Person}} has {{.Count}} unread email in the past {{.Timeframe}}." | ||
other: "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}." | ||
|
||
d_days: | ||
one: "{{.Count}} day" | ||
other: "{{.Count}} days" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"d_days": { | ||
"few": "new arabic few translation of d_days", | ||
"many": "arabic many translation of d_days", | ||
"one": "arabic one translation of d_days", | ||
"other": "", | ||
"two": "", | ||
"zero": "" | ||
}, | ||
"my_height_in_meters": { | ||
"few": "", | ||
"many": "", | ||
"one": "", | ||
"other": "", | ||
"two": "", | ||
"zero": "" | ||
}, | ||
"person_greeting": { | ||
"other": "new arabic translation of person_greeting" | ||
}, | ||
"person_unread_email_count": { | ||
"few": "arabic few translation of person_unread_email_count", | ||
"many": "arabic many translation of person_unread_email_count", | ||
"one": "arabic one translation of person_unread_email_count", | ||
"other": "arabic other translation of person_unread_email_count", | ||
"two": "arabic two translation of person_unread_email_count", | ||
"zero": "arabic zero translation of person_unread_email_count" | ||
}, | ||
"person_unread_email_count_timeframe": { | ||
"other": "" | ||
}, | ||
"program_greeting": { | ||
"other": "" | ||
}, | ||
"your_unread_email_count": { | ||
"few": "", | ||
"many": "", | ||
"one": "", | ||
"other": "", | ||
"two": "", | ||
"zero": "" | ||
} | ||
} |
Oops, something went wrong.