Giter VIP home page Giter VIP logo

translations's Introduction

Dark Sky API Translation Module

Introduction

The Dark Sky API has, since the very beginning, included a module for producing textual weather summaries from its weather data. These summaries have always been in English (since that's the only language we know) and have always been procedurally generated (since there are so many possible weather conditions). Procedural generation makes translating these summaries into other languages especially difficult, because the naive approach—using a table lookup to replace an English sentence with one of a different language—becomes impractical, requiring a very large table to support!

This software module was developed in order to work around these issues. We are modifying the Dark Sky API text summary code to generate a machine-readable format (described below) rather than it's usual English; summaries in this new format are then handed off to this module for translation into the desired language. Since this module is open-source, anyone may contribute additional language components to it, so that the desired language can be used in the Dark Sky API.

The API (and therefore this module as well) is written in JavaScript, and meant to be used as a Node.JS module. Knowledge of that environment is required in order to contribute to this software, but this document will do its best to provide a crash-course for developers that are not familiar with Node.

Getting Started

Install Node

You will need to have Node.JS installed. You can check to see whether it is installed by running:

$ node -v
v8.9.4

If the command gives an error message (or a version below 8), you should install Node from the Node.JS website and try again.

Install Dependencies

While this package requires no dependencies to run in production, if you want to develop against it you will need the testing library Mocha. Installing it is simple:

$ cd /path/to/translations
$ npm install

NPM is the Node Package Manager, and is part of the Node software distribution. The above command will create the directory node_modules which will contain the testing library. After this, you can verify that everything is working by running the tests:

$ npm test

> [email protected] test /path/to/translations
> mocha --reporter dot --check-leaks
  
  ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
  [...]

  2335 passing (732ms)

Input Format

The data passed from the Dark Sky API to this translation module is a simple, structured format reminiscent of s-expressions, consisting only of numbers, strings, and arrays. Some examples produced by the API are below:

  • "heavy-rain"
  • ["and", "light-wind", "light-clouds"]
  • ["starting-in", "very-light-rain", ["minutes", 15]]

Each of these expressions corresponds to a text summary in English:

  • "heavy rain"
  • "breezy and partly cloudy"
  • "drizzle starting in 15 minutes"

Generally speaking, numbers and strings represent specific terms, while arrays represent templates dependent upon some number of arguments (with the first element in that array representing the form of the template). For example, in the sentence above, "light-wind" represents the English term "breezy", "light-clouds" represents the English term "partly cloudy", and the array ["and", X, Y] represents the English phrase "X and Y".

In this way, the meaning (in English) of any given (machine-readable) expression is intended to be fairly intuitive. However, a complete description of the input format is given below in Appendix A anyway.

Adding a Translation

Translation Submodules

There is one translation submodule per language, all found in the /lib/lang directory. (Any source files in that directory are automatically loaded by the library at run-time, so nothing further needs to be done once the file is created.) Each submodule exports a JavaScript object, representing a collection of translation templates. An expression (as described above) will get looked up in the object and translated as the object's value dictates, recursively as necessary.

For example, suppose we have the following object:

{
  "very-light-rain": "drizzle",
  "minutes": function(n) {
    return n + " minutes";
  },
  "starting-in": function(rain, time) {
    return rain + " starting in " + time;
  }
}

And the expression noted above:

["starting-in", "very-light-rain", ["minutes", 15]]

The following algorithm will be applied:

  1. The function will first look at the expression ["starting-in", X, Y] and find that there is a corresponding function in the associative array with two arguments. It will then recursively apply the procedure on these two arguments.

  2. The function will then look at the expression "very-light-rain". There is also a match in the associative array, so this expression will be replaced with "drizzle".

  3. The function will then look at the expression ["minutes", 15]. There is once again a match in the associative array, for a function with a single argument. The function will once again recursively apply the procedure on the argument.

  4. The function will look at the expression 15. Being a number, it will simply return it verbatim.

  5. Having it's single argument collected, ["minutes", 15] is now replaced with the expression "15 minutes", as per the code of the function for "minutes".

  6. Finally, with the two arguments of ["starting-in", X, Y] collected, they are substituted into the function and a final expression is returned: "drizzle starting in 15 minutes".

Any arbitrary JavaScript code may be used in a function, but in many templating scenarios, only simple string concatenation is necessary. In these cases, a shortcut syntax is also allowed:

{
  "very-light-rain": "drizzle",
  "minutes": "$1 minutes",
  "starting-in": "$1 starting in $2"
}

The sigiled expressions are replaced with the numbered argument to the function ($1 with the first argument, $2 with the second, and so on).

Finally, if you need the extra power, each function's this parameter is set to an array representing the called function's position in the expression tree. For example, in the example above, the "minutes" function is passed this with a value of ["starting-in", "minutes"] since "minutes" is a child of the "starting-in" template. (This is handy for languages like Dutch or German where, I hear, that the ordering of words are important.)

Please see /lib/lang/en.js for an example of this in action.

Writing Tests

Once a new translation module has been created, it is advisable to write tests for it to ensure its correctness. (In fact, it may be advisable to write the tests beforehand!) Much of the work of this has been done for you; simply create the file /test-cases/<language>.json. This file should contain an associative array of translated sentences to the expression used to generate them:

{
  "drizzle starting in 15 minutes":
    ["starting-in", "very-light-rain", ["minutes", 15]]
}

The English test cases (/test-cases/en.json) may be used as an example and starting place. As noted above, you can verify your tests by running npm test. Pull requests without a full suite of passing tests will not be accepted. Please make every effort to ensure that your tests provide as full code coverage as possible.

General Considerations

When translating text summaries, please keep the following in mind:

  • Text summaries are often used by API consumers in headings: be as brief as possible, and use abbreviations where appropriate.
  • It is simpler to maintain one version of a language than two: avoid dialectal or regional variations if at all possible. (For example, we try to maintain one version of English, despite the several major, distinct English variants—American English, British English, etc. We have had to alter terminology a few times to avoid generating insulting summaries!)
  • Try to keep the text as natural as possible, so that it is easily intelligible to an average reader. (Yes, we know this conflicts with brevity, but try your best!)

Appendix A: Dark Sky Summary Format

Below is a listing of every possible machine-readable summary produced by Dark Sky. The listing is recursive so as to better describe how the various structural components interact.

Status Information

Instead of producing a summary of weather information, we may sometimes generate a status message indicating an error of some sort. Such messages may take one of the following forms:

  • ["sentence", [STATUS_MESSAGE, STATUS_TYPE, REASON]]

STATUS_MESSAGE may be one of the following:

  • "next-hour-forecast-status": we have information to convey about our hyperlocal next-hour forecasts

STATUS_TYPE may be one of the following:

  • "unavailable": no forecast is available for this request
  • "partially-unavailable": only a partial forecast is available for this request
  • "temporarily-unavailable": no forecast is available for this request, but we expect it to be available again in the future

REASON may be one of the following:

  • "station-offline": we cannot generate a forecast because all nearby weather stations are offline (e.g. for maintenance)
  • "station-incomplete": we cannot generate a forecast because of gaps in the coverage of all nearby weather stations (e.g. radar beams are blocked by local terrain)

"next-hour-forecast-status", "unavailable", "partially-unavailable", "temporarily-unavailable", "station-offline", and "station-incomplete" are not used in any other forms.

Moment Summaries

When the API is producing a text summary for a single moment in time (that is, currently.summary and hourly.data[N].summary), summaries of the following structure are produced:

  • ["title", WEATHER_CONDITION]
  • ["title", ["and", WEATHER_CONDITION, WEATHER_CONDITION]]

The "title" component is never used in any other situation, and signifies that (in English, anyway) these conditions represent phrases rather than complete sentences; as such, they are capitalized like a title (that is, each word is capitalized and there is no punctuation). For all below cases, the "summary" component wraps the construction (signifying that the summary represents a full, English sentence, meaning that only the first word is capitalized, and the sentence is to end with a period).

"and" is used all over the place. Sorry.

Hour Summaries

For text summaries for the next hour (that is, minutely.summary), summaries of the following formats are produced:

  • ["sentence", ["for-hour", WEATHER_CONDITION]]
  • ["sentence", ["starting-in", PRECIPITATION_TYPE, DURATION]]
  • ["sentence", ["stopping-in", PRECIPITATION_TYPE, DURATION]]
  • ["sentence", ["starting-then-stopping-later", PRECIPITATION_TYPE, DURATION, DURATION]]
  • ["sentence", ["stopping-then-starting-later", PRECIPITATION_TYPE, DURATION, DURATION]]

Except for the first case, each such summary only takes precipitation into account, and tells how the intensity of precipitation will vary over the next hour or so.

The DURATIONs listed above may be either of:

  • ["less-than", ["minutes", 1]] ("less than a minute")
  • ["minutes", NUMBER] ("X minutes")

"for-hour", "starting-in", "stopping-in", "starting-then-stopping-later", "stopping-then-starting-later", and "minutes" are only used as above. "less-than" is also used for snow accumulation (see below).

Day Summaries

Day summaries are produced by the API when a duration of 24 hours is under consideration (that is, hourly.summary and daily.data[N].summary). They are the most complex summaries in the API, owing to the number of possible combinations of the various terms. They are of the following formats:

  • ["sentence", DAY_CONDITION_SUMMARY]
  • ["sentence", ["and", DAY_CONDITION_SUMMARY, DAY_CONDITION_SUMMARY]]

Day Condition Summaries

A "day condition" represents a specific weather condition at a specific time of day. (Or a larger period of the day, as the case may be.)

  • ["for-day", WEATHER_CONDITION]
  • ["during", WEATHER_CONDITION, TIME_OF_DAY]
  • ["during", WEATHER_CONDITION, ["and", TIME_OF_DAY, TIME_OF_DAY]]
  • ["starting", WEATHER_CONDITION, TIME_OF_DAY]
  • ["until", WEATHER_CONDITION, TIME_OF_DAY]
  • ["starting-continuing-until", WEATHER_CONDITION, TIME_OF_DAY, TIME_OF_DAY]
  • ["until-starting-again", WEATHER_CONDITION, TIME_OF_DAY, TIME_OF_DAY]

"for-day", "starting", "until", "starting-continuing-until", and "until-starting-again" are only used in the above manner, and may be considered analagous to the five similar cases in hourly summaries. "during" is used both here and in weekly summaries, below.

Times of Day

Daily summaries covering a specific day use the following time periods:

  • "morning"
  • "afternoon"
  • "evening"
  • "night"

Daily summaries covering the next 24 hours (as in a forecast) use the following time periods instead:

  • "today-morning"
  • "today-afternoon"
  • "today-evening"
  • "today-night"
  • "later-today-morning"
  • "later-today-afternoon"
  • "later-today-evening"
  • "later-today-night"
  • "tomorrow-morning"
  • "tomorrow-afternoon"
  • "tomorrow-evening"
  • "tomorrow-night"

In general, the most specific case is used. (For example, if it is currently afternoon and a weather condition would occur later in the afternoon, "later-today-afternoon" would be used. If it was any other time of day, "today-afternoon" would be used.)

The exact times that each duration begins or ends is not intended to be critical, and nonprecise terminology should be used if possible. However, for aid in translation, the time periods currently correspond to the following:

  • morning: 04:00 (4am) to 12:00 (12pm)
  • afternoon: 12:00 (12pm) to 17:00 (5pm)
  • evening: 17:00 (5pm) to 22:00 (10pm)
  • night: 22:00 (10pm) to 04:00 (4am)

Week Summaries

For summaries spanning an entire week (daily.summary), the following format is used:

  • ["sentence", ["with", WEEKLY_PRECIPITATION_SUMMARY, WEEKLY_TEMPERATURE_SUMMARY]]

Since an entire week is a very broad span of time, we concern ourselves only with the most broadly applicable information: which days will have rain, and how the temperatures will fluctuate. The sentence is broken into two parts, which each comprise one of the above.

"with" is not used in any other way.

Weekly Precipitation Summary

A "weekly precipitation summary" is used to describe which days of the week are expected to have rain, as compactly as possible.

  • ["for-week", PRECIPITATION_TYPE]
  • ["over-weekend", PRECIPITATION_TYPE]
  • ["during", PRECIPITATION_TYPE, DAY_OF_WEEK]
  • ["during", PRECIPITATION_TYPE, ["and", DAY_OF_WEEK, DAY_OF_WEEK]]
  • ["during", PRECIPITATION_TYPE, ["through", DAY_OF_WEEK, DAY_OF_WEEK]]

"for-week", "over-weekend", and "through" are both only used as above. "during" is used both here and in daily summaries.

Weekly Temperature Summary

A "weekly temperature summary" describes the general pattern of temperatures over the course of the next week: whether they'll get hotter, colder, hotter-then-colder, or colder-then-hotter.

  • ["temperatures-rising", TEMPERATURE, DAY_OF_WEEK]
  • ["temperatures-falling", TEMPERATURE, DAY_OF_WEEK]
  • ["temperatures-peaking", TEMPERATURE, DAY_OF_WEEK]
  • ["temperatures-valleying", TEMPERATURE, DAY_OF_WEEK]

"temperatures-peaking", "temperatures-valleying", "temperatures-rising", and "temperatures-falling" are all only used as above.

Temperatures

  • ["fahrenheit", NUMBER]
  • ["celsius", NUMBER]

Every language should support both temperature units, as the choice of language and units are separate options in the API (and can be mixed-and-matched as desired).

Days of the Week

  • "today"
  • "tomorrow"
  • "sunday"
  • "monday"
  • "tuesday"
  • "wednesday"
  • "thursday"
  • "friday"
  • "saturday"
  • "next-sunday"
  • "next-monday"
  • "next-tuesday"
  • "next-wednesday"
  • "next-thursday"
  • "next-friday"
  • "next-saturday"

"today" and "tomorrow" are used in preference to the other cases. The "next-*" cases are used when the day in question is a week from today (e.g. if today is Wednesday, and we expect rain a week from today, then the summary would be ["during", "rain", "next-wednesday"].

Weather Conditions

Precipitation Types

  • "no-precipitation": Represents no precipitation. Only used in "weekly precipitation summary" blocks. (This condition is in contrast to "clear", which represents no significant weather of any kind.)
  • "mixed-precipitation": Represents multiple types of precipitation, such as both rain and snow. Only used in "weekly precipitation summary" blocks; in all other cases, the predominate type of precipitation is used.
  • GENERIC_TYPE
  • RAIN_TYPE
  • SLEET_TYPE
  • SNOW_TYPE
  • ["parenthetical", EXPECTED_PRECIP_TYPE, SNOW_ACCUMULATION]: For daily or weekly summaries, if a significant amount of snow is expected, we will qualify it with the amount of expected snow accumulation. (For example, "snow (3-4 in.) throughout the day".) PLEASE NOTE that it is possible for a chance of snow accumulation to be forecasted even if the expected precipitation type is rain or sleet: this may occur if the forecasted temperature is right around the freezing point. Translations should clarify that the parenthetical refers to a chance of snow in such circumstances. (For example, "sleet (chance of 3-4 in. of snow) throughout the day".)

In each of the below precipitation types, the intensity of precipitation is (very approximately) as follows:

  • "very-light-X": 0–0.4 mm/hr
  • "light-X": 0.4–2.5 mm/hr
  • "medium-X": 2.5–10 mm/hr
  • "heavy-X": 10 mm/hr

Snow intensities are (also very approximately) one-third of these. (That is, "heavy-snow" is more like 3 mm/hr.) However, these are only intended as a rough guide, as these values change over time as we fine-tune our system.

Generic Types

Generic precipitation forms are used when we don't have information regarding the exact type of precipitation expected. (This is a rare occurance.)

  • "possible-very-light-precipitation"
  • "very-light-precipitation"
  • "possible-light-precipitation"
  • "light-precipitation"
  • "medium-precipitation"
  • "heavy-precipitation"
Rain Types

Rain precipitation forms represent liquid precipitation.

  • "possible-very-light-rain"
  • "very-light-rain"
  • "possible-light-rain"
  • "light-rain"
  • "medium-rain"
  • "heavy-rain"
Sleet Types

Sleet precipitation forms represent sleet, freezing rain, or ice pellets, of the sort that generally occur in winter when temperatures are around freezing.

  • "possible-very-light-sleet"
  • "very-light-sleet"
  • "possible-light-sleet"
  • "light-sleet"
  • "medium-sleet"
  • "heavy-sleet"
Snow Types

Snow precipitation forms represent solid precipitation in the form of snowflakes.

  • "possible-very-light-snow"
  • "very-light-snow"
  • "possible-light-snow"
  • "light-snow"
  • "medium-snow"
  • "heavy-snow"
Snow Accumulation

Represents a distance measurement indicating the amount of snow accumulation is expected. These take the form of "N inches", "< N inches", or "M-N inches" in English, respectively.

  • ["inches", NUMBER]
  • ["less-than", ["inches", 1]]
  • ["inches", ["range", NUMBER, NUMBER]]
  • ["centimeters", NUMBER]
  • ["less-than", ["centimeters", 1]]
  • ["centimeters", ["range", NUMBER, NUMBER]]

Other Weather Conditions

  • "clear": Represents the lack of any significant weather occurring.
  • "possible-thunderstorm": Represents a chance of thunderstorms occurring.
  • "thunderstorm": Represents thunderstorms occurring.
  • "light-wind": Represents light wind at a location. (3 or 4 on the Beaufort scale, but only when this is historically unusual.)
  • "medium-wind": Represents moderate wind at a location. (5, 6, or 7 on the Beaufort scale, but only when this is historically unusual.)
  • "heavy-wind": Represents strong wind at a location. (8+ on the Beaufort scale.)
  • "low-humidity": Represents when the air is unusually dry.
  • "high-humidity": Represents when the air is unusually humid.
  • "fog": Represents when there is less than 1 mile (1.6 kilometers) of visibility.
  • "light-clouds": Represents when clouds cover less than half of the sky. (Usually called "partly cloudy" in English.)
  • "medium-clouds": Represents when clouds cover more than half (but not all) of the sky. (Usually called "mostly cloudy" in English.)
  • "heavy-clouds": Represents complete (or nearly-complete) cloud cover. (Usually called "overcast" in English.)

translations's People

Contributors

alni avatar andytempel avatar baio avatar bonifatio avatar bqra avatar broderbluff avatar cro-tomo avatar dmarkon avatar egormetlitsky avatar kanpyo02 avatar kostasdizas avatar kovloq avatar kravlost avatar kristijandraca avatar ltressens avatar lukino2000 avatar martinsefcik avatar metik avatar michaelarnauts avatar mrkcohen avatar pamo avatar phungdoanh avatar realjax avatar rizkiaditya24 avatar robotkala avatar santer-pl avatar sehers avatar sofish avatar srmihnev avatar szilardpal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

translations's Issues

Support Thunderstorm and Next-Week Properties in Russian

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Russian. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Definitions of rain, wind etc

Since I'm no meteorologist, is it possible to define rain in more physical/technical way to find the right translation?

E.g.: 'light-wind': 0-10 km/h, 'medium-wind': 11-50 km/h
or 'very-light-rain': 0.1 - 0.4 mm in 10 minutes or an hour

would help a lot to find the right termini technici.

Greetings, Mike

Español

Hi! I wanna contribute to Spanish translations. How would I get started? I've begun es.json by copying en.json and the keys.
pamo@ddf1ebb

Should I continue doing this? How would change en.js to match es.js?

Support Thunderstorm, Next-Week, and Status Properties in Arabic

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday
  • next-hour-forecast-status
  • unavailable
  • temporarily-unavailable
  • partially-unavailable
  • station-offline
  • station-incomplete

Add support for these properties to Arabic. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Greek

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Greek. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Czech

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Czech. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm, Next-Week, and Status Properties in Bosnian

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday
  • next-hour-forecast-status
  • unavailable
  • temporarily-unavailable
  • partially-unavailable
  • station-offline
  • station-incomplete

Add support for these properties to Bosnian. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Properly translate possible-* cases in German

I noticed this morning that the German translation was missing the following terms:

  • possible-very-light-precipitation
  • possible-light-precipitation
  • possible-very-light-rain
  • possible-light-rain
  • possible-very-light-sleet
  • possible-light-sleet
  • possible-very-light-snow
  • possible-light-snow

I added a quick hack to correct for this, simply copying the terminology from the related cases (e.g. very-light-precipitation, light-precipitation, etc.). Could somebody who is familiar with German fix these lines such that they indicate that the precipitation only has a chance of occurring?

  "possible-very-light-precipitation": "leichter Niederschlag", // FIXME
  "possible-light-precipitation": "leichter Niederschlag", // FIXME
  "possible-very-light-rain": "Nieselregen", // FIXME
  "possible-light-rain": "leichter Regen", // FIXME
  "possible-very-light-sleet": "leichter Graupelregen", // FIXME
  "possible-light-sleet": "leichter Graupelregen", // FIXME
  "possible-very-light-snow": "leichter Schneefall", // FIXME
  "possible-light-snow": "leichter Schneefall", // FIXME

Based on the possible-thunderstorm term, my guess is that the translation would be the following, but I would appreciate confirmation/correction:

  "possible-very-light-precipitation": "mögliche leichter Niederschlag",
  "possible-light-precipitation": "mögliche leichter Niederschlag",
  "possible-very-light-rain": "mögliche Nieselregen",
  "possible-light-rain": "mögliche leichter Regen",
  "possible-very-light-sleet": "mögliche leichter Graupelregen",
  "possible-light-sleet": "mögliche leichter Graupelregen",
  "possible-very-light-snow": "mögliche leichter Schneefall",
  "possible-light-snow": "mögliche leichter Schneefall",

Thanks!

(Tagging @jacbz @mrkcohen @TheMikeGraz as they previously contributed to this translation.)

Support Thunderstorm and Next-Week Properties in German

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to German. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Portuguese

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Portuguese. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Issue with German translation?

We received this question from a German user:

nice website with great functionality. I tried the german version out of
curiosity and came upon the word
"Fäl­lung" for precipitation. I have never heard it used in this
context before. I would suggest that "Niederschlag"
is a better translation and more commonly understood in this context.
Faellung is both a term used in chemistry for precipitation or has to do
with chopping trees.

(If you look up precipation on Wikipedia and than look for that page in
other languages and select german it will take you to a page about
Niederschlag and talk about the weather.)

Support Thunderstorm and Next-Week Properties in Italian

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Italian. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Swedish

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Swedish. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Please add examples

Would appreciate if you could add an example how to obtain a summary/ translation e.g. of the current weather condition.

Support Thunderstorm and Next-Week Properties in Slovak

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Slovak. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Traditional Chinese

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to traditional Chinese. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm, Next-Week, and Status Properties in Tetum

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday
  • next-hour-forecast-status
  • unavailable
  • temporarily-unavailable
  • partially-unavailable
  • station-offline
  • station-incomplete

Add support for these properties to Tetum. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Indonesian

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Indonesian. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Bring Nouns into Translation Module

Right now, our API generates the nouns like the following as input to the translations module:

today-morning
monday
medium-rain

And so on.

Classification of these nouns may vary by language. For example, Swedish has much more specific terms for snow than English does, and it is inappropriate to use the English classifications in that language.

As such, we should break down nouns by category, and should create predicates that allow one to customize the predicates as appropriate for each language.

I havn't yet generated a complete list, but a few things that we'll need to do:

  • Replace today-morning, later-today-morning, today-afternoon, later-today-afternoon, today-evening, later-today-evening, today-night, later-today-night, tomorrow-morning, tomorrow-afternoon, tomorrow-evening, tomorrow-night, morning, afternoon, evening, night, today, tomorrow, sunday, monday, tuesday, wednesday, thursday, friday, saturday with (timestamp then now). then should be a JavaScript Date object representing the time of the target. now should be a JavaScript Date object representing the current time, or null if the summary is not a forecast summary. (That is, is an daily.data[x].summary or a hourly.summary on a time machine request.) (Additionally, there's a bug in the current English summaries to fix: if we're referring to the day a week from today, instead of saying the day's name, we should say "next X", instead.)
  • Replace light-wind, medium-wind, heavy-wind with (wind wind-speed wind-direction). In English, this would be defined as follows:
"wind": function(speed, direction) {
  return wind_speed < 25.0 ? "breezy":
         wind_speed < 38.5 ? "windy":
                             "dangerously windy";
}

Support Thunderstorm and Next-Week Properties in Polish

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Polish. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Simplified Chinese

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to simplified Chinese. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

"Strong wind" translation broken

The term "breezy" does not mean "light wind" (http://www.merriam-webster.com/dictionary/breezy), rather the opposite.
I'm not picky about language but have noticed that in translation (at least to Polish) it actually gets translated that way which kind of defeats the purpose. The forecast says "light wind" in Polish and we get branches falling down.
The problem does not reside in the Polish translation, though. There's no "breezy" in any place of the Polish translation and as I'm not sure how the whole process goes I've decided to report it here.

Or I had it wrong and the simply the wind prediction is off for my neck of woods?

Support Thunderstorm and Next-Week Properties in Cornish

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Cornish. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Tests for x-pig-latin are failing.

Since f40f534

  1) translation language x-pig-latin should translate ["sentence",["with",["during","medium-precipitation",["through","today","saturday"]],["temperatures-peaking",["fahrenheit",100],"monday"]]] to "Ecipitationpray odaytay oughthray aturdaysay, ithway emperaturestay eakingpay atway 100°F onway ondaymay.":

      AssertionError: 'Ecipitationpray odaytay oughthray extnay aturdaysay, ithway emperaturestay eakingpay atway 100°F onway ondaymay.' === 'Ecipitationpray odaytay oughthray aturdaysay, ithway emperaturestay eakingpay atway 100°F onway ondaymay.'
      + expected - actual

      -Ecipitationpray odaytay oughthray extnay aturdaysay, ithway emperaturestay eakingpay atway 100°F onway ondaymay.
      +Ecipitationpray odaytay oughthray aturdaysay, ithway emperaturestay eakingpay atway 100°F onway ondaymay.

Support Thunderstorm, Next-Week, and Status Properties in Icelandic

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday
  • next-hour-forecast-status
  • unavailable
  • temporarily-unavailable
  • partially-unavailable
  • station-offline
  • station-incomplete

Add support for these properties to Icelandic. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Make weekly temperature summaries more precise

A Dark Sky API customer noted that this summary is poor: "Bruine demain, avec des températures atteignant 24°C jeudi." (Translation: "Drizzle tomorrow, with temperatures bottoming out at 24°C on Thursday.")

They recommend using this instead: "Bruine demain, avec des températures maximales atteignant 24°C jeudi." (Translation: "Drizzle tomorrow, with high temperatures bottoming out at 24°C on Thursday.")

This could be fixed across the board (e.g. in all languages) to make the summaries more precise.

Support Thunderstorm, Next-Week, and Status Properties in Serbian

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday
  • next-hour-forecast-status
  • unavailable
  • temporarily-unavailable
  • partially-unavailable
  • station-offline
  • station-incomplete

Add support for these properties to Serbian. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Errors in Dutch Translation

We received the following comments from a developer using the API:

The following two sentences have minor grammatical problems:

  1. Lichte regen vandaag tot op zondag met temperaturen stijgend tot 19°C op zondag
  2. Lichte regen morgen tot van maandag met temperaturen stijgend tot 16°C op maandag.

Literally translated is:

  1. Light rain today till up Sunday with temperatures increasing to 19°C on Sunday.
  2. Light rain tomorrow till from Monday with temperatures increasing to 16°C on Monday.

A better sentence would be:

  1. Lichte regen vandaag t/m zondag met temperaturen stijgend tot 19°C op zondag
  2. Lichte regen morgen tot maandag met temperaturen stijgend tot 16°C op maandag.

I believe the existing translation is from @basvdijk and @realjax... any thoughts on this?

Support Thunderstorm and Next-Week Properties in Catalan

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Catalan. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm, Next-Week, and Status Properties in Finnish

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday
  • next-hour-forecast-status
  • unavailable
  • temporarily-unavailable
  • partially-unavailable
  • station-offline
  • station-incomplete

Add support for these properties to Finnish. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Bulgarian

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Bulgarian. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm, Next-Week, and Status Properties in Hungarian

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday
  • next-hour-forecast-status
  • unavailable
  • temporarily-unavailable
  • partially-unavailable
  • station-offline
  • station-incomplete

Add support for these properties to Hungarian. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Norwegian Bokmål

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Norwegian Bokmål. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Errors in Russian and Ukrainian translations

The two translations have a function time2, which changes "tomorrow-afternoon" ("завтра днем" [ru], "завтра вдень" [uk]) to "tomorrow-morning" ("завтрашнего утра" [ru], "завтрашнього ранку" [uk]). Here should "завтрашнего дня" [ru], "завтрашнього дня" [uk] be.

Support Thunderstorm and Next-Week Properties in Belarusian

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Belarusian. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Error in German Translation

A user reported that we report this sentence:

Leichter Regen bis zum heute Nacht und morgen Nachmittag wieder.

It doesn't need the word "zum".

Support Thunderstorm and Next-Week Properties in Dutch

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Dutch. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Spanish

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Spanish. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Errors in German Translation

A user writes, there is an error in the German translation. The english summary "Drizzle starting in the evening." is translated to "In Abend Nieselregen" where it should be "Am Abend Nieselregen."

I would love to see this fixed, but I don't speak German. Could somebody who does make the appropriate changes?

Support Thunderstorm and Next-Week Properties in Estonian

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Estonian. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Tweaks to German Translations

@TheMikeGraz A user sent us a complaint about a few of the translations, and I wanted to run them by you before I made a patch.

  • "Light rain starting in the afternoon." (["sentence", ["starting", "light-rain", "afternoon"]]) translates to "In Nachmittag leichter Regen." but should translate to "Am Nachmittag leichter Regen.", instead.
  • "Light rain until evening." (["sentence", ["until", "light-rain", "evening"]]) translates to "Leichter Regen bis Abend." but should translate to "Leichter Regen bis zum Abend."
  • "Drizzle until afternoon, starting again overnight." (["sentence", ["until-starting-again", "very-light-rain", "afternoon", "night"]]) translates to "Nieselregen bis zum Nachmittag und wieder Nacht." but should translate to "Nieselregen bis zum Nachmittag und in der Nacht."

Are each of his proposed translation changes correct? I have a patch that incorporates them that I can apply if so. (If you'd like to look at it first, I can apply them to a branch.)

Support Thunderstorm, Next-Week, and Status Properties in Azerbaijani

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday
  • next-hour-forecast-status
  • unavailable
  • temporarily-unavailable
  • partially-unavailable
  • station-offline
  • station-incomplete

Add support for these properties to Azerbaijani. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Ukrainian

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Ukrainian. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in French

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to French. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Croatian

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Croatian. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Slovenian

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Slovenian. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Support Thunderstorm and Next-Week Properties in Turkish

In the near future, the API will begin generating the following new properties:

  • possible-thunderstorm
  • thunderstorm
  • next-sunday
  • next-monday
  • next-tuesday
  • next-wednesday
  • next-thursday
  • next-friday
  • next-saturday

Add support for these properties to Turkish. (Information is available in the README, and examples are visible in /lib/lang/en.js and /test_cases/en.js.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.