<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>com.atlassian.jira</groupId>
    <artifactId>jira-plugins</artifactId>
    <version>5.2.2</version>
  </parent>
  <artifactId>jira-languages</artifactId>
  <name>Atlassian JIRA - Language Packs</name>


  <properties>
      <generated.locale.dir>${project.build.directory}/generated-sources/pseudo-loc</generated.locale.dir>
  </properties>

  <build>
      <resources>
          <resource>
              <directory>src/lang</directory>
              <filtering>true</filtering>
              <includes>
                  <include>**/*.xml</include>
              </includes>
          </resource>
          <resource>
              <directory>src/lang</directory>
              <filtering>false</filtering>
              <excludes>
                  <exclude>**/*.xml</exclude>
              </excludes>
          </resource>
      </resources>
      <plugins>
          <plugin>
              <artifactId>maven-jar-plugin</artifactId>
              <executions>
                  <execution>
                      <id>en_US</id>
                      <goals>
                          <goal>jar</goal>
                      </goals>
                      <configuration>
                          <classifier>en_US</classifier>
                          <classesDirectory>${project.build.outputDirectory}/en_US</classesDirectory>
                      </configuration>
                  </execution>

                  <execution>
                      <id>en_UK</id>
                      <goals>
                          <goal>jar</goal>
                      </goals>
                      <configuration>
                          <classifier>en_UK</classifier>
                          <classesDirectory>${project.build.outputDirectory}/en_UK</classesDirectory>
                      </configuration>
                  </execution>
                  <execution>
                      <id>en_AQ</id>
                      <goals>
                          <goal>jar</goal>
                      </goals>
                      <configuration>
                          <classifier>en_AQ</classifier>
                          <classesDirectory>${generated.locale.dir}</classesDirectory>
                      </configuration>
                  </execution>

                  <execution>
                      <id>en_UD</id>
                      <goals>
                          <goal>jar</goal>
                      </goals>
                      <configuration>
                          <classifier>en_UD</classifier>
                          <classesDirectory>${project.build.outputDirectory}/en_UD</classesDirectory>
                      </configuration>
                  </execution>

              </executions>
          </plugin>
          <plugin>
              <artifactId>maven-antrun-plugin</artifactId>
              <executions>
                  <execution>
                      <id>move-to-default-languages</id>
                      <phase>generate-resources</phase>
                      <goals>
                          <goal>run</goal>
                      </goals>
                      <configuration>
                          <tasks>
                              <copy file="${project.basedir}/../../jira-core/src/main/resources/com/atlassian/jira/web/action/JiraWebActionSupport.properties" tofile="${project.build.outputDirectory}/default/com/atlassian/jira/web/action/JiraWebActionSupport.properties" overwrite="true" />
                          </tasks>
                      </configuration>
                  </execution>
                  <execution>
                      <id>move-uk-languages</id>
                      <phase>generate-resources</phase>
                      <goals>
                          <goal>run</goal>
                      </goals>
                      <configuration>
                          <tasks>
                              <copy file="${project.basedir}/../../jira-core/src/main/resources/com/atlassian/jira/web/action/JiraWebActionSupport.properties" tofile="${project.build.outputDirectory}/en_UK/com/atlassian/jira/web/action/JiraWebActionSupport_en_UK.properties" overwrite="true" />
                          </tasks>
                      </configuration>
                  </execution>
                  <!--<execution>-->
                      <!--<id>move-us-languages</id>-->
                      <!--<phase>generate-resources</phase>-->
                      <!--<goals>-->
                          <!--<goal>run</goal>-->
                      <!--</goals>-->
                      <!--<configuration>-->
                          <!--<tasks>-->
                              <!--<copy file="${project.basedir}/../../jira-core/src/main/resources/com/atlassian/jira/web/action/JiraWebActionSupport.properties"-->
                                    <!--tofile="${project.build.outputDirectory}/en_UK/com/atlassian/jira/web/action/JiraWebActionSupport_en_UK.properties"-->
                                    <!--overwrite="true" />-->
                          <!--</tasks>-->
                      <!--</configuration>-->
                  <!--</execution>-->

              </executions>
          </plugin>
      </plugins>
  </build>
  <profiles>
    <profile>
      <id>no-skip-test-compile</id>
      <activation>
        <property>
          <name>!maven.test.skip</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.atlassian.properties.check</groupId>
            <artifactId>properties-check-maven-plugin</artifactId>
            <version>0.1</version>
            <executions>
              <execution>
                <phase>process-resources</phase>
                <goals>
                  <goal>check</goal>
                </goals>
                <configuration>
                  <fileset>
                    <directory>${project.basedir}/../../jira-core/src/main/resources/com/atlassian/jira/web/action</directory>
                    <include>*.properties</include>
                  </fileset>
                  <checks>
                    <check>
                      <name>empty value check</name>
                    </check>
                    <check>
                      <name>line end check</name>
                    </check>
                    <check>
                      <name>messageformat check</name>
                    </check>
                    <check>
                      <name>empty key check</name>
                    </check>
                    <check>
                      <name>duplicate key check</name>
                    </check>
                    <check>
                      <name>placeholder check</name>
                    </check>
                    <check>
                      <name>invalid char check</name>
                    </check>
                  </checks>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-resources</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${generated.locale.dir}</outputDirectory>
                  <resources>
                    <resource>
                      <directory>src/lang/en_AQ</directory>
                      <filtering>true</filtering>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>pseudo-loc-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>pseudo-loc</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>pseudo-loc</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <sourceLocale>en_UK</sourceLocale>
              <targetLocale>en_AQ</targetLocale>
              <pseudoLocaliseActions>
                <pseudoLocaliseAction>
                  <source>
                    ../../jira-core/src/main/resources/com/atlassian/jira/web/action/JiraWebActionSupport.properties
                  </source>
                  <target>
                    ${generated.locale.dir}/com/atlassian/jira/web/action/JiraWebActionSupport_{loc}.properties
                  </target>
                </pseudoLocaliseAction>
              </pseudoLocaliseActions>
            </configuration>
          </plugin>
          <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>atlassian-i18n-upsidedown-text-maven-plugin</artifactId>
            <version>1.1</version>
            <executions>
              <execution>
                <id>upsidedowntext</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>upsidedowntext</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <upsideDownActions>
                <upsideDownAction>
                  <sourceProperties>
                    ../../jira-core/src/main/resources/com/atlassian/jira/web/action/JiraWebActionSupport.properties
                  </sourceProperties>
                  <targetProperties>
                    ${project.build.outputDirectory}/en_UD/com/atlassian/jira/web/action/JiraWebActionSupport_en_UD.properties
                  </targetProperties>
                </upsideDownAction>
              </upsideDownActions>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
