Converter ficheiros .strings em ficheiros .strings.json
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Para converter um ficheiro .strings num ficheiro .strings.json:
Se estiver a usar uma versão do Looker anterior à 7.12, desative a funcionalidade antiga Ficheiros .strings antigos para localização.
Crie um novo ficheiro .strings.json para o seu projeto clicando no ícone + na parte superior direita da lista de ficheiros do projeto e selecionando Criar ficheiro de strings locais.
Atribua um nome ao novo ficheiro .strings.json. Os títulos dos ficheiros .strings têm de corresponder ao código de idioma atribuído aos utilizadores ou grupos que estão a usar esse idioma, e o título do ficheiro de idioma predefinido tem de corresponder ao valor de default_locale no ficheiro de manifesto do seu projeto.
O fragmento apresentado no novo ficheiro .strings.json oferece um exemplo de formatação JSON. Elimine este exemplo e substitua-o por um par de chavetas: {}
Copie os pares de chave-valor do seu ficheiro .strings antigo e cole-os entre as chavetas.
Substitua todos os sinais de igual por dois pontos.
Remover quaisquer comentários ou reformatá-los como comentários individuais ou como uma matriz de comentários, conforme ilustrado em seguida.
Substituir todos os pontos e vírgulas por vírgulas.
A formatação .strings.json típica dos pares de chave-valor tem o seguinte aspeto:
Para formatar comentários, pode usar estes formatos:
{
" 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"
}
}
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-20 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```"]]