Skip to content

Commit

Permalink
0.0.9 - Updated translation
Browse files Browse the repository at this point in the history
  • Loading branch information
ponlawat-w committed Dec 8, 2023
1 parent 77ab7f9 commit 9c1b4a3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gtfs-io",
"type": "module",
"version": "0.0.8",
"version": "0.0.9",
"description": "IO operations for reading and writing GTFS datasets and GTFS type definitions.",
"main": "dist/index.js",
"keywords": [
Expand Down
45 changes: 35 additions & 10 deletions src/files/translation.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
/** In regions that have multiple official languages, transit agencies/operators typically have language-specific names and web pages. In order to best serve riders in those regions, it is useful for the dataset to include these language-dependent values.2 */
import { GTFSTableName } from '../file-info';

type TranslationByRecordID = {
/** Defines the record that corresponds to the field to be translated. */
record_id: string,
/** Helps the record that contains the field to be translated when the table doesn’t have a unique ID. */
record_sub_id: string|number,
/** Instead of defining which record should be translated by using `record_id` and `record_sub_id`, this field can be used to define the value which should be translated. */
field_value?: undefined|''
};

type TranslationByFieldValue = {
/** Defines the record that corresponds to the field to be translated. */
record_id?: undefined|'',
/** Helps the record that contains the field to be translated when the table doesn’t have a unique ID. */
record_sub_id?: undefined|'',
/** Instead of defining which record should be translated by using `record_id` and `record_sub_id`, this field can be used to define the value which should be translated. */
field_value?: string
};

type TranslationOfFeedInfo = {
/** Defines the table that contains the field to be translated. */
table_name: 'feed_info',
/** Defines the record that corresponds to the field to be translated. */
record_id?: undefined,
/** Helps the record that contains the field to be translated when the table doesn’t have a unique ID. */
record_sub_id?: undefined,
/** Instead of defining which record should be translated by using `record_id` and `record_sub_id`, this field can be used to define the value which should be translated. */
field_value?: undefined
};

/** In regions that have multiple official languages, transit agencies/operators typically have language-specific names and web pages. In order to best serve riders in those regions, it is useful for the dataset to include these language-dependent values. */
export type GTFSTranslation = {
/** Defines the table that contains the field to be translated. */
table_name: string,
table_name: GTFSTableName,
/** Name of the field to be translated. */
field_name: string,
/** Language of translation. */
language: string,
/** Translated value. */
translation: string,
/** Defines the record that corresponds to the field to be translated. */
record_id?: string,
/** Helps the record that contains the field to be translated when the table doesn’t have a unique ID. */
record_sub_id?: string,
/** Instead of defining which record should be translated by using `record_id` and `record_sub_id`, this field can be used to define the value which should be translated. */
field_value?: string
};
translation: string
} & (TranslationByRecordID | TranslationByFieldValue | TranslationOfFeedInfo);

0 comments on commit 9c1b4a3

Please sign in to comment.