-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meilleur traduction des erreurs et de l'aide
- Loading branch information
Showing
4 changed files
with
56 additions
and
34 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
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,38 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"strings" | ||
) | ||
|
||
type trad struct { | ||
from, to string | ||
} | ||
|
||
var traductions = []trad{ | ||
{"default", "par défaut"}, | ||
{"strings", " "}, | ||
{"string", " "}, | ||
{"ints", " "}, | ||
{"bad flag syntax:", "mauvaise syntaxe du paramètre :"}, | ||
{"unknown flag:", "paramètre inconnu :"}, | ||
{"unknown shorthand flag:", "paramètre court inconnu :"}, | ||
{"flag needs an argument:", "Le paramètre nécessite d'un argument :"}, | ||
{" in ", " dans "}, | ||
} | ||
|
||
type FrenchTranslator struct { | ||
w io.Writer | ||
} | ||
|
||
func (fw FrenchTranslator) Write(p []byte) (n int, err error) { | ||
out := string(p) | ||
|
||
for _, tr := range traductions { | ||
out = strings.ReplaceAll(out, tr.from, tr.to) | ||
} | ||
|
||
fmt.Fprintf(fw.w, out) | ||
return len(p), nil | ||
} |