- Added a locale chain example
Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/f8945125 Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/f8945125 Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/f8945125 Branch: refs/heads/as3httpclient-work Commit: f894512567f719a3bfb259deb181bb8eaff4bd85 Parents: b43e167 Author: Christofer Dutz <[email protected]> Authored: Sat Apr 25 16:05:46 2015 +0200 Committer: Christofer Dutz <[email protected]> Committed: Sat Apr 25 16:05:46 2015 +0200 ---------------------------------------------------------------------- .../examples/i18n/locale-chains/pom.xml | 40 ++++++ .../examples/i18n/locale-chains/swf/pom.xml | 79 ++++++++++++ .../locale-chains/swf/src/main/flex/Main.mxml | 63 ++++++++++ .../main/locales/de_AT/myresources.properties | 19 +++ .../main/locales/de_DE/myresources.properties | 20 +++ .../main/locales/en_GB/myresources.properties | 19 +++ .../main/locales/en_US/myresources.properties | 21 ++++ .../examples/i18n/locale-chains/war/pom.xml | 124 +++++++++++++++++++ .../war/src/main/webapp/WEB-INF/web.xml | 31 +++++ maven-flex-plugin/examples/i18n/pom.xml | 1 + 10 files changed, 417 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f8945125/maven-flex-plugin/examples/i18n/locale-chains/pom.xml ---------------------------------------------------------------------- diff --git a/maven-flex-plugin/examples/i18n/locale-chains/pom.xml b/maven-flex-plugin/examples/i18n/locale-chains/pom.xml new file mode 100644 index 0000000..bff39bc --- /dev/null +++ b/maven-flex-plugin/examples/i18n/locale-chains/pom.xml @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.flex.examples.i18n</groupId> + <artifactId>i18n</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <artifactId>locale-chains</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <modules> + <module>swf</module> + <module>war</module> + </modules> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f8945125/maven-flex-plugin/examples/i18n/locale-chains/swf/pom.xml ---------------------------------------------------------------------- diff --git a/maven-flex-plugin/examples/i18n/locale-chains/swf/pom.xml b/maven-flex-plugin/examples/i18n/locale-chains/swf/pom.xml new file mode 100644 index 0000000..e8630d6 --- /dev/null +++ b/maven-flex-plugin/examples/i18n/locale-chains/swf/pom.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.flex.examples.i18n</groupId> + <artifactId>locale-chains</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <artifactId>locale-chains-swf</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>swf</packaging> + + <build> + <sourceDirectory>src/main/flex</sourceDirectory> + <plugins> + <plugin> + <groupId>net.flexmojos.oss</groupId> + <artifactId>flexmojos-maven-plugin</artifactId> + <version>7.1.0-SNAPSHOT</version> + <extensions>true</extensions> + <configuration> + <debug>true</debug> + <localesCompiled> + <locale>en_US</locale> + <locale>en_GB,en_US</locale> + <locale>de_DE,en_US</locale> + <locale>de_AT,de_DE,en_US</locale> + </localesCompiled> + </configuration> + <dependencies> + <dependency> + <groupId>org.apache.flex</groupId> + <artifactId>compiler</artifactId> + <version>4.14.1</version> + <type>pom</type> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.flex</groupId> + <artifactId>framework</artifactId> + <version>4.14.1</version> + <type>pom</type> + </dependency> + <dependency> + <groupId>com.adobe.flash.framework</groupId> + <artifactId>playerglobal</artifactId> + <version>14.0</version> + <type>swc</type> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f8945125/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/flex/Main.mxml ---------------------------------------------------------------------- diff --git a/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/flex/Main.mxml b/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/flex/Main.mxml new file mode 100644 index 0000000..3f2cdad --- /dev/null +++ b/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/flex/Main.mxml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark"> + + <fx:Metadata> + [ResourceBundle("myresources")] + </fx:Metadata> + + <fx:Script> + <![CDATA[ + import mx.collections.ArrayCollection; + + import spark.events.IndexChangeEvent; + + [Bindable] + private var locales:ArrayCollection = new ArrayCollection([ + {label:"US English", locale:"en_US"}, + {label:"British English", locale:"en_GB,en_US"}, + {label:"German", locale:"de_DE,en_US"}, + {label:"Austrian German", locale:"de_AT,de_DE,en_US"} + ]); + + private function onLanguageChange(event:IndexChangeEvent):void { + resourceManager.localeChain = getLocaleChain(localeSelector.selectedItem.locale); + } + + private function getLocaleChain(str:String):Array { + var result:Array = []; + for each(var locale:String in str.split(",")) { + result.push(locale); + } + return result; + } + + ]]> + </fx:Script> + + <s:VGroup> + <s:ComboBox id="localeSelector" dataProvider="{locales}" change="onLanguageChange(event)"/> + <s:Label text="{resourceManager.getString('myresources','hotDrink')}"/> + <s:Label text="{resourceManager.getString('myresources','coldDrink')}"/> + <s:Label text="{resourceManager.getString('myresources','strangeDrink')}"/> + </s:VGroup> + +</s:Application> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f8945125/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/de_AT/myresources.properties ---------------------------------------------------------------------- diff --git a/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/de_AT/myresources.properties b/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/de_AT/myresources.properties new file mode 100644 index 0000000..c48d822 --- /dev/null +++ b/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/de_AT/myresources.properties @@ -0,0 +1,19 @@ +################################################################################ +## +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +################################################################################ +hotDrink=Haferl Kaffee \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f8945125/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/de_DE/myresources.properties ---------------------------------------------------------------------- diff --git a/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/de_DE/myresources.properties b/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/de_DE/myresources.properties new file mode 100644 index 0000000..ca4e20e --- /dev/null +++ b/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/de_DE/myresources.properties @@ -0,0 +1,20 @@ +################################################################################ +## +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +################################################################################ +hotDrink=Tasse Kaffee +coldDrink=Bier \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f8945125/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/en_GB/myresources.properties ---------------------------------------------------------------------- diff --git a/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/en_GB/myresources.properties b/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/en_GB/myresources.properties new file mode 100644 index 0000000..b020332 --- /dev/null +++ b/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/en_GB/myresources.properties @@ -0,0 +1,19 @@ +################################################################################ +## +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +################################################################################ +hotDrink=Cup of tee \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f8945125/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/en_US/myresources.properties ---------------------------------------------------------------------- diff --git a/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/en_US/myresources.properties b/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/en_US/myresources.properties new file mode 100644 index 0000000..6959d2c --- /dev/null +++ b/maven-flex-plugin/examples/i18n/locale-chains/swf/src/main/locales/en_US/myresources.properties @@ -0,0 +1,21 @@ +################################################################################ +## +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +################################################################################ +hotDrink=Cup of coffee +coldDrink=Beer +strangeDrink=Red Bull \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f8945125/maven-flex-plugin/examples/i18n/locale-chains/war/pom.xml ---------------------------------------------------------------------- diff --git a/maven-flex-plugin/examples/i18n/locale-chains/war/pom.xml b/maven-flex-plugin/examples/i18n/locale-chains/war/pom.xml new file mode 100644 index 0000000..e837c60 --- /dev/null +++ b/maven-flex-plugin/examples/i18n/locale-chains/war/pom.xml @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.flex.examples.i18n</groupId> + <artifactId>locale-chains</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <artifactId>locale-chains-war</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>war</packaging> + + <!-- + Properties used in the wrapper template, used by maven-war-plugin to + perform the filtering. + --> + <properties> + <swf>locale-chains-swf-1.0.0-SNAPSHOT</swf> + <width>100%</width> + <height>100%</height> + <title>My First Application</title> + <useBrowserHistory>true</useBrowserHistory> + <bgcolor>white</bgcolor> + <version_major>10</version_major> + <version_minor>2</version_minor> + <version_revision>0</version_revision> + <expressInstallSwf>expressInstall.swf</expressInstallSwf> + <application>application</application> + </properties> + + <build> + <plugins> + <!-- + Copy all the flex related resources (SWFs, RSLs, ...) + --> + <plugin> + <groupId>net.flexmojos.oss</groupId> + <artifactId>flexmojos-maven-plugin</artifactId> + <version>7.1.0-SNAPSHOT</version> + <executions> + <execution> + <goals> + <goal>copy-flex-resources</goal> + </goals> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.apache.flex</groupId> + <artifactId>compiler</artifactId> + <version>4.14.1</version> + <type>pom</type> + </dependency> + </dependencies> + </plugin> + <!-- + Builds the war and copies the flex default wrapper template. + --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>2.4</version> + <configuration> + <overlays> + <overlay> + <groupId>org.apache.flex.wrapper</groupId> + <artifactId>swfobject</artifactId> + <type>war</type> + <filtered>true</filtered> + </overlay> + </overlays> + </configuration> + </plugin> + <!-- + Make the war project "runnable" by running mvn jetty:run + --> + <plugin> + <groupId>org.mortbay.jetty</groupId> + <artifactId>maven-jetty-plugin</artifactId> + <version>6.1.17</version> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.flex.examples.i18n</groupId> + <artifactId>locale-chains-swf</artifactId> + <version>1.0.0-SNAPSHOT</version> + <type>swf</type> + </dependency> + + <dependency> + <groupId>org.apache.flex.wrapper</groupId> + <artifactId>swfobject</artifactId> + <version>4.14.1</version> + <type>war</type> + <scope>runtime</scope> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f8945125/maven-flex-plugin/examples/i18n/locale-chains/war/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/maven-flex-plugin/examples/i18n/locale-chains/war/src/main/webapp/WEB-INF/web.xml b/maven-flex-plugin/examples/i18n/locale-chains/war/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..8dd835a --- /dev/null +++ b/maven-flex-plugin/examples/i18n/locale-chains/war/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://java.sun.com/xml/ns/javaee" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + id="WebApp_ID" version="2.5"> + + <display-name>war war</display-name> + + <welcome-file-list> + <welcome-file>index.html</welcome-file> + </welcome-file-list> + +</web-app> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f8945125/maven-flex-plugin/examples/i18n/pom.xml ---------------------------------------------------------------------- diff --git a/maven-flex-plugin/examples/i18n/pom.xml b/maven-flex-plugin/examples/i18n/pom.xml index ac118df..26c6cc0 100644 --- a/maven-flex-plugin/examples/i18n/pom.xml +++ b/maven-flex-plugin/examples/i18n/pom.xml @@ -36,6 +36,7 @@ <modules> <module>compiled-locales</module> <module>runtime-locales</module> + <module>locale-chains</module> </modules> </project> \ No newline at end of file
