about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorKoala Yeung <koalay@gmail.com>2017-05-07 22:39:37 +0800
committerEugen Rochko <eugen@zeonfederated.com>2017-05-07 16:39:37 +0200
commite4b84c7ba5bc4fa92f97aa8853d07931e460f87a (patch)
tree7beb308c5aeac3bb397efc99d6fbb63b4dbc0aa1 /app/javascript
parent983593ddf4b2f61f3c3a6cd1fddbb1905592600e (diff)
locale: add Occitan locale-data for js (#2845)
Translation works by @Quent-in.
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/containers/mastodon.js2
-rw-r--r--app/javascript/mastodon/locales/locale-data/README.md129
-rw-r--r--app/javascript/mastodon/locales/locale-data/oc.js112
3 files changed, 243 insertions, 0 deletions
diff --git a/app/javascript/mastodon/containers/mastodon.js b/app/javascript/mastodon/containers/mastodon.js
index 2563c00cf..c21e84d9c 100644
--- a/app/javascript/mastodon/containers/mastodon.js
+++ b/app/javascript/mastodon/containers/mastodon.js
@@ -60,6 +60,7 @@ import it from 'react-intl/locale-data/it';
 import ja from 'react-intl/locale-data/ja';
 import nl from 'react-intl/locale-data/nl';
 import no from 'react-intl/locale-data/no';
+import oc from '../locales/locale-data/oc';
 import pt from 'react-intl/locale-data/pt';
 import ru from 'react-intl/locale-data/ru';
 import uk from 'react-intl/locale-data/uk';
@@ -95,6 +96,7 @@ addLocaleData([
   ...ja,
   ...nl,
   ...no,
+  ...oc,
   ...pt,
   ...ru,
   ...uk,
diff --git a/app/javascript/mastodon/locales/locale-data/README.md b/app/javascript/mastodon/locales/locale-data/README.md
new file mode 100644
index 000000000..7280784d8
--- /dev/null
+++ b/app/javascript/mastodon/locales/locale-data/README.md
@@ -0,0 +1,129 @@
+# Custom Locale Data
+
+This folder is used to store custom locale data. These custom locale data are
+not yet provided by [Unicode Common Locale Data Repository](http://cldr.unicode.org/development/new-cldr-developers)
+and hence not provided in [react-intl/locale-data/*](https://github.com/yahoo/react-intl).
+
+The locale data should support [Locale Data APIs](https://github.com/yahoo/react-intl/wiki/API#locale-data-apis)
+of the react-intl library.
+
+It is recommended to start your custom locale data from this sample English
+locale data:
+
+```javascript
+/*eslint eqeqeq: "off"*/
+/*eslint no-nested-ternary: "off"*/
+
+export default [
+  {
+    locale: "en",
+    pluralRuleFunction: function(e, a) {
+      var n = String(e).split("."),
+        l = !n[1],
+        o = Number(n[0]) == e,
+        t = o && n[0].slice(-1),
+        r = o && n[0].slice(-2);
+      return a ? 1 == t && 11 != r ? "one" : 2 == t && 12 != r ? "two" : 3 == t && 13 != r ? "few" : "other" : 1 == e && l ? "one" : "other"
+    },
+    fields: {
+      year: {
+        displayName: "year",
+        relative: {
+          0: "this year",
+          1: "next year",
+          "-1": "last year"
+        },
+        relativeTime: {
+          future: {
+            one: "in {0} year",
+            other: "in {0} years"
+          },
+          past: {
+            one: "{0} year ago",
+            other: "{0} years ago"
+          }
+        }
+      },
+      month: {
+        displayName: "month",
+        relative: {
+          0: "this month",
+          1: "next month",
+          "-1": "last month"
+        },
+        relativeTime: {
+          future: {
+            one: "in {0} month",
+            other: "in {0} months"
+          },
+          past: {
+            one: "{0} month ago",
+            other: "{0} months ago"
+          }
+        }
+      },
+      day: {
+        displayName: "day",
+        relative: {
+          0: "today",
+          1: "tomorrow",
+          "-1": "yesterday"
+        },
+        relativeTime: {
+          future: {
+            one: "in {0} day",
+            other: "in {0} days"
+          },
+          past: {
+            one: "{0} day ago",
+            other: "{0} days ago"
+          }
+        }
+      },
+      hour: {
+        displayName: "hour",
+        relativeTime: {
+          future: {
+            one: "in {0} hour",
+            other: "in {0} hours"
+          },
+          past: {
+            one: "{0} hour ago",
+            other: "{0} hours ago"
+          }
+        }
+      },
+      minute: {
+        displayName: "minute",
+        relativeTime: {
+          future: {
+            one: "in {0} minute",
+            other: "in {0} minutes"
+          },
+          past: {
+            one: "{0} minute ago",
+            other: "{0} minutes ago"
+          }
+        }
+      },
+      second: {
+        displayName: "second",
+        relative: {
+          0: "now"
+        },
+        relativeTime: {
+          future: {
+            one: "in {0} second",
+            other: "in {0} seconds"
+          },
+          past: {
+            one: "{0} second ago",
+            other: "{0} seconds ago"
+          }
+        }
+      }
+    }
+  }
+]
+
+```
diff --git a/app/javascript/mastodon/locales/locale-data/oc.js b/app/javascript/mastodon/locales/locale-data/oc.js
new file mode 100644
index 000000000..83b1b7412
--- /dev/null
+++ b/app/javascript/mastodon/locales/locale-data/oc.js
@@ -0,0 +1,112 @@
+/*eslint eqeqeq: "off"*/
+/*eslint no-nested-ternary: "off"*/
+
+export default [{
+  locale: "oc",
+  pluralRuleFunction: function(e, a) {
+    var n = String(e).split("."),
+      l = !n[1],
+      o = Number(n[0]) == e,
+      t = o && n[0].slice(-1),
+      r = o && n[0].slice(-2);
+    return a ? 1 == t && 11 != r ? "un" : 2 == t && 12 != r ? "dos" : 3 == t && 13 != r ? "pauc" : "autre" : 1 == e && l ? "un" : "autre"
+  },
+  fields: {
+    year: {
+      displayName: "an",
+      relative: {
+        0: "ongan",
+        1: "l'an que ven",
+        "-1": "l'an passat"
+      },
+      relativeTime: {
+        future: {
+          one: "dins {0} an",
+          other: "dins {0} ans"
+        },
+        past: {
+          one: "fa {0} an",
+          other: "fa {0} ans"
+        }
+      }
+    },
+    month: {
+      displayName: "mes",
+      relative: {
+        0: "aqueste mes",
+        1: "lo mes que ven",
+        "-1": "lo mes passat"
+      },
+      relativeTime: {
+        future: {
+          one: "dins {0} mes",
+          other: "dins {0} meses"
+        },
+        past: {
+          one: "fa {0} mes",
+          other: "fa {0} meses"
+        }
+      }
+    },
+    day: {
+      displayName: "jorn",
+      relative: {
+        0: "uèi",
+        1: "deman",
+        "-1": "ièr"
+      },
+      relativeTime: {
+        future: {
+          one: "dins {0} jorn",
+          other: "dins {0} jorns"
+        },
+        past: {
+          one: "fa {0} jorn",
+          other: "fa {0} jorns"
+        }
+      }
+    },
+    hour: {
+      displayName: "ora",
+      relativeTime: {
+        future: {
+          one: "dins {0} ora",
+          other: "dins {0} oras"
+        },
+        past: {
+          one: "fa {0} ora",
+          other: "fa {0} oras"
+        }
+      }
+    },
+    minute: {
+      displayName: "minuta",
+      relativeTime: {
+        future: {
+          one: "dins {0} minuta",
+          other: "dins {0} minutas"
+        },
+        past: {
+          one: "fa {0} minuta",
+          other: "fa {0} minutas"
+        }
+      }
+    },
+    second: {
+      displayName: "segonda",
+      relative: {
+        0: "ara"
+      },
+      relativeTime: {
+        future: {
+          one: "dins {0} segonda",
+          other: "dins {0} segondas"
+        },
+        past: {
+          one: "fa {0} segonda",
+          other: "fa {0} segondas"
+        }
+      }
+    }
+  }
+}]