This commit is contained in:
aitzol76 2022-10-16 16:34:39 +02:00
parent 6cb67a6f35
commit efa1197af3
2 changed files with 14 additions and 2 deletions

View File

@ -8,8 +8,6 @@ import "strings"
type msgIdStrPairs map[string]string
type localesMsg map[string]msgIdStrPairs
//const pattern = `msgid "(.+)"\nmsgstr "(.+)"`
//const patternP = `msgid "(.+)"\nmsgid_plural "(.+)"\nmsgstr\[.\] "(.+)"\nmsgstr\[.\] "(.+)"`
var pattern = [2] string {`msgid "(.+)"\nmsgstr "(.+)"`,`msgid "(.+)"\nmsgid_plural "(.+)"\nmsgstr\[.\] "(.+)"\nmsgstr\[.\] "(.+)"`}
func getPOPath(locale, domain, localedir string) string {

14
po2json/po2json_test.go Normal file
View File

@ -0,0 +1,14 @@
package po2json
import "testing"
func TestAll(t *testing.T) {
locales := []string{"en_UK", "eu_ES"}
const domain = "base"
const localedir = "locales"
t.Log(getPOPath(locales[0], domain, localedir))
t.Log(getPOPath(locales[1], domain, localedir))
t.Log(PO2JSON(locales, domain, localedir))
}