This repository has been archived by the owner on Dec 18, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
push: split push up into locale_file and push_source
- Loading branch information
Showing
4 changed files
with
350 additions
and
324 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
) | ||
|
||
type LocaleFiles []*LocaleFile | ||
|
||
type LocaleFile struct { | ||
Path, Name, ID, Code, Tag, FileFormat string | ||
ExistsRemote bool | ||
} | ||
|
||
func (localeFile *LocaleFile) RelPath() string { | ||
callerPath, _ := os.Getwd() | ||
relativePath, _ := filepath.Rel(callerPath, localeFile.Path) | ||
return relativePath | ||
} | ||
|
||
// Locale to Path mapping | ||
func (localeFile *LocaleFile) Message() string { | ||
str := "" | ||
if Debug { | ||
if localeFile.Name != "" { | ||
str = fmt.Sprintf("%s Name: %s", str, localeFile.Name) | ||
} | ||
if localeFile.ID != "" { | ||
str = fmt.Sprintf("%s Id: %s", str, localeFile.ID) | ||
} | ||
if localeFile.Code != "" { | ||
str = fmt.Sprintf("%s Code: %s", str, localeFile.Code) | ||
} | ||
if localeFile.Tag != "" { | ||
str = fmt.Sprintf("%s Tag: %s", str, localeFile.Tag) | ||
} | ||
if localeFile.FileFormat != "" { | ||
str = fmt.Sprintf("%s Format: %s", str, localeFile.FileFormat) | ||
} | ||
} else { | ||
str = fmt.Sprintf("%s", localeFile.Name) | ||
} | ||
return strings.TrimSpace(str) | ||
} |
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
Oops, something went wrong.