Mengonversi file .strings menjadi file .strings.json
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Untuk mengonversi file .strings menjadi file .strings.json:
Jika Anda menggunakan versi Looker sebelum 7.12, nonaktifkan fitur lama File .strings lama untuk pelokalan.
Buat file .strings.json baru untuk project Anda dengan mengklik ikon + di kanan atas daftar file project, lalu pilih Create Locale Strings File.
Beri nama file .strings.json baru Anda. Judul file .strings harus cocok dengan kode lokalitas yang ditetapkan untuk pengguna atau grup yang menggunakan lokalitas tersebut, dan judul file lokalitas default harus cocok dengan nilai untuk default_locale di file manifes project Anda.
Cuplikan yang muncul di file .strings.json baru memberikan contoh pemformatan JSON. Hapus contoh ini dan ganti dengan sepasang kurung kurawal: {}
Salin pasangan nilai kunci dari file .strings lama dan tempelkan di dalam tanda kurung kurawal.
Ganti semua tanda sama dengan dengan titik dua.
Hapus komentar apa pun; atau format ulang sebagai komentar individual atau sebagai array komentar, seperti yang diilustrasikan di bawah.
Ganti semua titik koma dengan koma.
Pemformatan .strings.json standar dari pasangan nilai kunci terlihat seperti ini:
Untuk memformat komentar, Anda dapat menggunakan format berikut:
{
" My Comment": {
"my_comment_array": [
"The name of this file should be the associated locale code followed by '.strings.json'",
"There is one .strings.json file per locale.",
"Define your translated strings one key at a time",
"Keys can be any string; choose whatever scheme helps you stay organized",
"Then, set your Lookml label and description parameters to the desired key values.",
"To choose this file as the master key list and as the one to validate against",
"set its locale code ('test') as the default_locale in the manifest file"
],
"value": "Translation for My Comment"
},
"My Key": {
"value": "Translation for My Key",
"comment": "Define your translated strings with a comment or an array of comments"
}
}
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-31 UTC."],[],[],null,["# Converting .strings files to .strings.json files\n\nTo convert a `.strings` file to a `.strings.json` file:\n\n1. If you're using a Looker version prior to 7.12, turn off the **Legacy .strings files for localization** legacy feature.\n2. Create a new `.strings.json` file for your project by clicking the **+** icon at the top right of your project file list and selecting **Create Locale Strings File**.\n3. Name your new `.strings.json` file. The titles of `.strings` files must [match the locale code](/looker/docs/model-localization#assigning_users_to_a_locale) assigned to users or groups who are using that locale, and the title of the default locale file must match the value for the `default_locale` in your project's [manifest file](/looker/docs/model-localization#manifest).\n4. The snippet that appears in the new `.strings.json` file provides an example of JSON formatting. Delete this example and replace it with a pair of curly braces: `{}`\n5. Copy the key-value pairs from your old `.strings` file and paste them inside the curly braces.\n6. Replace all the equal signs with colons.\n7. Remove any comments; or reformat them as individual comments or as an array of comments, as illustrated next.\n8. Replace all the semicolons with commas.\n\n\nTypical `.strings.json` formatting of the key-value pairs looks like this: \n\n```\n{\n \"flight_info\" : \"Flight Info\",\n \"id\" : \"Identifier\",\n \"airline\" : \"Air Carrier\"\n}\n```\n\n\nTo format comments, you can use these formats: \n\n```\n{\n \" My Comment\": {\n \"my_comment_array\": [\n \"The name of this file should be the associated locale code followed by '.strings.json'\",\n \"There is one .strings.json file per locale.\",\n \"Define your translated strings one key at a time\",\n \"Keys can be any string; choose whatever scheme helps you stay organized\",\n \"Then, set your Lookml label and description parameters to the desired key values.\",\n \"To choose this file as the master key list and as the one to validate against\",\n \"set its locale code ('test') as the default_locale in the manifest file\"\n ],\n \"value\": \"Translation for My Comment\"\n },\n \"My Key\": {\n \"value\": \"Translation for My Key\",\n \"comment\": \"Define your translated strings with a comment or an array of comments\"\n }\n}\n```"]]