This repository has been archived by the owner on Nov 9, 2017. 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.
enable localization of gwt resources
- Loading branch information
Patrick Huang
committed
Jan 6, 2014
1 parent
e6b7e7d
commit 3b49f37
Showing
44 changed files
with
4,230 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
.zanata-cache |
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,29 @@ | ||
import com.google.common.io.Files | ||
|
||
// This script will copy GWT generated *_default.properties source file to | ||
// follow java convention. i.e. without the _default in file name. | ||
// It's used in zanata.xml as command hook | ||
File pomBase = pom.basedir | ||
def baseDir = new File(pomBase.absolutePath + "/src/main/resources/org/zanata/webtrans/client/resources/") | ||
|
||
assert baseDir.isDirectory() | ||
|
||
def nameFilter = { dir, name -> | ||
name.endsWith("_default.properties") | ||
} as FilenameFilter | ||
|
||
def properties = baseDir.listFiles(nameFilter) | ||
|
||
|
||
if (!properties) { | ||
log.info "no *_default.properties found. quit." | ||
return | ||
} | ||
|
||
properties.each { | ||
// we need a no locale file name for java properties file convention | ||
def noLocaleFileName = it.name.replace("_default", "") | ||
def noLocaleDestFile = new File(baseDir, noLocaleFileName) | ||
log.debug " copy $it.name to: $noLocaleDestFile" | ||
Files.copy(it, noLocaleDestFile) | ||
} |
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,19 @@ | ||
// This script will remove java default locale properties file so that GWT can compile. | ||
// GWT only expect *_default.properties as default locale file. | ||
// It's used in zanata.xml as command hook | ||
|
||
File pomBase = pom.basedir | ||
def baseDir = new File(pomBase.absolutePath + "/src/main/resources/org/zanata/webtrans/client/resources/") | ||
|
||
assert baseDir.isDirectory() | ||
|
||
// find properties file without underscore | ||
def nameFilter = { dir, name -> | ||
!name.contains("_") | ||
} as FilenameFilter | ||
|
||
def properties = baseDir.listFiles(nameFilter) | ||
|
||
properties.each { | ||
it.delete() | ||
} |
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,54 @@ | ||
import com.google.common.io.Files | ||
|
||
// This script will be executed by gmaven plugin. | ||
// Although gmaven supports inline scripting in pom, it will escape / in the | ||
// regex and the script therefore won't work. | ||
log.info "===== Synchronize GWT generated properties files =====" | ||
|
||
def baseDir = new File(project.build.directory + "/gwt-extra/webtrans") | ||
|
||
assert baseDir.isDirectory() | ||
|
||
def nameFilter = { dir, name -> | ||
name.endsWith(".properties") | ||
} as FilenameFilter | ||
|
||
def properties = baseDir.listFiles(nameFilter) | ||
|
||
|
||
if (!properties) { | ||
log.info "no properties found. quit." | ||
return | ||
} | ||
// scrip off the file name part to get packge name | ||
def packageName = properties[0].name.replaceAll(/\.\w+\.properties/, "") | ||
def packagePath = packageName.replaceAll(/\./, "/") | ||
def destDir = new File(pom.basedir.absolutePath + "/src/main/resources/$packagePath") | ||
destDir.mkdirs() | ||
|
||
int sourceCount = 0 | ||
int targetCount = 0 | ||
|
||
properties.each { | ||
def fileName = (it.name - "$packageName.") | ||
def destFile = new File(destDir, fileName) | ||
if (it.name.endsWith("_default.properties")) { | ||
log.debug " * found source: $it.name" | ||
// we always copy over source file | ||
log.debug " copy over to: $destFile" | ||
// copy the file with _default to make GWT happy | ||
Files.copy(it, destFile) | ||
sourceCount++ | ||
} else { | ||
log.debug " * found target: $it.name" | ||
// we ALWAYS copy generated target skeleton to make sure target is in sync if source has changed. | ||
// It rely on zanata's merge auto feature. | ||
// Merge type import will override everything!! | ||
log.debug " copy over to :$destFile" | ||
Files.copy(it, destFile); | ||
targetCount++ | ||
} | ||
} | ||
|
||
log.info "Copied $sourceCount source(s) and $targetCount target(s) in $baseDir" | ||
log.info "===== Synchronize GWT generated properties files =====" |
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
13 changes: 13 additions & 0 deletions
13
zanata-war/src/main/java/org/zanata/webtrans/ApplicationI18n.gwt.xml
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,13 @@ | ||
<!-- | ||
set-property-fallback is missing from the DTD: | ||
<!DOCTYPE module PUBLIC "//gwt-module/" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.3/distro-source/core/src/gwt-module.dtd"> | ||
--> | ||
<module rename-to="webtrans"> | ||
<inherits name="org.zanata.webtrans.Application" /> | ||
<set-property name="user.agent" value="safari" /> | ||
<extend-property name="log_level" values="DEBUG" /> | ||
<set-property name="log_level" value="DEBUG" /> | ||
|
||
<!-- add locales to generate different properties template--> | ||
<set-property name="locale" value="default,en,ja,zh_Hant_TW,uk" /> | ||
</module> |
34 changes: 34 additions & 0 deletions
34
...r/src/main/resources/org/zanata/webtrans/client/resources/EnumMessages_default.properties
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 @@ | ||
# Generated from org.zanata.webtrans.client.resources.EnumMessages | ||
# for locale default | ||
|
||
approvedStatus=Translated | ||
|
||
contentStateApproved=Approved | ||
|
||
contentStateFuzzy=Fuzzy | ||
|
||
contentStateRejected=Rejected | ||
|
||
contentStateTranslated=Translated | ||
|
||
contentStateUnsaved=Unsaved | ||
|
||
contentStateUntranslated=Untranslated | ||
|
||
downgradeToFuzzy=Copy as Fuzzy | ||
|
||
ignoreDifference=Next Condition | ||
|
||
nextDraft=Next Fuzzy or Rejected | ||
|
||
nextIncomplete=Next Fuzzy/Rejected/Untranslated | ||
|
||
nextUntranslated=Next Untranslated | ||
|
||
rejectMerge=Don''t Copy | ||
|
||
searchTypeExact=Phrase | ||
|
||
searchTypeFuzzy=Fuzzy | ||
|
||
searchTypeRaw=Lucene |
34 changes: 34 additions & 0 deletions
34
...ta-war/src/main/resources/org/zanata/webtrans/client/resources/EnumMessages_en.properties
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 @@ | ||
# Generated from org.zanata.webtrans.client.resources.EnumMessages | ||
# for locale en | ||
|
||
approvedStatus=Translated | ||
|
||
contentStateApproved=Approved | ||
|
||
contentStateFuzzy=Fuzzy | ||
|
||
contentStateRejected=Rejected | ||
|
||
contentStateTranslated=Translated | ||
|
||
contentStateUnsaved=Unsaved | ||
|
||
contentStateUntranslated=Untranslated | ||
|
||
downgradeToFuzzy=Copy as Fuzzy | ||
|
||
ignoreDifference=Next Condition | ||
|
||
nextDraft=Next Fuzzy or Rejected | ||
|
||
nextIncomplete=Next Fuzzy/Rejected/Untranslated | ||
|
||
nextUntranslated=Next Untranslated | ||
|
||
rejectMerge=Don''t Copy | ||
|
||
searchTypeExact=Phrase | ||
|
||
searchTypeFuzzy=Fuzzy | ||
|
||
searchTypeRaw=Lucene |
34 changes: 34 additions & 0 deletions
34
...ta-war/src/main/resources/org/zanata/webtrans/client/resources/EnumMessages_ja.properties
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 @@ | ||
# Generated from org.zanata.webtrans.client.resources.EnumMessages | ||
# for locale ja | ||
|
||
approvedStatus=Translated | ||
|
||
contentStateApproved=Approved | ||
|
||
contentStateFuzzy=Fuzzy | ||
|
||
contentStateRejected=Rejected | ||
|
||
contentStateTranslated=Translated | ||
|
||
contentStateUnsaved=Unsaved | ||
|
||
contentStateUntranslated=Untranslated | ||
|
||
downgradeToFuzzy=Copy as Fuzzy | ||
|
||
ignoreDifference=Next Condition | ||
|
||
nextDraft=Next Fuzzy or Rejected | ||
|
||
nextIncomplete=Next Fuzzy/Rejected/Untranslated | ||
|
||
nextUntranslated=Next Untranslated | ||
|
||
rejectMerge=Don''t Copy | ||
|
||
searchTypeExact=Phrase | ||
|
||
searchTypeFuzzy=Fuzzy | ||
|
||
searchTypeRaw=Lucene |
34 changes: 34 additions & 0 deletions
34
...ta-war/src/main/resources/org/zanata/webtrans/client/resources/EnumMessages_uk.properties
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 @@ | ||
# Generated from org.zanata.webtrans.client.resources.EnumMessages | ||
# for locale uk | ||
|
||
approvedStatus=Translated | ||
|
||
contentStateApproved=Approved | ||
|
||
contentStateFuzzy=Fuzzy | ||
|
||
contentStateRejected=Rejected | ||
|
||
contentStateTranslated=Translated | ||
|
||
contentStateUnsaved=Unsaved | ||
|
||
contentStateUntranslated=Untranslated | ||
|
||
downgradeToFuzzy=Copy as Fuzzy | ||
|
||
ignoreDifference=Next Condition | ||
|
||
nextDraft=Next Fuzzy or Rejected | ||
|
||
nextIncomplete=Next Fuzzy/Rejected/Untranslated | ||
|
||
nextUntranslated=Next Untranslated | ||
|
||
rejectMerge=Don''t Copy | ||
|
||
searchTypeExact=Phrase | ||
|
||
searchTypeFuzzy=Fuzzy | ||
|
||
searchTypeRaw=Lucene |
Oops, something went wrong.