Skip to content

fix(i18n): rename pt-pt to pt for European Portuguese (Portugal) #886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 18, 2024

Conversation

cheton
Copy link
Collaborator

@cheton cheton commented Oct 17, 2024

PR Type

enhancement, documentation


Description

  • Renamed the language code from pt-pt to pt for Portuguese (Portugal) across various configuration files.
  • Added new translations for machine states, G-code commands, and resources in Portuguese (Portugal).
  • Updated server settings to reflect the new language code and corrected a comment for the Ukrainian language.

Changes walkthrough 📝

Relevant files
Enhancement
build.config.js
Update language code for Portuguese (Portugal) in build configuration

build.config.js

  • Renamed language code from pt-pt to pt for Portuguese (Portugal).
  • +1/-1     
    i18n.js
    Modify i18n constants for Portuguese (Portugal)                   

    src/app/constants/i18n.js

  • Updated language code from pt-pt to pt for Portuguese (Portugal).
  • +1/-1     
    settings.base.js
    Adjust server settings for language codes                               

    src/server/config/settings.base.js

  • Changed language code from pt-pt to pt for Portuguese (Portugal).
  • Corrected comment for uk language to Ukrainian.
  • +4/-4     
    Documentation
    controller.json
    Add Portuguese translations for machine states                     

    src/app/i18n/pt/controller.json

    • Added translations for machine states in Portuguese (Portugal).
    +45/-1   
    gcode.json
    Add Portuguese translations for G-code commands                   

    src/app/i18n/pt/gcode.json

    • Added G-code command translations in Portuguese (Portugal).
    +42/-1   
    resource.json
    Add comprehensive Portuguese translations for resources   

    src/app/i18n/pt/resource.json

    • Added extensive resource translations in Portuguese (Portugal).
    +545/-1 
    config.json
    Configure text direction for Portuguese (Portugal)             

    src/server/i18n/pt/config.json

    • Added configuration for text direction in Portuguese (Portugal).
    +4/-1     
    resource.json
    Add server resource translations in Portuguese                     

    src/server/i18n/pt/resource.json

    • Added basic server resource translations in Portuguese (Portugal).
    +5/-1     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    codesandbox bot commented Oct 17, 2024

    Review or Edit in CodeSandbox

    Open the branch in Web EditorVS CodeInsiders

    Open Preview

    @cheton cheton linked an issue Oct 17, 2024 that may be closed by this pull request
    3 tasks
    Copy link
    Contributor

    codiumai-pr-agent-free bot commented Oct 17, 2024

    PR Reviewer Guide 🔍

    (Review updated until commit 9920ff5)

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Language Code Change
    The language code for Portuguese (Portugal) has been changed from 'pt-pt' to 'pt'. Verify that this change is consistent throughout the application and doesn't break any existing functionality.

    JSON Indentation Change
    The JSON indentation has been changed from 4 spaces to 2 spaces. Ensure this change is intentional and consistent across all configuration files.

    Language List Modification
    The list of supported languages has been modified. Verify that all language codes are correct and that the changes don't affect language selection functionality in the application.

    @cheton cheton changed the title feat(i18n): rename pt-pt to pt for Portuguese (Portugal) fix(i18n): rename pt-pt to pt for Portuguese (Portugal) Oct 17, 2024
    @cheton cheton changed the title fix(i18n): rename pt-pt to pt for Portuguese (Portugal) fix(i18n): rename pt-pt to pt for European Portuguese (Portugal) Oct 17, 2024
    @cheton
    Copy link
    Collaborator Author

    cheton commented Oct 17, 2024

    /improve

    Copy link
    Contributor

    codiumai-pr-agent-free bot commented Oct 17, 2024

    PR Code Suggestions ✨

    Latest suggestions up to 9920ff5

    CategorySuggestion                                                                                                                                    Score
    Enhancement
    Add more detailed comments to clarify language code distinctions

    Consider adding a comment to explain the difference between 'pt' and 'pt-br'
    language codes, as it might not be immediately clear to all developers.

    build.config.js [13-14]

    -'pt', // European Portuguese (Portugal)
    -'pt-br', // Brazilian Portuguese (Brazil)
    +'pt', // European Portuguese (Portugal) - ISO 639-1 code
    +'pt-br', // Brazilian Portuguese (Brazil) - ISO 639-1 code with country extension
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why:

    7
    Remove trailing whitespace to maintain consistency and prevent potential issues

    Remove the trailing space in the translation for "Spindle On, CW (M3)". This ensures
    consistency with other entries and prevents potential issues with string
    comparisons.

    src/app/i18n/de/gcode.json [35]

    +"Spindle On, CW (M3)": "Spindel An, Rechtslauf (M3)",
     
    -
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why:

    7
    Best practice
    Use a constant for configuration values to improve maintainability

    Consider using a constant or configuration variable for the jsonIndent value to
    maintain consistency across different config files.

    i18next-scanner.app.config.js [58]

    -jsonIndent: 2,
    +jsonIndent: CONFIG.JSON_INDENT,
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why:

    7
    Maintain consistent JSON formatting for improved readability and maintainability

    Consider using a consistent format for the JSON object. The new code uses a more
    compact format without indentation, while the old code used indentation. For
    consistency and readability, it's recommended to use a consistent indentation style
    throughout the file.

    src/app/i18n/de/gcode.json [1-41]

     {
    -  "Rapid Move (G0)": "Eilgang (G0)",
    -  "Linear Move (G1)": "Lineare Bewegung (G1)",
    -  ...
    -  "Coolant Off (M9)": "Kühlung Aus (M9)"
    +    "Rapid Move (G0)": "Eilgang (G0)",
    +    "Linear Move (G1)": "Lineare Bewegung (G1)",
    +    ...
    +    "Coolant Off (M9)": "Kühlung Aus (M9)"
     }
    Suggestion importance[1-10]: 7

    Why:

    7
    Maintainability
    Sort language codes alphabetically for improved organization

    Consider sorting the language codes alphabetically for better readability and easier
    maintenance.

    src/server/config/settings.base.js [126-133]

    +'nl', // Dutch
    +'pt', // Portuguese (Portugal)
    +'pt-br', // Portuguese (Brazil)
    +'ru', // Russian
    +'tr', // Turkish
    +'uk', // Ukrainian
    +'zh-cn', // Simplified Chinese
    +'zh-tw', // Traditional Chinese
     
    -
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why:

    7

    Previous suggestions

    Suggestions up to commit 9920ff5
    CategorySuggestion                                                                                                                                    Score
    Enhancement
    Add more detailed comments to clarify language code choices

    Consider adding a comment to explain the difference between 'pt' and 'pt-br'
    language codes, as it might not be immediately clear to all developers why both are
    necessary.

    build.config.js [13-14]

    -'pt', // European Portuguese (Portugal)
    -'pt-br', // Brazilian Portuguese (Brazil)
    +'pt', // European Portuguese (Portugal) - ISO 639-1 code
    +'pt-br', // Brazilian Portuguese (Brazil) - ISO 639-1 code with country extension
    Suggestion importance[1-10]: 7

    Why:

    7
    Improve German translations for better clarity and idiomatic language use

    Consider using more idiomatic German translations for some of the machine states.
    For example, "Lauf" could be changed to "In Betrieb" for better clarity.

    src/app/i18n/de/controller.json [9]

    -"run": "Lauf",
    +"run": "In Betrieb",
    Suggestion importance[1-10]: 7

    Why:

    7
    Add missing translations for Smoothie controller states to ensure completeness

    Consider adding translations for the missing states in the Smoothie section to
    maintain consistency with the other controller types.

    src/app/i18n/de/controller.json [33-41]

     "Smoothie": {
         "activeState": {
             "idle": "Leerlauf",
             "run": "Lauf",
             "hold": "Anhalten",
             "door": "Tür",
             "home": "Referenzfahrt",
    +        "sleep": "Schlafen",
             "alarm": "Alarm",
             "check": "Überprüfen"
         }
     }
    Suggestion importance[1-10]: 7

    Why:

    7
    Remove trailing whitespace in translation string

    Remove the extra space at the end of the "Spindle On, CW (M3)" translation to
    maintain consistency with other entries.

    src/app/i18n/de/gcode.json [35]

    +"Spindle On, CW (M3)": "Spindel An, Rechtslauf (M3)",
     
    -
    Suggestion importance[1-10]: 7

    Why:

    7
    Best practice
    Use a constant for configuration values to improve maintainability

    Consider using a constant for the jsonIndent value to maintain consistency across
    configuration files.

    i18next-scanner.app.config.js [58]

    -jsonIndent: 2,
    +jsonIndent: JSON_INDENT,
    Suggestion importance[1-10]: 7

    Why:

    7
    Maintainability
    Maintain consistent order of language codes across configuration files

    Ensure that the order of language codes is consistent across all configuration files
    to avoid confusion and maintain uniformity.

    src/server/config/settings.base.js [126-133]

     'nl', // Dutch
     'pt', // Portuguese (Portugal)
     'pt-br', // Portuguese (Brazil)
     'ru', // Russian
     'tr', // Turkish
     'uk', // Ukrainian
     'zh-cn', // Simplified Chinese
    -'zh-tw', // Traditional Chinese
    +'zh-tw' // Traditional Chinese
    Suggestion importance[1-10]: 7

    Why:

    7
    Consistency
    Ensure consistency in translation format for coordinate system entries

    Consider using a consistent format for the translation of "P1 (G54)" to "P6 (G59)".
    Currently, these entries have translations while they were empty before. Ensure this
    change is intentional and consistent with other language files.

    src/app/i18n/de/gcode.json [11-16]

    +"P1 (G54)": "P1 (G54)",
    +"P2 (G55)": "P2 (G55)",
    +"P3 (G56)": "P3 (G56)",
    +"P4 (G57)": "P4 (G57)",
    +"P5 (G58)": "P5 (G58)",
    +"P6 (G59)": "P6 (G59)",
     
    -
    Suggestion importance[1-10]: 7

    Why:

    7
    ✅ Suggestions up to commit 59dda69
    CategorySuggestion                                                                                                                                    Score
    Enhancement
    ✅ Clarify language code comments to accurately represent supported Portuguese variants
    Suggestion Impact:The commit updated the comments for the 'pt' and 'pt-br' language codes to clarify the Portuguese variants, aligning with the suggestion's intent.

    code diff:

    -    'pt', // Portuguese (Portugal)
    -    'pt-br', // Portuguese (Brazil)
    +    'pt', // European Portuguese (Portugal)
    +    'pt-br', // Brazilian Portuguese (Brazil)

    Consider updating the comment for the 'pt' language code to include both European
    and Brazilian Portuguese for clarity.

    build.config.js [13-14]

    -'pt', // Portuguese (Portugal)
    -'pt-br', // Portuguese (Brazil)
    +'pt', // Portuguese (European and Brazilian)
    +'pt-br', // Portuguese (Brazil, alternative code)
    Suggestion importance[1-10]: 7

    Why:

    7
    Use a more inclusive label for the Portuguese language option

    Consider using a more generic label for the 'pt' language code to include both
    European and Brazilian Portuguese.

    src/app/constants/i18n.js [11-12]

    -{ value: 'pt', label: 'Português (Portugal)' }, // European Portuguese
    -{ value: 'pt-br', label: 'Português (Brasil)' }, // Brazilian Portuguese
    +{ value: 'pt', label: 'Português' }, // Portuguese (covers both European and Brazilian)
    +{ value: 'pt-br', label: 'Português (Brasil)' }, // Brazilian Portuguese (alternative code)
    Suggestion importance[1-10]: 7

    Why:

    7
    ✅ Improve German translations for machine states to be more idiomatic and consistent with industry terminology
    Suggestion Impact:The suggestion was implemented as the translations for "run" were changed to "Lauf" and "home" to "Referenzfahrt" in the commit.

    code diff:

    -            "run": "Lauf",
    -            "hold": "Anhalten",
    -            "probe": "Sondierung",
    -            "cycle": "Zyklus",
    -            "homing": "Referenzfahrt",
    -            "jog": "Joggen",
    -            "interlock": "Sicherheitsverriegelung",
    -            "shutdown": "Herunterfahren",
    -            "panic": "Panik"
    -        }
    -    },
    -    "Grbl": {
    -        "activeState": {
    -            "idle": "Leerlauf",
    -            "run": "Lauf",
    -            "hold": "Anhalten",
    -            "door": "Tür",
    -            "home": "Referenzfahrt",
    -            "sleep": "Schlafen",
    -            "alarm": "Alarm",
    -            "check": "Überprüfen"
    -        }
    -    },
    -    "Smoothie": {
    -        "activeState": {
    -            "idle": "Leerlauf",
    -            "run": "Lauf",
    -            "hold": "Anhalten",
    -            "door": "Tür",
    -            "home": "Referenzfahrt",
    -            "alarm": "Alarm",
    -            "check": "Überprüfen"
    -        }
    +  "TinyG": {
    +    "machineState": {
    +      "initializing": "Initialisierung",
    +      "ready": "Bereit",
    +      "alarm": "Alarm",
    +      "stop": "Programmstopp",
    +      "end": "Programmen Ende",
    +      "run": "Lauf",
    +      "hold": "Anhalten",
    +      "probe": "Sondierung",
    +      "cycle": "Zyklus",
    +      "homing": "Referenzfahrt",
    +      "jog": "Joggen",
    +      "interlock": "Sicherheitsverriegelung",
    +      "shutdown": "Herunterfahren",
    +      "panic": "Panik"
         }
    -}
    +  },
    +  "Grbl": {
    +    "activeState": {
    +      "idle": "Leerlauf",
    +      "run": "Lauf",
    +      "hold": "Anhalten",
    +      "door": "Tür",
    +      "home": "Referenzfahrt",
    +      "sleep": "Schlafen",
    +      "alarm": "Alarm",
    +      "check": "Überprüfen"
    +    }
    +  },
    +  "Smoothie": {
    +    "activeState": {
    +      "idle": "Leerlauf",
    +      "run": "Lauf",
    +      "hold": "Anhalten",
    +      "door": "Tür",
    +      "home": "Referenzfahrt",

    Consider using more idiomatic German translations for some of the machine states.
    For example, "Ausführen" could be changed to "Lauf" for "run", and "Startposition"
    to "Referenzfahrt" for "home".

    src/app/i18n/de/controller.json [23-26]

    -"run": "Ausführen",
    -"hold": "Halten",
    -"door": "Tür",
    -"home": "Startposition",
    +"run": "Lauf",
    +"hold": "Halt",
    +"door": "Tür offen",
    +"home": "Referenzfahrt",
    Suggestion importance[1-10]: 7

    Why:

    7
    Remove trailing whitespace in translation strings for consistency

    Remove the trailing space in the translation for "Spindle On, CW (M3)" to maintain
    consistency with other entries.

    src/app/i18n/de/gcode.json [35]

    +"Spindle On, CW (M3)": "Spindel An, Rechtslauf (M3)",
     
    -
    Suggestion importance[1-10]: 7

    Why:

    7
    ✅ Suggestions up to commit 938a32b
    CategorySuggestion                                                                                                                                    Score
    Enhancement
    ✅ Correct spelling in translation file to improve accuracy

    Consider using "Suspensão" instead of "Suspenção" for the "sleep" state in the Grbl
    section to correct the spelling.

    src/app/i18n/pt/controller.json [27]

    -"sleep": "Suspenção",
    +"sleep": "Suspensão",

    [Suggestion has been applied]

    Suggestion importance[1-10]: 9

    Why: Correcting the spelling from "Suspenção" to "Suspensão" improves the accuracy of the translation, which is crucial for maintaining professionalism and clarity in the translation file.

    9
    Maintain alphabetical order in the language list for better organization and readability

    Consider updating the order of language entries to maintain alphabetical sorting.
    Move the new 'pt' entry before 'pt-br' to keep the list organized.

    src/app/constants/i18n.js [10-12]

    +{ value: 'nl', label: 'Nederlands' },
    +{ value: 'pt', label: 'Português (Portugal)' },
    +{ value: 'pt-br', label: 'Português (Brasil)' },
     
    -
    Suggestion importance[1-10]: 8

    Why: The suggestion to maintain alphabetical order in the language list improves organization and readability, making it easier for developers to locate specific entries.

    8
    ✅ Translate missing entries in the G-code translation file to ensure completeness

    Consider translating the empty strings for "Active Tool Offset (G43.1)" and "No Tool
    Offset (G49)" to maintain consistency in the translation file.

    src/app/i18n/pt/gcode.json [29-30]

    -"Active Tool Offset (G43.1)": "",
    -"No Tool Offset (G49)": "",
    +"Active Tool Offset (G43.1)": "Compensação de Ferramenta Ativa (G43.1)",
    +"No Tool Offset (G49)": "Sem Compensação de Ferramenta (G49)",

    [Suggestion has been applied]

    Suggestion importance[1-10]: 8

    Why: The suggestion addresses missing translations for "Active Tool Offset (G43.1)" and "No Tool Offset (G49)", enhancing the completeness and consistency of the translation file.

    8
    ✅ Translate missing M-code command to ensure completeness of the G-code translation file

    Translate "Optional Program Stop (M1)" to maintain consistency with other translated
    M-code commands.

    src/app/i18n/pt/gcode.json [32]

    -"Optional Program Stop (M1)": "",
    +"Optional Program Stop (M1)": "Paragem Opcional do Programa (M1)",

    [Suggestion has been applied]

    Suggestion importance[1-10]: 8

    Why: Translating "Optional Program Stop (M1)" fills a gap in the translation file, ensuring consistency with other translated M-code commands and improving the file's completeness.

    8
    ✅ Standardize translations across different controller types for consistency

    For consistency, consider using "Suspensão" instead of "Dormir" for the "sleep"
    state in the Smoothie section, matching the translation used in the Grbl section.

    src/app/i18n/pt/controller.json [39]

    -"sleep": "Dormir",
    +"sleep": "Suspensão",

    [Suggestion has been applied]

    Suggestion importance[1-10]: 7

    Why: Changing "Dormir" to "Suspensão" for the "sleep" state in the Smoothie section ensures consistency with the Grbl section, enhancing uniformity across different controller types.

    7
    Best practice
    Maintain consistent comment formatting throughout the language list

    Ensure consistency in comment formatting by adding a period at the end of the
    'Dutch' comment, similar to other language comments.

    src/server/config/settings.base.js [126-128]

    -'nl', // Dutch
    +'nl', // Dutch.
     'pt', // Portuguese (Portugal)
     'pt-br', // Portuguese (Brazil)
    Suggestion importance[1-10]: 5

    Why: While the suggestion to add a period for consistency in comment formatting is valid, it is a minor stylistic improvement with limited impact on the code's functionality or readability.

    5

    @cheton
    Copy link
    Collaborator Author

    cheton commented Oct 17, 2024

    /review

    Copy link
    Contributor

    Persistent review updated to latest commit 9920ff5

    @cncjs cncjs deleted a comment from codiumai-pr-agent-free bot Oct 18, 2024
    @cheton cheton merged commit 890cf49 into master Oct 18, 2024
    4 checks passed
    @cheton cheton deleted the cncjs-844 branch October 18, 2024 14:46
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    Error: Cannot find module './pt-pt'
    1 participant